Skip to content

Commit

Permalink
fix(protocol-designer,-step-generation): update prewet behavior in PD
Browse files Browse the repository at this point in the history
This PR adds prewet to distribute, and updates the logic for when to use prewet for all compound liquid handling command creators. The prewet volume should always be set to the volume of the aspiration that is about to be called (including disposal volume for `distribute`). Prewet commands should be emmitted anytime a new tip is used for an aspiration. Also, I update the UI for the prewet form field in MoveLiquidTools

Closes AUTH-908
  • Loading branch information
ncdiehl11 committed Feb 5, 2025
1 parent 643cf15 commit 09c3c3b
Show file tree
Hide file tree
Showing 9 changed files with 277 additions and 25 deletions.
2 changes: 1 addition & 1 deletion protocol-designer/src/assets/localization/en/tooltip.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"newLocation": "New location to move the selected labware",
"nozzles": "Partial pickup requires a tip rack directly on the deck. Full rack pickup requires the Flex 96 Tip Rack Adapter.",
"pipette": "Select the pipette you want to use",
"preWetTip": "Pre-wet by aspirating and dispensing 2/3 of the tip’s max volume",
"preWetTip": "Pre-wet by aspirating and dispensing the total aspiration volume",
"setTemperature": "Select the temperature to set your module to",
"wells": "Select wells",
"volume": "Volume to dispense in each well"
Expand Down
36 changes: 21 additions & 15 deletions protocol-designer/src/molecules/ToggleStepFormField/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
ALIGN_CENTER,
Check,
COLORS,
DIRECTION_COLUMN,
Flex,
Expand All @@ -16,12 +17,13 @@ import { ToggleButton } from '../../atoms/ToggleButton'
interface ToggleStepFormFieldProps {
title: string
isSelected: boolean
onLabel: string
offLabel: string
toggleUpdateValue: (value: unknown) => void
toggleValue: unknown
tooltipContent: string | null
isDisabled: boolean
isDisabled?: boolean
onLabel?: string
offLabel?: string
toggleElement?: 'toggle' | 'checkbox'
}
export function ToggleStepFormField(
props: ToggleStepFormFieldProps
Expand All @@ -34,34 +36,32 @@ export function ToggleStepFormField(
toggleUpdateValue,
toggleValue,
tooltipContent,
isDisabled,
isDisabled = false,
toggleElement = 'toggle',

Check warning on line 40 in protocol-designer/src/molecules/ToggleStepFormField/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/molecules/ToggleStepFormField/index.tsx#L39-L40

Added lines #L39 - L40 were not covered by tests
} = props
const [targetProps, tooltipProps] = useHoverTooltip()

return (
<>
<ListButton
type="noActive"
padding={SPACING.spacing12}
padding={SPACING.spacing16}

Check warning on line 48 in protocol-designer/src/molecules/ToggleStepFormField/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/molecules/ToggleStepFormField/index.tsx#L48

Added line #L48 was not covered by tests
onClick={() => {
if (!isDisabled) {
toggleUpdateValue(!toggleValue)
}
}}
disabled={isDisabled}
>
{tooltipContent != null ? (
<Tooltip tooltipProps={tooltipProps}>{tooltipContent}</Tooltip>
) : null}

<Flex width="100%" flexDirection={DIRECTION_COLUMN} {...targetProps}>
<Flex width="100%" flexDirection={DIRECTION_COLUMN}>

Check warning on line 56 in protocol-designer/src/molecules/ToggleStepFormField/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/molecules/ToggleStepFormField/index.tsx#L56

Added line #L56 was not covered by tests
<Flex
justifyContent={JUSTIFY_SPACE_BETWEEN}
alignItems={ALIGN_CENTER}
>
<StyledText
desktopStyle="bodyDefaultRegular"
color={isDisabled ? COLORS.grey40 : COLORS.black90}
{...targetProps}

Check warning on line 64 in protocol-designer/src/molecules/ToggleStepFormField/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/molecules/ToggleStepFormField/index.tsx#L64

Added line #L64 was not covered by tests
>
{title}
</StyledText>
Expand All @@ -72,15 +72,21 @@ export function ToggleStepFormField(
>
{isSelected ? onLabel : offLabel}
</StyledText>
<ToggleButton
disabled={isDisabled}
label={isSelected ? onLabel : offLabel}
toggledOn={isSelected}
/>
{toggleElement === 'toggle' ? (
<ToggleButton
label={isSelected ? onLabel : offLabel}
toggledOn={isSelected}

Check warning on line 78 in protocol-designer/src/molecules/ToggleStepFormField/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/molecules/ToggleStepFormField/index.tsx#L75-L78

Added lines #L75 - L78 were not covered by tests
/>
) : (
<Check color={COLORS.blue50} isChecked={isSelected} />

Check warning on line 81 in protocol-designer/src/molecules/ToggleStepFormField/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/molecules/ToggleStepFormField/index.tsx#L81

Added line #L81 was not covered by tests
)}
</Flex>
</Flex>
</Flex>
</ListButton>
{tooltipContent != null ? (
<Tooltip tooltipProps={tooltipProps}>{tooltipContent}</Tooltip>
) : null}

Check warning on line 89 in protocol-designer/src/molecules/ToggleStepFormField/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/molecules/ToggleStepFormField/index.tsx#L87-L89

Added lines #L87 - L89 were not covered by tests
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function LabwareField(props: FieldProps): JSX.Element {
onExit={() => {
dispatch(hoverSelection({ id: null, text: null }))
}}
width="100%"

Check warning on line 34 in protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/PipetteFields/LabwareField.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/PipetteFields/LabwareField.tsx#L34

Added line #L34 was not covered by tests
/>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export function StepFormToolbox(props: StepFormToolboxProps): JSX.Element {
</StyledText>
</Flex>
}
width="21.875rem"

Check warning on line 363 in protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepFormToolbox.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepFormToolbox.tsx#L363

Added line #L363 was not covered by tests
>
<div
ref={toolsComponentRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import {
CheckboxExpandStepFormField,
InputStepFormField,
ToggleStepFormField,
} from '../../../../../../molecules'
import {
BlowoutLocationField,
Expand Down Expand Up @@ -398,15 +399,16 @@ export function MoveLiquidTools(props: StepFormProps): JSX.Element {
{t('protocol_steps:advanced_settings')}
</StyledText>
{tab === 'aspirate' ? (
<CheckboxExpandStepFormField
<ToggleStepFormField

Check warning on line 402 in protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/MoveLiquidTools/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/MoveLiquidTools/index.tsx#L402

Added line #L402 was not covered by tests
title={i18n.format(
t('form:step_edit_form.field.preWetTip.label'),
'capitalize'
)}
checkboxValue={propsForFields.preWetTip.value}
isChecked={propsForFields.preWetTip.value === true}
checkboxUpdateValue={propsForFields.preWetTip.updateValue}
tooltipText={propsForFields.preWetTip.tooltipContent}
toggleValue={propsForFields.preWetTip.value}
isSelected={propsForFields.preWetTip.value === true}
toggleUpdateValue={propsForFields.preWetTip.updateValue}
toggleElement="checkbox"
tooltipContent={propsForFields.preWetTip.tooltipContent ?? null}

Check warning on line 411 in protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/MoveLiquidTools/index.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/MoveLiquidTools/index.tsx#L407-L411

Added lines #L407 - L411 were not covered by tests
/>
) : null}
<CheckboxExpandStepFormField
Expand Down
Loading

0 comments on commit 09c3c3b

Please sign in to comment.