diff --git a/packages/web/src/components/FlowStep/index.tsx b/packages/web/src/components/FlowStep/index.tsx index 3b77e2eb..5883d8d6 100644 --- a/packages/web/src/components/FlowStep/index.tsx +++ b/packages/web/src/components/FlowStep/index.tsx @@ -11,6 +11,8 @@ import ListItemButton from '@mui/material/ListItemButton'; import TextField from '@mui/material/TextField'; import Autocomplete from '@mui/material/Autocomplete'; import MoreHorizIcon from '@mui/icons-material/MoreHoriz'; +import ExpandLessIcon from '@mui/icons-material/ExpandLess'; +import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import IconButton from '@mui/material/IconButton'; import ChooseAccountSubstep from 'components/ChooseAccountSubstep'; @@ -82,6 +84,8 @@ export default function FlowStep(props: FlowStepProps): React.ReactElement | nul const actionOptions = React.useMemo(() => actionsOrTriggers?.map((trigger) => optionGenerator(trigger)) ?? [], [app?.key]); const substeps = React.useMemo(() => actionsOrTriggers?.find(({ key }) => key === step.key)?.subSteps, [actionsOrTriggers, step?.key]); + const expandNextStep = React.useCallback(() => { setCurrentSubstep((currentSubstep) => (currentSubstep ?? 0) + 1); }, []); + const onAppChange = React.useCallback((event: React.SyntheticEvent, selectedOption: unknown) => { if (typeof selectedOption === 'object') { const typedSelectedOption = selectedOption as { value: string; }; @@ -101,6 +105,8 @@ export default function FlowStep(props: FlowStepProps): React.ReactElement | nul key: eventKey, parameters: {}, })); + + expandNextStep(); } }, []); @@ -111,6 +117,8 @@ export default function FlowStep(props: FlowStepProps): React.ReactElement | nul id: connectionId, }, })); + + expandNextStep(); }, []); const onParameterChange = React.useCallback((event: React.SyntheticEvent) => { @@ -173,15 +181,17 @@ export default function FlowStep(props: FlowStepProps): React.ReactElement | nul toggleSubstep(0)} selected={currentSubstep === 0} divider> - + + {currentSubstep === 0 ? : } Choose app & event - + } value={getOption(appOptions, step.appKey)} @@ -197,6 +207,7 @@ export default function FlowStep(props: FlowStepProps): React.ReactElement | nul } value={getOption(actionOptions, step.key)} @@ -211,12 +222,13 @@ export default function FlowStep(props: FlowStepProps): React.ReactElement | nul {substeps?.length > 0 && substeps.map((substep: { name: string, arguments: AppFields[] }, index: number) => ( toggleSubstep(index + 1)} selected={currentSubstep === (index + 1)} divider> - + + {currentSubstep === (index + 1) ? : } {substep.name as string} - + {substep.name === 'Choose account' && ( -