Skip to content

Commit b88a27c

Browse files
committed
refactor(app): add a note if there's more modules
This way you won't be confused if you only see your stackers
1 parent 3d30732 commit b88a27c

File tree

3 files changed

+21
-29
lines changed

3 files changed

+21
-29
lines changed

app/src/assets/localization/en/module_wizard_flows.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"close_doors_description": "The robot needs to safely move to its home location before you can set the labware shuttle onto the track.",
1616
"close_stacker_doors": "Close robot door and all stacker doors",
1717
"complete_calibration": "Complete calibration",
18+
"connect_a_pipette_to_set_up_more_modules": "Connect a pipette to set up more modules.",
1819
"confirm_location": "Confirm location",
1920
"confirm_placement": "Confirm placement",
2021
"door_circuit_error": "Robot is open",

app/src/organisms/ModuleWizardFlows/SelectModule.tsx

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ import {
1212
RESPONSIVENESS,
1313
SPACING,
1414
} from '@opentrons/components'
15-
import {
16-
ABSORBANCE_READER_TYPE,
17-
FLEX_STACKER_MODULE_TYPE,
18-
getModuleDisplayName,
19-
} from '@opentrons/shared-data'
15+
import { getModuleDisplayName } from '@opentrons/shared-data'
2016

21-
import { useGetModulesNeedingSetupThatCanCurrentlyBeSetUp } from '/app/App/hooks'
17+
import {
18+
useGetModulesNeedingSetup,
19+
useGetModulesNeedingSetupThatCanCurrentlyBeSetUp,
20+
} from '/app/App/hooks'
2221
import { SmallButton } from '/app/atoms/buttons'
2322
import { i18n } from '/app/i18n'
2423
import { useModuleUSBPort } from '/app/local-resources/modules'
@@ -31,8 +30,6 @@ import {
3130
import { useSendIdentifyStacker } from './hooks'
3231

3332
import type { AttachedModule } from '@opentrons/api-client'
34-
import type { ModuleType } from '@opentrons/shared-data'
35-
import type { PipetteInformation } from '/app/redux/pipettes'
3633

3734
interface SelectModuleProps {
3835
buildFlowForSelectedModule: (module: AttachedModule) => void
@@ -41,7 +38,6 @@ interface SelectModuleProps {
4138
setSelectedModule: (module: AttachedModule | null) => void
4239
setShowLaunchSetup: (show: boolean) => void
4340
attachedModuleOnLaunch?: AttachedModule | null
44-
attachedPipette?: PipetteInformation | null
4541
}
4642

4743
interface ModuleNameAndPort {
@@ -57,27 +53,18 @@ export function SelectModule(props: SelectModuleProps): JSX.Element | null {
5753
setSelectedModule,
5854
setShowLaunchSetup,
5955
attachedModuleOnLaunch = null,
60-
attachedPipette,
6156
} = props
6257
const { t } = useTranslation('module_wizard_flows')
6358

6459
const { parseModuleUSBPort } = useModuleUSBPort()
65-
const availableModules = useGetModulesNeedingSetupThatCanCurrentlyBeSetUp()
66-
const allSettupable = useGetModulesNeedingSetup()
67-
const allNewModules =
68-
attachedModuleOnLaunch !== null
69-
? [attachedModuleOnLaunch]
70-
: availableModules
71-
const modulesNotRequiringPipette = availableModules.filter(thisModule =>
72-
([
73-
ABSORBANCE_READER_TYPE,
74-
FLEX_STACKER_MODULE_TYPE,
75-
] as ModuleType[]).includes(thisModule.moduleType)
76-
)
60+
const allSetupable = useGetModulesNeedingSetupThatCanCurrentlyBeSetUp()
61+
const allNeedingSetup = useGetModulesNeedingSetup()
7762
const newModules =
78-
attachedPipette == null ? modulesNotRequiringPipette : allNewModules
79-
80-
const isSingleModule = newModules.length === 1
63+
attachedModuleOnLaunch == null ? allSetupable : [attachedModuleOnLaunch]
64+
// allNeedingSetup is a superset of allSetupable
65+
const hasUnsetupabbleModules = allNeedingSetup.length > allSetupable.length
66+
const isSingleModule = newModules.length === 1 && !hasUnsetupabbleModules
67+
const shortCircuitFlow = attachedModuleOnLaunch != null || isSingleModule
8168
const sendIdentifyStacker = useSendIdentifyStacker()
8269

8370
const getModuleNameAndPort = (module: AttachedModule): ModuleNameAndPort => {
@@ -88,11 +75,11 @@ export function SelectModule(props: SelectModuleProps): JSX.Element | null {
8875

8976
// Handler for when there is one module
9077
useEffect(() => {
91-
if (isSingleModule) {
78+
if (shortCircuitFlow) {
9279
setSelectedModule(newModules[0])
9380
sendIdentifyStacker(newModules[0], true)
9481
}
95-
}, [isSingleModule])
82+
}, [shortCircuitFlow])
9683

9784
// Handler for when there are multiple modules.
9885
const handleModuleSelected = (serialNumber: string): void => {
@@ -133,7 +120,7 @@ export function SelectModule(props: SelectModuleProps): JSX.Element | null {
133120
`
134121
if (newModules.length === 0) {
135122
return null
136-
} else if (isSingleModule && selectedModule != null) {
123+
} else if (shortCircuitFlow && selectedModule != null) {
137124
const m = getModuleNameAndPort(selectedModule)
138125
return (
139126
<SimpleWizardBody
@@ -183,6 +170,11 @@ export function SelectModule(props: SelectModuleProps): JSX.Element | null {
183170
onSelect={event => {
184171
handleModuleSelected(event.target.value)
185172
}}
173+
subText={
174+
hasUnsetupabbleModules
175+
? t('connect_a_pipette_to_set_up_more_modules')
176+
: null
177+
}
186178
/>
187179
</Flex>
188180
<Flex css={BUTTON_STYLE}>

app/src/organisms/ModuleWizardFlows/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ export function ModuleWizardFlows(
111111
setSelectedModule={setSelectedModule}
112112
setShowLaunchSetup={setShowLaunchSetup}
113113
attachedModuleOnLaunch={attachedModuleOnLaunch}
114-
attachedPipette={wizardFlowBaseProps.attachedPipette}
115114
/>
116115
</ModuleWizardScreen>
117116
)

0 commit comments

Comments
 (0)