-
Notifications
You must be signed in to change notification settings - Fork 111
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
[Woo POS] [Variable Products] Add parent product to the POSItem enum, and make UI #14771
Conversation
…roducts based on product type in item service, and show new `ParentProductCardView` for parent products.
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work!
I'm approving. Good job on making certain parts reusable while splitting the parent and simple product use-cases which are likely to keep diverging in the future 👍 .
Before merging:
- Address the large accessibility sizes issue
For this / future tasks:
- Make sure we don't leave POS in a half-working state during the project development
- Try to reuse existing colors / clarify if "Options available" is supposed to be a special case in the POS color pallete.
Thanks!
imageSize: Constants.productCardSize * scale, | ||
scale: scale) | ||
.frame(width: min(Constants.productCardSize * scale, Constants.maximumProductCardSize), | ||
height: Constants.productCardSize * scale) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, clipped
needs to be placed after the frame
. I think it'd be great to remove the if/else condition in the product image view and use a placeholder image instead of setting up the view differently based on the image source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the ideal UX is to scale to fit with the same aspect ratio, I checked a few product images and they are cropped too much. I compared it with trunk, the cropping behavior is the same but it's out of the scope of this PR. I created a separate issue for this: #14776.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 093b952.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a separate issue for this: #14776.
Thank you!
imageSize: Constants.productCardSize * scale, | ||
scale: scale) | ||
.frame(width: min(Constants.productCardSize * scale, Constants.maximumProductCardSize), | ||
height: Constants.productCardSize * scale) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
height: Constants.productCardSize * scale) | |
height: Constants.productCardSize * scale) | |
.clipped() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 093b952.
@@ -87,6 +87,17 @@ extension Color { | |||
) | |||
} | |||
|
|||
// MARK: - POS Items | |||
|
|||
static var posItemSecondaryText: Color { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should have a separate color only for the "Options Available" text. We cleaned up after M1 to limit the number of colors and have a consistent POS color palette. I see we started reintroducing more view-specific colors. I suppose the reason is new designs that do not follow a consistent color palette. Did you take this color from Figma?
IMHO, ideally we would have primary/secondary/tertiary text and background colors which would cover most if not all the POS. For some special scenarios, we would define colors within specific views.
This comment is not a blocker, although it would be great if we reuse the existing color and clarify if this particular color is intended to be reused anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this gray shade 60 is from the design rNAclWFAdQRw7EXEcsNVai-fi-2653_11376. It makes sense to reuse the colors from the POS color constants. I also had to guess the dark mode version, so we will want a design review anyways. Updated in d68a7f0.
Thanks for catching the large font size issue and the feedback on reusing the colors @staskus! I believe I've addressed the comments and updated the PR. The screenshots in the PR description are also up to date with the existing POS secondary text color, which looks good in both light and dark modes. |
Closes: #14700
Description
This pull request adds support for showing the parent product card for a variable product in the POS item selector. The main changes include adding a new
ParentProductCardView
, creating reusable view modifiers for item card styles and a reusable image view to share UI in the simple and parent product card views.New components and views:
WooCommerce/Classes/POS/Presentation/ParentProductCardView.swift
: Added a newParentProductCardView
struct to display parent products in the POS system. This view includes a detailed view for variable products. When supporting other product types with a parent product (e.g. bundle), the detailed view can be configured based on the parent product type.WooCommerce/Classes/POS/Presentation/Reusable Views/POSItemImageView.swift
: Introduced a newPOSItemImageView
struct to handle the display of product images within POS item cards. I was wondering if we could just use a placeholder image inProductImageThumbnail
, but didn't want to change the pre-existing behavior until we're working on UI/UX polishes.Refactoring and reusable styles:
WooCommerce/Classes/POS/Presentation/Reusable Views/POSItemCardBorderStylesModifier.swift
: Created a newPOSItemCardBorderStylesModifier
struct to apply consistent border styles to item cards. This modifier is used in bothSimpleProductCardView
andParentProductCardView
.WooCommerce/Classes/POS/Presentation/SimpleProductCardView.swift
: RefactoredSimpleProductCardView
to use the newPOSItemImageView
andPOSItemCardBorderStylesModifier
for improved code reusability and consistency. [1] [2]These changes collectively improve the maintainability and visual consistency of the POS product card views.
Steps to reproduce
🗒️ As the variable products support require WC version 9.6+ which is not publicly released at the time of writing, I'd recommend commenting out L214 in ProductsRemote to include all product types.
Testing information
Compared the product card UI with trunk to ensure there are no UI changes in the simple product cards.
Screenshots
RELEASE-NOTES.txt
if necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: