Skip to content

Commit bb5d91d

Browse files
committed
fix(app): handle no step after current step edge case
1 parent b314dd6 commit bb5d91d

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

app/src/molecules/InterventionModal/CategorizedStepContent.tsx

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -111,35 +111,42 @@ export function CategorizedStepContent(
111111
justifyContent={JUSTIFY_FLEX_START}
112112
gap={SPACING.spacing4}
113113
>
114-
<StyledText oddStyle="bodyTextSemiBold" desktopStyle="captionSemiBold">
115-
{props.bottomCategoryHeadline}
116-
</StyledText>
117-
{props.bottomCategoryCommands.map((command, idx) => (
118-
<Flex
119-
gap={SPACING.spacing8}
120-
key={`${props.bottomCategory}${
121-
command?.command?.commandType ?? 'unknown'
122-
}${idx}`}
123-
css={idx > 0 ? HIDE_ON_TOUCHSCREEN_STYLE : undefined}
114+
{props.bottomCategoryCommands[0] != null ? (
115+
<StyledText
116+
oddStyle="bodyTextSemiBold"
117+
desktopStyle="captionSemiBold"
124118
>
125-
<CommandIndex
126-
index={`${
127-
command?.index == null ? '' : command.index.toString()
128-
}`}
129-
allowSpaceForNDigits={maxIndexLength}
130-
/>
131-
<Command
132-
{...commandAndState(
133-
command,
134-
props.bottomCategory,
135-
props.commandTextData
136-
)}
137-
robotType={props.robotType}
138-
aligned="left"
139-
forceTwoLineClip
140-
/>
141-
</Flex>
142-
))}
119+
{props.bottomCategoryHeadline}
120+
</StyledText>
121+
) : null}
122+
{props.bottomCategoryCommands.map((command, idx) => {
123+
return command != null ? (
124+
<Flex
125+
gap={SPACING.spacing8}
126+
key={`${props.bottomCategory}${
127+
command?.command?.commandType ?? 'unknown'
128+
}${idx}`}
129+
css={idx > 0 ? HIDE_ON_TOUCHSCREEN_STYLE : undefined}
130+
>
131+
<CommandIndex
132+
index={`${
133+
command?.index == null ? '' : command.index.toString()
134+
}`}
135+
allowSpaceForNDigits={maxIndexLength}
136+
/>
137+
<Command
138+
{...commandAndState(
139+
command,
140+
props.bottomCategory,
141+
props.commandTextData
142+
)}
143+
robotType={props.robotType}
144+
aligned="left"
145+
forceTwoLineClip
146+
/>
147+
</Flex>
148+
) : null
149+
})}
143150
</Flex>
144151
</Flex>
145152
)

0 commit comments

Comments
 (0)