Skip to content

Commit 7caa948

Browse files
committed
use a function
1 parent b28819e commit 7caa948

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Diff for: app/src/organisms/ModuleCard/FlexStackerModuleData.tsx

+12-8
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,18 @@ export function FlexStackerModuleData(
2222
const { moduleData } = props
2323
const { t, i18n } = useTranslation(['device_details', 'shared'])
2424

25-
const shuttleDisplayStatus = i18n.format(
26-
moduleData.platformState === 'extended'
27-
? t('flex_stacker_extended')
28-
: moduleData.platformState === 'retracted'
29-
? t('flex_stacker_retracted')
30-
: t('shared:unknown'),
31-
'capitalize'
32-
)
25+
const getShuttleStatusText = (): string => {
26+
switch (moduleData.platformState) {
27+
case 'extended':
28+
return t('flex_stacker_extended')
29+
case 'retracted':
30+
return t('flex_stacker_retracted')
31+
default:
32+
return t('shared:unknown')
33+
}
34+
}
35+
36+
const shuttleDisplayStatus = i18n.format(getShuttleStatusText(), 'capitalize')
3337

3438
const doorDisplayStatus = i18n.format(
3539
moduleData.hopperDoorState === 'closed'

0 commit comments

Comments
 (0)