-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mrf): conditional routing (#7804)
* feat: add cond routing type and modal to workflow builder * feat: add step 2 modal content * feat: add step 3 modal content * feat: add attachment box under radio button and fix modal interaction * feat: allow save conditional workflow step * feat: allow download of csv edit file * feat: set up fe component * feat: store optionsToFieldsMap in dropdown * feat: add be email routing for conditional routing * feat: move conditional field to main form and update modal to 2 step * feat: add be routing for conditional routing * feat: add spacing for cond routing, fix inactive state undefined error * feat: create endpoint for updating dropdown mapping * feat: update attachment state when singleselect changes * feat: add FE validation for CSV * feat: add validation at the workflow block * feat: update positioning of error message, modal copy and update fe cache * feat: use state instead of using the same form state * feat: implement download csv * feat: add error message to inactive step block * feat: add warning text to dropdown * fix: build errors * feat: clear error on button press and update error copy * feat: conditionally show dropdown edit warning if cond routing * fix: validation of options * feat: add warning in inactive step block for mismatched options * feat: add be validation for mapping * chore: remove stray console log * chore: remove step number from modal * chore: update error message copy * feat: add tc for validation * feat: add tc for conditional fetch email * feat: add tc for updating options mapping * chore: remove unused import * chore: add beta flag for cond routing * fix: move isDisabled to radiogroup to bypass undefined re-render issue * feat: add tc for edit step block * feat: active and inactive step block chromatic stories * feat: edit dropdown stories * feat: add stories for conditional routing option modal * chore: expose subroutine errors * chore: add field validation test * chore: remove unused prop * fix: reduce usage of watch to getValues, refactor variables * chore: move conditional-routing-example.png to the same folder as usage for colocation * fix: remove renderHook from stories which is not supported * fix: import image directly instead of using path * chore: refactor respondent block into smaller components * feat: move csv template parsing for header to common function * feat: add rationale for attaching mapping to field instead of step * chore: remove multiple string duplicates by shifting into getFileName function * feat: add trimming of email * feat: add trimming of email during validation * fix: display update error if no mapping for selected cond field * fix: cannot change respondent type bug * chore: add info logs if no target emails found * fix: remove word template from modal * fix: copy changes and bugs * feat: disable modal step 2 before csv template downloaded * fix: chromatic stories to reflect new changes * fix: prettier formatting * fix: add . to error message --------- Co-authored-by: Ken <[email protected]>
- Loading branch information
1 parent
f15acda
commit 07a5197
Showing
51 changed files
with
2,804 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Stack } from '@chakra-ui/react' | ||
|
||
import { useIsMobile } from '~hooks/useIsMobile' | ||
|
||
import { Button } from './Button' | ||
|
||
interface NextAndBackButtonProps { | ||
handleBack: () => void | ||
handleNext: () => void | ||
nextButtonLabel?: string | ||
backButtonLabel?: string | ||
isNextDisabled?: boolean | ||
isBackDisabled?: boolean | ||
nextButtonColorScheme?: 'danger' | ||
} | ||
|
||
export const NextAndBackButtonGroup = ({ | ||
handleBack, | ||
handleNext, | ||
nextButtonLabel = 'Next', | ||
backButtonLabel = 'Back', | ||
isNextDisabled = false, | ||
isBackDisabled = false, | ||
nextButtonColorScheme, | ||
}: NextAndBackButtonProps): JSX.Element => { | ||
const isMobile = useIsMobile() | ||
|
||
return ( | ||
<Stack | ||
justify="flex-start" | ||
align="center" | ||
spacing="1rem" | ||
direction={{ base: 'column', md: 'row-reverse' }} | ||
w="100%" | ||
> | ||
<Button | ||
colorScheme={nextButtonColorScheme} | ||
isDisabled={isNextDisabled} | ||
onClick={handleNext} | ||
isFullWidth={isMobile} | ||
> | ||
{nextButtonLabel} | ||
</Button> | ||
<Button | ||
variant="clear" | ||
colorScheme="secondary" | ||
isDisabled={isBackDisabled} | ||
onClick={handleBack} | ||
isFullWidth={isMobile} | ||
> | ||
{backButtonLabel} | ||
</Button> | ||
</Stack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export type { ButtonProps } from './Button' | ||
export { Button as default } from './Button' | ||
export * from './NextAndBackButtonGroup' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.