Skip to content
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] Hide cart images when the view is too narrow #15028

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

joshheald
Copy link
Contributor

@joshheald joshheald commented Jan 31, 2025

Description

This PR adds a minimum width criteria for showing the images on CartItems, as they are often shown in a fairly constrained width, especially in portrait or landscape 2/3rds views.

1/2 landscape view on a 13" iPad never shows images – it's pretty rough even at the smallest sizes if we show them, at least when there's a remove button shown as well. On the Checkout screen it looks like there's space, but it's strange for the cart items to change as you move between those two screens.

The dynamicTypeSize and width go together to decide whether the images should be shown, so the minimum width changes depending on your current type size.

Note that I chose to do the calculations on the cart, not each image. It just felt bad for performance to have lots of views using geometry readers to calculate the exact same answer... but it would be nicer from a code-readability perspective to have it on the item cards.

Another nice step would be to update DynamicHStack to respond to width constraints as well – at the moment, moving to an accessibilty size avoids the Cart title having to wrap, but we could do that at smaller sizes when in a narrower display mode. I think that should be done separately though.

Steps to reproduce

  1. Launch the app and navigate to POS
  2. Add an item to the cart
  3. Observe that at 100% text size (and some sizes above) in landscape fullscreen, the cart image is shown.
  4. Navigate to the checkout
  5. Observe that the cart image is still shown (or hidden) as it was on the previous screen.

Explore different screen size splits, orientations, and dynamic type sizes.

Testing information

I've tested this by moving between the item list and checkout, in portrait, landscape 2/3rds, and landscape views.

I used an iPad Air on 17.5, an iPad mini simulator, and an iPad Air 13" simulator.

Screenshots

remove.image.in.split.view.mp4

  • I have considered if this change warrants user-facing release notes and have added them to 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:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@joshheald joshheald added type: task An internally driven task. feature: POS labels Jan 31, 2025
@joshheald joshheald added this to the 21.7 milestone Jan 31, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 31, 2025

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr15028-c846d96
Version21.5
Bundle IDcom.automattic.alpha.woocommerce
Commitc846d96
App Center BuildWooCommerce - Prototype Builds #12746
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@joshheald joshheald marked this pull request as ready for review January 31, 2025 09:45
@joshheald joshheald requested a review from staskus January 31, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: POS type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants