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

Discount list with promotion api #4530

Merged
merged 137 commits into from
Dec 18, 2023
Merged

Discount list with promotion api #4530

merged 137 commits into from
Dec 18, 2023

Conversation

poulch
Copy link
Member

@poulch poulch commented Dec 13, 2023

closes #4527

To switch on/off feature flag, run this code in browser console

localStorage.setItem('FF_discounts_rules', '{"enabled":true,"payload":"default"}')

Screenshots

Pull Request Checklist

  1. This code contains UI changes
  2. All visible strings are translated with proper context including data-formatting
  3. Attributes data-test-id are added for new elements
  4. The changes are tested in Chrome/Firefox/Safari browsers and in light/dark mode
  5. Your code works with the latest stable version of the core
  6. I added changesets file (instructions in contribution guide

Test environment config

API_URI=https://automation-dashboard.staging.saleor.cloud/graphql/
APPS_MARKETPLACE_API_URI=https://apps.staging.saleor.io/api/v2/saleor-apps

Do you want to run more stable tests?

To run all tests, just select the stable checkbox. To speed up tests, increase the number of containers. Tests will be re-run only when the "run e2e" label is added.

  1. stable
  2. app
  3. attribute
  4. category
  5. collection
  6. customer
  7. giftCard
  8. homePage
  9. login
  10. menuNavigation
  11. navigation
  12. orders
  13. pages
  14. payments
  15. permissions
  16. plugins
  17. productType
  18. products
  19. sales
  20. shipping
  21. translations
  22. variants
  23. vouchers

CONTAINERS=2

@github-actions github-actions bot temporarily deployed to pr-4527-promotions-list-page December 18, 2023 09:05 Destroyed
@github-actions github-actions bot temporarily deployed to storybook pr-4527-promotions-list-page December 18, 2023 09:05 Destroyed
andrzejewsky
andrzejewsky previously approved these changes Dec 18, 2023
Base automatically changed from 4232-discount-catalog-api to main December 18, 2023 12:51
@poulch poulch dismissed andrzejewsky’s stale review December 18, 2023 12:51

The base branch was changed.

@github-actions github-actions bot temporarily deployed to pr-4527-promotions-list-page December 18, 2023 13:05 Destroyed
@github-actions github-actions bot temporarily deployed to storybook pr-4527-promotions-list-page December 18, 2023 13:05 Destroyed
@github-actions github-actions bot temporarily deployed to storybook pr-4527-promotions-list-page December 18, 2023 13:16 Destroyed
@github-actions github-actions bot temporarily deployed to pr-4527-promotions-list-page December 18, 2023 13:16 Destroyed
@github-actions github-actions bot temporarily deployed to storybook pr-4527-promotions-list-page December 18, 2023 13:19 Destroyed
@github-actions github-actions bot temporarily deployed to pr-4527-promotions-list-page December 18, 2023 13:19 Destroyed
@poulch poulch requested a review from andrzejewsky December 18, 2023 13:20

<Text>
<FormattedMessage
defaultMessage="Are you sure you want to delete this discount"
Copy link
Member

Choose a reason for hiding this comment

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

nitpick

Suggested change
defaultMessage="Are you sure you want to delete this discount"
defaultMessage="Are you sure you want to delete this discount?"

Comment on lines 61 to 72
case "startDate":
return readonlyTextCell(
rowData.startDate
? moment(rowData.startDate).locale(locale).format("lll")
: PLACEHOLDER,
);
case "endDate":
return readonlyTextCell(
rowData.endDate
? moment(rowData.endDate).locale(locale).format("lll")
: PLACEHOLDER,
);
Copy link
Member

Choose a reason for hiding this comment

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

issue: We should only use new date cells for consistency. See
src/components/Datagrid/customCells/DateCell.tsx and #4220

@poulch poulch merged commit 17b72a5 into main Dec 18, 2023
16 checks passed
@poulch poulch deleted the 4527-promotions-list-page branch December 18, 2023 13:55
poulch added a commit that referenced this pull request Dec 19, 2023
* Generate flag

* Init new discounts create and details view

* Update params types

* Discount page components

* Add discount rules and metadata

* Add react-hook-form

* Update types

* Handle form using RHF

* Selecting channel and showing currency code

* Connect rules conditon to rhf

* Rename Inputs to CreateDiscoutFormData

* DiscountDetailsPage and handle submit and edit rule

* Bump macaw ui

* Improve structure and typing

* Add changeset

* Add stories

* Extract messages

* Fix CR comments

* createPromotin mutation and types

* Create promotion and display details

* Fix loading description text

* Fetch condition row

* Handle fetch more and fix fetch with query

* Send coditions during create

* Handle display condition in details

* Refactor create promotion handler

* Fix some types

* Introduct RuleDTO

* Add variant search

* Category type fix

* Fetch condition options labels names

* Add fetch condition option in discount detail

* Handle promotion details update

* Handle submit rules update/create using single button submit

* Fix some ts strict null

* Move condition fetch options to component

* Extract messages

* Add changeset

* Improve condition option fetch

* Fix input bg color on rule and showing when selected channels

* Handle disable state, fix description in rule

* Set percantage reward type when no currency

* Show rule name when rule not collapsed

* Bump macaw ui

* Fix discount switch to use value

* Error handling

* Introduce RuleSummary

* Improve fetch conditions options details

* Remove rules, show rules list summaries

* RuleModal, show rule on create page in modal

* Handle edit/add rule inside modal on details promotion page

* Two column rules grid

* Handle delete rule

* Show text when no channels selected

* Client side rule form validation

* Adjust size of reward

* Introduce rule edit button

* Fix showing ids instead of labels

* Always show reward, handle loading during rule deletion

* Fix ruleRewardValue number, move option fetch higher, fix fetch labels for selected options

* Single channel, fetch option labels when promotion change

* Fetch condition option only when channel

* Improve validation schema

* Name and channel in one row

* Fix rule index conditions, fix hasEndDate checkbox change handling

* Fix clearing conditions on channel change

* Improve rule summary conditions values disply

* Temp fix rule modal overflow

* Fix clear values when change condition type

* Fix tests

* Fix ts errors

* Update tests

* Fix theme colors vars

* Bump macaw version

* DiscountRules tests

* Improve rule summary colors and add button

* Test RuleModal

* Improve summary chips colors

* Fix scroll issue

* Fix multiple conditions

* Restore usePreviousValue

* Improve types

* List promotions init

* Remove row selection

* Handle delete discount

* Add changeset

* Fix props and ts issues

* Update changeset to patch

* Cleanup discount list

* Implement query search

* Implement filter presets

* Fix types

* Update stories

* Remove not used fukes

* Remove mui import

* Use sparate urls for discounts

* Refactor dto into view models

* Fix tests with empty rule during rule creation

* Form refactor

* Test DiscountRules, update props

* Update index type from string to number

* Validation schema for discount form

* Fix description in init form values

* Update mocks and fixures

* Add mocks to storybook

* Update test

* Update description type

* Add fromFormValues methods to Rule and Conditon

* Fix rule delete and update handlers

* Prevent details from to be submited when not dirty

* Improbe disabled input when loading, fix handlers error types

* remove not used hooks

* Remove not used utils

* Update copy

* Use date cell
@poulch poulch restored the 4527-promotions-list-page branch July 1, 2024 11:27
@poulch poulch deleted the 4527-promotions-list-page branch July 1, 2024 11:32
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.

[Feature]: Implement list of promotions
3 participants