Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Table of Contents


SANITY

 TASK 1 - Create the fee config structure
 TASK 2 - Create a method to base the fields
 TASK 3 - Create the Fee Config
  • Create the fee config fields

    • path: intl-whitelabel-cms/schemas/fees/documents/fee-config.tsx

    • path: intl-whitelabel-cms/schemas/fees/documents/fee-config-list.tsx

    • Using the method bases create;

 TASK 4 - Create the Fee Restaurant Config
  • Create the Fee Restaurant Config fields

    • path: intl-whitelabel-cms/schemas/fees/documents/fee-restaurant-config.tsx

    • path: intl-whitelabel-cms/schemas/fees/documents/fee-restaurant-config-list.tsx

    • Using the method bases create;

 TASK 5 - Disable the fields after first publish
  • After the first publish we will need to disable the fields:

    • Default Config

    • Fee Type

As the Fee Config document is used in the Fee Restaurant Config document the user can change the toggle even if the document is already published. As we don’t find a way to control this we need to ensure that the user will not be able to change the value of the toggle after the first publish.

Sanity doc:

https://dev-plk-es-whitelabel-cms.rbi.tools/desk/marketingContent;features;featureFee;feesConfig

image-20240429-175740.png

To achieve that, we can:

  1. Create a custom publish action (https://www.sanity.io/docs/document-actions)

    1. This action will be responsible for setting true on the new custom field isPublished (see below for more details) - https://www.sanity.io/docs/document-actions#362c883e4421 and https://www.sanity.io/docs/http-patches#6TPENSW3

  2. Condition this new action to be only available for the Fee Config document (without affecting the other documents)

  3. Create a new custom field in the Fee Config option to know if the document is already published or not (the name can be isPublished, for example)

    1. Add the hidden to this new field, as the user doesn’t need to see it. This field will only be used to control if the toggle is read-only or not (aka disabled)

  4. Add the readOnly property to the Default Config toggle using the new isPublished prop

  5. See: https://github.com/rbilabs/intl-whitelabel-cms/tree/poc/IBFEC-1747-fees-custom-message-3

Demonstration

Default Config toggle read only after first publish.webm

WhiteLabel

 TASK 1 - [intl-whitelabel-app] - Create a new query to get the Sanity values
  • Create a new query to get the Sanity values;

  • Run apollo generate to create the sanity graphql method;

 TASK 1 - [intl-whitelabel-app] - Create hook to get the sanity infos
  • Create a hook to get the Fee config values;

 TASK 3 - Create a method to validate the fee config values
 TASK 4 - Add the promotion description on table fee modal
  • Add the Fee discount message on the table fee modal

    • The message needs to use the method created to validate the fee values

Screenshots

N/A

Unit Test

N/A

POC

  1. intl-whitelabel-cms: https://github.com/rbilabs/intl-whitelabel-cms/tree/poc/IBFEC-1747-fees-custom-message-3

Impact Analysis

N/A

Useful Links

Figma SANITY: https://www.figma.com/file/oLr5rewpNjJ5VWgoCh27i1/branch/EBpPEvyJ0ZDTIXaBlFWONK/RBI-Sanity-Studio?type=design&node-id=5071-18400&mode=design&t=oTxdDP59yVGgUYcz-0

Figma Whitelabel APP: https://www.figma.com/file/RtD0UFtwuwXx14lbLCAPlr/branch/4JKHiBl13JOyOqh88dSPkV/Burger-King?type=design&node-id=30280-329511&mode=design&t=hQlmr9BzLDB7Dq3n-0

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.