Skip to content

[Woo POS] Update POS menu item based on the latest design #12793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions WooCommerce/Classes/Extensions/UIImage+Woo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,12 @@ extension UIImage {
.imageFlippedForRightToLeftLayoutDirection()
}

/// Play square image
///
static var playSquareImage: UIImage {
UIImage(systemName: "play.square")!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at other systems icons and thinking maybe "creditcard" or some of it variations would fit better? Play button maybe indicates more that some video or something will be started. This icon will be hard to define since we are starting a special mode and not just showing a basic screen (normal indicator). Hm...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit unsure about the credit card mention because cash is also supported, I saw your comment in p91TBi-beb-p2#comment-12153 and we can wait for the final design decision. There's a separate subtask in #12779 to make any design updates from the entry point p2.

}

/// Plus Icon
///
static var plusImage: UIImage {
Expand All @@ -1076,6 +1082,12 @@ extension UIImage {
return UIImage.gridicon(.plusSmall)
}

/// Point of sale image
///
static var pointOfSaleImage: UIImage {
UIImage(named: "point-of-sale")!
}

/// Product description AI announcement image
///
static var productDescriptionAIAnnouncementImage: UIImage {
Expand Down
10 changes: 7 additions & 3 deletions WooCommerce/Classes/ViewRelated/Hub Menu/HubMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private extension HubMenu {
// Point of Sale
if let menu = viewModel.posElement {
Section {
menuItemView(menu: menu)
menuItemView(menu: menu, chevron: .enteringMode)
}
}

Expand All @@ -109,7 +109,7 @@ private extension HubMenu {
}

@ViewBuilder
func menuItemView(menu: HubMenuItem) -> some View {
func menuItemView(menu: HubMenuItem, chevron: Row.Chevron = .leading) -> some View {
Button {
handleTap(menu: menu)
} label: {
Expand All @@ -118,7 +118,7 @@ private extension HubMenu {
iconBadge: menu.iconBadge,
description: menu.description,
icon: .local(menu.icon),
chevron: .leading)
chevron: chevron)
.foregroundColor(Color(menu.iconColor))
}
.accessibilityIdentifier(menu.accessibilityIdentifier)
Expand Down Expand Up @@ -233,6 +233,7 @@ private extension HubMenu {
case none
case down
case leading
case enteringMode

var asset: UIImage {
switch self {
Expand All @@ -242,6 +243,9 @@ private extension HubMenu {
return .chevronDownImage
case .leading:
return .chevronImage
case .enteringMode:
return .playSquareImage
.withTintColor(.secondaryLabel, renderingMode: .alwaysTemplate)
}
}
}
Expand Down
16 changes: 12 additions & 4 deletions WooCommerce/Classes/ViewRelated/Hub Menu/HubMenuViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,10 @@ extension HubMenuViewModel {
struct PointOfSaleEntryPoint: HubMenuItem {
static var id = "pointOfSale"

let title: String = "Point Of Sale"
let description: String = "Point Of Sale entry point"
let icon: UIImage = UIImage(systemName: "ladybug.fill")!
let iconColor: UIColor = .red
let title: String = Localization.pos
let description: String = Localization.posDescription
let icon: UIImage = .pointOfSaleImage
let iconColor: UIColor = .withColorStudio(.green, shade: .shade30)
let accessibilityIdentifier: String = "menu-pointOfSale"
let trackingOption: String = "pointOfSale"
let iconBadge: HubMenuBadgeType? = nil
Expand Down Expand Up @@ -484,6 +484,14 @@ extension HubMenuViewModel {
"My Store",
comment: "Title of the hub menu view in case there is no title for the store")

static let pos = NSLocalizedString(
"Point of Sale Mode",
comment: "Title of the POS menu in the hub menu")

static let posDescription = NSLocalizedString(
"Use the app as a cash register",
comment: "Description of the POS menu in the hub menu")

static let woocommerceAdmin = NSLocalizedString(
"WooCommerce Admin",
comment: "Title of one of the hub menu options")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "point-of-sale.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Binary file not shown.
8 changes: 8 additions & 0 deletions WooCommerce/WooCommerceTests/Extensions/IconsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,10 @@ final class IconsTests: XCTestCase {
XCTAssertNotNil(UIImage.print)
}

func test_playSquareImage_is_not_nil() {
XCTAssertNotNil(UIImage.playSquareImage)
}

func testPlusImageIconIsNotNil() {
XCTAssertNotNil(UIImage.plusImage)
}
Expand All @@ -502,6 +506,10 @@ final class IconsTests: XCTestCase {
XCTAssertNotNil(UIImage.plusSmallImage)
}

func test_pointOfSaleImage_is_not_nil() {
XCTAssertNotNil(UIImage.pointOfSaleImage)
}

func test_productDescriptionAIAnnouncementImage_is_not_nil() {
XCTAssertNotNil(UIImage.productDescriptionAIAnnouncementImage)
}
Expand Down