Skip to content

[WOOMOB-192] Update Empty Coupon Screen #14014

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

Conversation

malinajirka
Copy link
Contributor

@malinajirka malinajirka commented May 5, 2025

Closes: #WOOMOB-192

Description

This PR updates the Empty Coupons screen

  • Adds CTA - the action itself is not implemented in this PR
  • Aligns the content of the empty screen vertically

Testing information

  1. Open POS on a store without coupons

  2. Tap on Coupons tab

  3. Notice the empty screen

  4. Open POS on a store with coupons

  5. Tap on Coupons tab

  6. Verify coupons are listed as expected

The tests that have been performed

The above.

Images/gif

Before After
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

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 big (tablet) and small (phone) in case of UI changes, and no regressions are added.
2

@malinajirka malinajirka requested a review from Copilot May 5, 2025 10:41
@malinajirka malinajirka added this to the 22.4 milestone May 5, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for a "Create Coupon" feature by updating the empty coupon screen, introducing a new UI event, and updating the corresponding view model and UI components.

  • Added a new UI event (CreateCouponClicked) to handle coupon creation.
  • Updated the empty coupon screen to include a new action button and adjusted spacing.
  • Modified the empty list composable to support an action label and callback.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
WooPosCouponsViewModel.kt Added handling for CreateCouponClicked which currently throws an error.
WooPosCouponsUIEvent.kt Introduced the new CreateCouponClicked event.
WooPosCouponsScreen.kt Updated the screen to include an action button for creating a coupon.
WooPosItemsList.kt Overloaded the empty list composable to include an action button and adjusted spacing.
Files not reviewed (1)
  • WooCommerce/src/main/res/values/strings.xml: Language not supported

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 5, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit35b78fb
Direct Downloadwoocommerce-wear-prototype-build-pr14014-35b78fb.apk

@malinajirka malinajirka requested a review from samiuelson May 5, 2025 10:47
@malinajirka malinajirka marked this pull request as ready for review May 5, 2025 10:47
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 5, 2025

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

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit35b78fb
Direct Downloadwoocommerce-prototype-build-pr14014-35b78fb.apk

}

@Composable
private fun WooPosItemsEmptyListInternal(
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've considered creating a sealed class to ensure actionLabel and onActionClicked either need to be both null or both non-null, but in the end I opted for making this function private and include Internal in its name instead and provide two overloads. Let me know what you think.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 32 lines in your changes missing coverage. Please review.

Project coverage is 38.28%. Comparing base (ca8123a) to head (35b78fb).
Report is 8 commits behind head on trunk.

Files with missing lines Patch % Lines
...ce/android/ui/woopos/home/items/WooPosItemsList.kt 0.00% 29 Missing ⚠️
...oopos/home/items/coupons/WooPosCouponsViewModel.kt 0.00% 2 Missing ⚠️
.../woopos/home/items/coupons/WooPosCouponsUIEvent.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14014      +/-   ##
============================================
- Coverage     38.29%   38.28%   -0.02%     
  Complexity     9496     9496              
============================================
  Files          2118     2118              
  Lines        116436   116467      +31     
  Branches      14937    14948      +11     
============================================
  Hits          44585    44585              
- Misses        67774    67805      +31     
  Partials       4077     4077              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samiuelson samiuelson self-assigned this May 6, 2025
Copy link
Contributor

@samiuelson samiuelson left a comment

Choose a reason for hiding this comment

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

LGTM!

onClick = onActionClicked,
modifier = Modifier
.fillMaxWidth(0.5f)
.height(80.dp)
Copy link
Contributor

Choose a reason for hiding this comment

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

💡n.p.: Text size in the button can be scaled up in the accessibility settings. Maybe let's use top padding instead of fixed height 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I see what you mean and I tend to agree, however, this was copied and there are 5+ other buttons like this in the POS. Considering we tested other projects for accessibility and didn't report this an issue I believe it might look fine even with the biggest font. At the moment, it's imo not worth the effort to diving more into this.

@malinajirka malinajirka merged commit 03cf0da into trunk May 7, 2025
17 checks passed
@malinajirka malinajirka deleted the issue/woomob-192-woo-pos-handle-state-when-there-are-no-coupons-in-a-store branch May 7, 2025 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants