-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The current FormStatusBadge has a status property which dictates the content and styling of the badge. We need to add some logic that sets the correct status based on the form configuration. For this status calculation we need the form fields: active, activateOn, deactivateOn, maintenanceMode.
Depending on when the form status badge should be update, the status should be dictated using the Formik state or the form details present in the route loader. If we want instant status updated (without having to 'save' the form), we should use the Formik state, otherwise we can use the route loader data. (Decision should be made by designer)
Discussed with Lidwien: the form status should reflect the current form configuration; changing one of the previously mentioned fields immediately impacts the form status (without having to save the form in between). So we should use the Formik state to determine the form status.
The form status is determined using this logic:
| Form field values | Form status |
|---|---|
maintenanceMode is true |
maintenance |
active is true and deactivateOn is empty |
active |
active is true and deactivateOn is a date in the future |
active |
active is true and deactivateOn is a date in the past |
inactive |
active is false and activateOn is empty |
inactive |
active is false and activateOn is a date in the future |
scheduled |
active is false and activateOn is a date in the past |
active |
active is false and activateOn is a date in the past and deactivateOn is in the future |
active |
active is false and activateOn is a date in the past and deactivateOn is in the past |
inactive |
We have a couple options:
- We add the logic to the
FormStatusBadgecomponent itself. The component accesses the Formik state or (if possible) the route loader data, and calculates the status. - We add a util function
getFormStatewhich takes the form configuration data as parameters. This might be easier if we need to use the route loader data.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status