Skip to content

Commit aab4be5

Browse files
authored
feat(app): update submerge and retract screen to align with pd (#18892)
* feat(app): update submerge and retract screen to align with pd
1 parent 71892cc commit aab4be5

File tree

9 files changed

+303
-69
lines changed

9 files changed

+303
-69
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
"reset_settings": "Reset {{transferName}} settings",
136136
"retract_after_aspirating": "Retract after aspirating",
137137
"retract_after_dispensing": "Retract after dispensing",
138-
"retract_value": "{{speed}} mm/s, {{position}} mm from bottom",
138+
"retract_value": "{{speed}} mm/s, {{delayDuration}} s, {{position}} mm from bottom",
139139
"retract": "Retract",
140140
"right_mount": "Right Mount",
141141
"run_now": "Run now",
@@ -165,11 +165,11 @@
165165
"speed": "Speed (mm/second)",
166166
"starting_well": "starting well",
167167
"storage_limit_reached": "Storage limit reached",
168-
"submerge_aspirating_description": "Lower the tip into the liquid before aspirating",
168+
"submerge_aspirate_description": "Lower the tip into the liquid before aspirating",
169169
"submerge_before_aspirating": "Submerge before aspirating",
170170
"submerge_before_dispensing": " Submerge before dispensing",
171-
"submerge_dispensing_description": "Lower the tip into the liquid before dispensing",
172-
"submerge_value": "{{speed}} mm/s, {{position}} mm",
171+
"submerge_dispense_description": "Lower the tip into the liquid before dispensing",
172+
"submerge_value": "{{speed}} mm/s, {{delayDuration}} s, {{position}} mm",
173173
"submerge": "Submerge",
174174
"tip_change_frequency": "Tip change frequency",
175175
"tip_drop_location": "Tip drop location",

app/src/organisms/ODD/QuickTransferFlow/Aspirate/hooks/useAspirateSettingsConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export function useAspirateSettingsConfig({
6060
state.submergeAspirate !== undefined
6161
? t('submerge_value', {
6262
speed: state.submergeAspirate.speed,
63+
delayDuration: state.submergeAspirate.delayDuration,
6364
position: state.submergeAspirate.positionFromBottom,
6465
})
6566
: '',
@@ -134,6 +135,7 @@ export function useAspirateSettingsConfig({
134135
state.retractAspirate !== undefined
135136
? t('retract_value', {
136137
speed: state.retractAspirate.speed,
138+
delayDuration: state.retractAspirate.delayDuration,
137139
position: state.retractAspirate.positionFromBottom,
138140
})
139141
: '',

app/src/organisms/ODD/QuickTransferFlow/Dispense/hooks/useDispenseSettingsConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export function useDispenseSettingsConfig({
8080
state.submergeDispense !== undefined
8181
? t('submerge_value', {
8282
speed: state.submergeDispense.speed,
83+
delayDuration: state.submergeDispense.delayDuration,
8384
position: state.submergeDispense.positionFromBottom,
8485
})
8586
: '',
@@ -145,6 +146,7 @@ export function useDispenseSettingsConfig({
145146
state.retractDispense !== undefined
146147
? t('retract_value', {
147148
speed: state.retractDispense.speed,
149+
delayDuration: state.retractDispense.delayDuration,
148150
position: state.retractDispense.positionFromBottom,
149151
})
150152
: '',

app/src/organisms/ODD/QuickTransferFlow/QuickTransferAdvancedSettings/Retract.tsx

Lines changed: 113 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ export function Retract({
5050
const [speed, setSpeed] = useState<number | null>(
5151
retractSettings?.speed ?? null
5252
)
53+
const [delayDuration, setDelayDuration] = useState<number | null>(
54+
retractSettings?.delayDuration ?? null
55+
)
5356
const [position, setPosition] = useState<number | null>(
5457
retractSettings?.positionFromBottom ?? null
5558
)
@@ -64,36 +67,48 @@ export function Retract({
6467
}
6568

6669
const handleClickSaveOrContinue = (): void => {
67-
if (currentStep === 1) {
68-
setCurrentStep(2)
69-
}
70-
if (currentStep === 2) {
71-
if (speed !== null && position !== null) {
72-
dispatch({
73-
type: action,
74-
retractSettings: {
75-
speed: speed,
76-
positionFromBottom: position,
77-
},
78-
})
79-
trackEventWithRobotSerial({
80-
name: ANALYTICS_QUICK_TRANSFER_SETTING_SAVED,
81-
properties: {
82-
setting: `Retract_${kind}`,
83-
},
84-
})
85-
onBack()
86-
}
70+
switch (currentStep) {
71+
case 1:
72+
setCurrentStep(2)
73+
break
74+
case 2:
75+
setCurrentStep(3)
76+
break
77+
case 3:
78+
if (speed !== null && position !== null && delayDuration !== null) {
79+
dispatch({
80+
type: action,
81+
retractSettings: {
82+
speed,
83+
delayDuration,
84+
positionFromBottom: position,
85+
},
86+
})
87+
trackEventWithRobotSerial({
88+
name: ANALYTICS_QUICK_TRANSFER_SETTING_SAVED,
89+
properties: {
90+
setting: `Retract_${kind}`,
91+
},
92+
})
93+
onBack()
94+
}
95+
break
8796
}
8897
}
98+
8999
const setSaveOrContinueButtonText =
90-
currentStep === 1 ? t('shared:continue') : t('shared:save')
100+
currentStep === 1 || currentStep === 2
101+
? t('shared:continue')
102+
: t('shared:save')
91103

92104
let buttonIsDisabled = false
93105
if (speed == null && currentStep === 1) {
94106
buttonIsDisabled = true
95107
}
96-
if (position == null && currentStep === 2) {
108+
if (delayDuration == null && currentStep === 2) {
109+
buttonIsDisabled = true
110+
}
111+
if (position == null && currentStep === 3) {
97112
buttonIsDisabled = true
98113
}
99114

@@ -123,10 +138,12 @@ export function Retract({
123138
<RetractSettingComponent
124139
kind={kind}
125140
state={state}
126-
setSpeed={setSpeed}
127-
setPosition={setPosition}
128141
speed={speed}
142+
setSpeed={setSpeed}
143+
delayDuration={delayDuration}
144+
setDelayDuration={setDelayDuration}
129145
position={position}
146+
setPosition={setPosition}
130147
currentStep={currentStep}
131148
/>
132149
</Flex>
@@ -138,8 +155,10 @@ export function Retract({
138155
interface RetractSettingComponentProps {
139156
kind: FlowRateKind
140157
state: QuickTransferSummaryState
141-
setSpeed: (speed: number) => void
142-
setPosition: (position: number) => void
158+
setSpeed: (speed: number | null) => void
159+
setPosition: (position: number | null) => void
160+
delayDuration: number | null
161+
setDelayDuration: (delayDuration: number | null) => void
143162
speed: number | null
144163
position: number | null
145164
currentStep: number
@@ -150,6 +169,8 @@ function RetractSettingComponent({
150169
state,
151170
speed,
152171
setSpeed,
172+
delayDuration,
173+
setDelayDuration,
153174
position,
154175
setPosition,
155176
currentStep,
@@ -193,6 +214,33 @@ function RetractSettingComponent({
193214
})
194215
: null
195216

217+
const handleSpeedChange = (userInput: string): void => {
218+
if (userInput === '') {
219+
setSpeed(null)
220+
} else {
221+
const parsedValue = Number(userInput)
222+
setSpeed(!isNaN(parsedValue) ? parsedValue : null)
223+
}
224+
}
225+
226+
const handleDelayDurationChange = (userInput: string): void => {
227+
if (userInput === '') {
228+
setDelayDuration(null)
229+
} else {
230+
const parsedValue = Number(userInput)
231+
setDelayDuration(!isNaN(parsedValue) ? parsedValue : null)
232+
}
233+
}
234+
235+
const handlePositionChange = (userInput: string): void => {
236+
if (userInput === '') {
237+
setPosition(null)
238+
} else {
239+
const parsedValue = Number(userInput)
240+
setPosition(!isNaN(parsedValue) ? parsedValue : null)
241+
}
242+
}
243+
196244
const speedSetting = (): JSX.Element => {
197245
return (
198246
<>
@@ -219,10 +267,43 @@ function RetractSettingComponent({
219267
<NumericalKeyboard
220268
key={`${kind}_speed_keyboard`}
221269
keyboardRef={keyboardRef}
270+
isDecimal
222271
initialValue={String(speed ?? '')}
223-
onChange={e => {
224-
setSpeed(Number(e))
225-
}}
272+
onChange={handleSpeedChange}
273+
/>
274+
</Flex>
275+
</>
276+
)
277+
}
278+
279+
const delayDurationSetting = (): JSX.Element => {
280+
return (
281+
<>
282+
<Flex
283+
width="30.5rem"
284+
height="100%"
285+
gridGap={SPACING.spacing24}
286+
flexDirection={DIRECTION_COLUMN}
287+
marginTop={SPACING.spacing68}
288+
>
289+
<InputField
290+
type="number"
291+
value={delayDuration}
292+
title={t('delay_duration_s')}
293+
readOnly
294+
/>
295+
</Flex>
296+
<Flex
297+
paddingX={SPACING.spacing24}
298+
height="21.25rem"
299+
marginTop="7.75rem"
300+
>
301+
<NumericalKeyboard
302+
key={`${kind}_delay_duration_keyboard`}
303+
keyboardRef={keyboardRef}
304+
isDecimal
305+
initialValue={String(delayDuration ?? '')}
306+
onChange={handleDelayDurationChange}
226307
/>
227308
</Flex>
228309
</>
@@ -256,15 +337,12 @@ function RetractSettingComponent({
256337
paddingX={SPACING.spacing24}
257338
height="21.25rem"
258339
marginTop="7.75rem"
259-
borderRadius="0"
260340
>
261341
<NumericalKeyboard
262342
key={`${kind}_position_keyboard`}
263343
keyboardRef={keyboardRef}
264344
initialValue={String(position ?? '')}
265-
onChange={e => {
266-
setPosition(Number(e))
267-
}}
345+
onChange={handlePositionChange}
268346
/>
269347
</Flex>
270348
</>
@@ -275,6 +353,8 @@ function RetractSettingComponent({
275353
case 1:
276354
return speedSetting()
277355
case 2:
356+
return delayDurationSetting()
357+
case 3:
278358
return positionSetting()
279359
default:
280360
console.error('step not found')

0 commit comments

Comments
 (0)