Skip to content

Commit 52f8cd7

Browse files
committed
fix(components,-protocol-designer): preselect useGripper in moveLabware form if attached
Update createPresavedStepForm with new patch to pre-select useGripper to true for a moveLabware step form if a gripper is included in additional equipment entities. Fix minor style bugs in Checkbox component. Closes AUTH-1371
1 parent c6f0f79 commit 52f8cd7

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

components/src/atoms/Checkbox/index.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Icon } from '../../icons'
55
import {
66
ALIGN_CENTER,
77
CURSOR_AUTO,
8+
CURSOR_DEFAULT,
89
CURSOR_POINTER,
910
DIRECTION_ROW,
1011
FLEX_MAX_CONTENT,
@@ -66,8 +67,12 @@ export function Checkbox(props: CheckboxProps): JSX.Element {
6667
outline-offset: 2px;
6768
}
6869
&:disabled {
69-
background-color: ${COLORS.grey35};
70-
color: ${COLORS.grey50};
70+
background-color: ${COLORS.grey30};
71+
color: ${COLORS.grey40};
72+
cursor: ${CURSOR_DEFAULT};
73+
}
74+
&:disabled:hover {
75+
background-color: ${COLORS.grey30}; /* Prevent hover from overriding */
7176
}
7277
&:hover {
7378
background-color: ${isChecked ? COLORS.blue55 : COLORS.blue35};
@@ -93,7 +98,7 @@ export function Checkbox(props: CheckboxProps): JSX.Element {
9398
<StyledText desktopStyle="bodyDefaultRegular" oddStyle="bodyTextSemiBold">
9499
{labelText}
95100
</StyledText>
96-
<Check isChecked={isChecked} />
101+
<Check isChecked={isChecked} disabled={disabled} />
97102
</Flex>
98103
)
99104
}

protocol-designer/src/step-forms/test/createPresavedStepForm.test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,14 @@ describe('createPresavedStepForm', () => {
398398
})
399399
})
400400
})
401+
it('should default movdLabware form useGripper value to `true` if gripper is added', () => {
402+
const args = {
403+
...defaultArgs,
404+
additionalEquipmentEntities: {
405+
gripperId: { name: 'gripper', id: 'gripperId' },
406+
},
407+
stepType: 'moveLabware',
408+
}
409+
expect(createPresavedStepForm(args)).toHaveProperty('useGripper', true)
410+
})
401411
})

protocol-designer/src/step-forms/utils/createPresavedStepForm.ts

+21
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,21 @@ const _patchThermocyclerFields = (args: {
378378
}
379379
}
380380

381+
const _patchMoveLabwareFields = (args: {
382+
additionalEquipmentEntities: AdditionalEquipmentEntities
383+
stepType: StepType
384+
}): FormUpdater => () => {
385+
const { additionalEquipmentEntities, stepType } = args
386+
const isMoveLabware = stepType === 'moveLabware'
387+
const hasGripper = Object.values(additionalEquipmentEntities).some(
388+
({ name }) => name === 'gripper'
389+
)
390+
if (isMoveLabware && hasGripper) {
391+
return { useGripper: true }
392+
}
393+
return null
394+
}
395+
381396
export const createPresavedStepForm = ({
382397
initialDeckSetup,
383398
labwareEntities,
@@ -449,6 +464,11 @@ export const createPresavedStepForm = ({
449464
robotStateTimeline,
450465
})
451466

467+
const updateMoveLabwareFields = _patchMoveLabwareFields({
468+
additionalEquipmentEntities,
469+
stepType,
470+
})
471+
452472
// finally, compose and apply all the updaters in order,
453473
// passing the applied result from one updater as the input of the next
454474
return [
@@ -460,6 +480,7 @@ export const createPresavedStepForm = ({
460480
updateMagneticModuleId,
461481
updateAbsorbanceReaderModuleId,
462482
updateDefaultLabwareLocations,
483+
updateMoveLabwareFields,
463484
].reduce<FormData>(
464485
(acc, updater: FormUpdater) => {
465486
const updates = updater(acc)

0 commit comments

Comments
 (0)