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

feat: payment quantity selector #6669

Merged
merged 23 commits into from
Aug 30, 2023
Merged

Conversation

KenLSM
Copy link
Contributor

@KenLSM KenLSM commented Aug 28, 2023

Problem

We currently use a combobox component for the quantity selector, here are the problems with it:

  • When you input a number it searches and if the quantity is not allowed it will show 'No matching results'
  • It doesn't tell the user what the maximum is
  • Comboboxes on mobile is a problem for accessibility

Review the mini-PRD to better understand the UX behaviours

Closes FRM-1252

Solution

  1. Added <PaymentQuantityModal /> under each <PaymentCard />
  2. Swapped <ItemQuantity /> with <ItemQuantityButton />
  3. Introduced selector-bottom size and selector for <Modal />
  • this theme is turned on when the user is on a mobile phone to allow the modal to position itself at bottom of the page
  • chosen to use size instead of variant as these themes are specific to breakpoints which is controlled by size

Breaking Changes

  • No - this PR is backwards compatible

UI Changes

  • <PaymentCard /> has its background removed as a move towards the new design. Notably the border hover/active is not updated as design is still figuring out the best interaction with the new quantity button

Bug Fixes:

  • fixes label :focus border

Before & After Screenshots

Before
PaymentPreview
Screenshot 2023-08-29 at 5 32 48 PM

After
Mobile View
Screenshot 2023-08-29 at 5 29 56 PM

Desktop View
Screenshot 2023-08-29 at 5 29 12 PM

PaymentPreview
Screenshot 2023-08-29 at 5 32 02 PM

Tests

Payment Modal

Modal x PaymentCard data mutation, on admin

  • Add product item with name: min qty 1 max qty 99, description: bar, amt: 1, multi_qty: min_qty: 1, max_qty: 99
  • Ensure that PaymentCard has a quantity button with default Qty: 1
  • Ensure that clicking on the quantity button brings up the modal
  • Change the qty input to be 99
  • Ensure that clicking on X button closes the modal
    • Quantity button on PaymentCard remains as Qty: 1
  • Change the qty input to be 99
  • Ensure that clicking on Cancel button closes the modal
    • Quantity button on PaymentCard remains as Qty: 1
  • Change the qty input to be 99
  • Ensure that clicking on 'Submit` button closes the modal
    • Quantity button on PaymentCard updates to Qty: 99
    • Total price on PaymentPreview updates to S$99.00

Modal x PaymentCard data mutation, on responder side

  • Add product item with name: min qty 1 max qty 99, description: bar, amt: 1, multi_qty: min_qty: 1, max_qty: 99
  • Make the form public and run the below tests as a responder
  • Ensure that PaymentCard has a quantity button with default Qty: 1
  • Ensure that clicking on the quantity button brings up the modal
  • Change the qty input to be 99
  • Ensure that clicking on 'Submit` button closes the modal
    • Quantity button on PaymentCard updates to Qty: 99
    • Total price on PaymentPreview updates to S$99.00
  • Verify your email and proceed to the dedicate payment page
  • Ensure that price remains as S$99.00

Item without multi_qty

  • Add product item with name: no multi_qty, description: bar, multi_qty: toggled off
  • Ensure that PaymentCard does not have any quantity button rendered

Item with min and max as 1

  • Add product item with name: min qty 1 max qty 1, description: bar, multi_qty: toggled on, min_qty: 1, max_qty: 1
  • Ensure that PaymentCard has a quantity button with default Qty: 1
  • Ensure that clicking on the quantity button brings up the modal
  • Ensure that Minus/Plus buttons are disabled and not interactable
  • Delete the value on the input, and close the modal
  • Open the modal again
  • Ensure that the input is 1
  • Delete the value on the input
  • Ensure that the Plus button is enabled
  • Click on the Plus button, and ensure that the quantity is now set to 1 (the min_qty)
  • Ensure that Minus/Plus buttons are now disabled and not interactable

Item with non min of 1

  • Add product item with name: min qty 2 max qty 99, description: bar, multi_qty: min_qty: 2, max_qty: 99
  • Ensure that PaymentCard has a quantity button with default Qty: 2
  • Ensure that Minus button is disabled and not interactable
  • Delete the value on the input, and close the modal
  • Open the modal again
  • Ensure that the input is 2
  • Delete the value on the input
  • Ensure that the Plus button is enabled
  • Click on the Plus button, and ensure that the quantity is now set to 2 (the min_qty)
  • Set the input to be 99
  • Ensure that the Plus button is now disabled, while Minus button remains enabled

Item quantity taking large width

  • Add product item with name: min qty 1 max qty 200000, description: bar, amt: 1, multi_qty: min_qty: 1, max_qty: 200000
  • Set input to be 200000
  • Ensure that input width is not changed
  • Ensure that clicking on 'Submit` button closes the modal
    • Quantity button on PaymentCard updates to Qty: 200000 with the button width increased to accommodate the values

Mobile View
On a mobile screen (<768px)

  • Open the modal
  • Observe that the modal is now at the bottom of the screen
  • Ensure that clicking on the input brings up the number input keyboard

@KenLSM KenLSM changed the title Feat/payment quantity selector feat: payment quantity selector Aug 28, 2023
@KenLSM KenLSM temporarily deployed to staging-alt August 28, 2023 11:22 — with GitHub Actions Inactive
@KenLSM KenLSM marked this pull request as ready for review August 29, 2023 07:55
@KenLSM KenLSM temporarily deployed to staging-alt August 29, 2023 07:57 — with GitHub Actions Inactive
@KenLSM KenLSM temporarily deployed to staging-alt August 29, 2023 08:59 — with GitHub Actions Inactive
@KenLSM KenLSM requested a review from wanlingt August 29, 2023 09:30
@KenLSM KenLSM temporarily deployed to staging-alt August 29, 2023 09:38 — with GitHub Actions Inactive
Copy link
Contributor

@wanlingt wanlingt left a comment

Choose a reason for hiding this comment

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

thanks Ken! some minor changes

@KenLSM KenLSM temporarily deployed to staging-alt August 30, 2023 04:55 — with GitHub Actions Inactive
@KenLSM KenLSM temporarily deployed to staging-alt August 30, 2023 05:08 — with GitHub Actions Inactive
@KenLSM KenLSM requested a review from wanlingt August 30, 2023 05:09
Copy link
Contributor

@wanlingt wanlingt left a comment

Choose a reason for hiding this comment

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

lgtm!

@KenLSM KenLSM temporarily deployed to staging-alt August 30, 2023 08:22 — with GitHub Actions Inactive
@KenLSM KenLSM merged commit fbc17a3 into develop Aug 30, 2023
26 of 27 checks passed
@KenLSM KenLSM deleted the feat/payment-quantity-selector branch August 30, 2023 08:45
@KenLSM KenLSM mentioned this pull request Aug 31, 2023
92 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants