-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol-designer): transfer tools advanced settings
closes AUTH-870
- Loading branch information
Showing
14 changed files
with
1,198 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...designer/src/pages/Designer/ProtocolSteps/StepForm/PipetteFields/BlowoutLocationField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useSelector } from 'react-redux' | ||
import { useTranslation } from 'react-i18next' | ||
import { selectors as uiLabwareSelectors } from '../../../../../ui/labware' | ||
import { DropdownStepFormField } from '../../../../../molecules' | ||
import type { Options } from '@opentrons/components' | ||
import type { FieldProps } from '../types' | ||
|
||
type BlowoutLocationDropdownProps = FieldProps & { | ||
options: Options | ||
} | ||
|
||
export const BlowoutLocationField = ( | ||
props: BlowoutLocationDropdownProps | ||
): JSX.Element => { | ||
const { options: propOptions, ...restProps } = props | ||
const { t } = useTranslation('protocol_steps') | ||
const disposalOptions = useSelector(uiLabwareSelectors.getDisposalOptions) | ||
const options = [...disposalOptions, ...propOptions] | ||
|
||
return ( | ||
<DropdownStepFormField | ||
title={t('blowout_location')} | ||
options={options} | ||
addPadding={false} | ||
{...restProps} | ||
width="16.5rem" | ||
/> | ||
) | ||
} |
91 changes: 91 additions & 0 deletions
91
...-designer/src/pages/Designer/ProtocolSteps/StepForm/PipetteFields/BlowoutZOffsetField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { useState } from 'react' | ||
import { useSelector } from 'react-redux' | ||
import { useTranslation } from 'react-i18next' | ||
import { | ||
DEST_WELL_BLOWOUT_DESTINATION, | ||
SOURCE_WELL_BLOWOUT_DESTINATION, | ||
} from '@opentrons/step-generation' | ||
import { getWellDepth } from '@opentrons/shared-data' | ||
import { | ||
Flex, | ||
InputField, | ||
Tooltip, | ||
useHoverTooltip, | ||
} from '@opentrons/components' | ||
import { ZTipPositionModal } from '../../../../../components/StepEditForm/fields/TipPositionField/ZTipPositionModal' | ||
import { getLabwareEntities } from '../../../../../step-forms/selectors' | ||
import type { FieldProps } from '../types' | ||
|
||
interface BlowoutZOffsetFieldProps extends FieldProps { | ||
destLabwareId: unknown | ||
sourceLabwareId?: unknown | ||
blowoutLabwareId?: unknown | ||
} | ||
|
||
export function BlowoutZOffsetField( | ||
props: BlowoutZOffsetFieldProps | ||
): JSX.Element { | ||
const { | ||
disabled, | ||
value, | ||
destLabwareId, | ||
sourceLabwareId, | ||
blowoutLabwareId, | ||
tooltipContent, | ||
name, | ||
isIndeterminate, | ||
updateValue, | ||
} = props | ||
const { t } = useTranslation(['application', 'protocol_steps']) | ||
const [isModalOpen, setModalOpen] = useState<boolean>(false) | ||
const [targetProps, tooltipProps] = useHoverTooltip() | ||
const labwareEntities = useSelector(getLabwareEntities) | ||
|
||
let labwareId = null | ||
if (blowoutLabwareId === SOURCE_WELL_BLOWOUT_DESTINATION) { | ||
labwareId = sourceLabwareId | ||
} else if (blowoutLabwareId === DEST_WELL_BLOWOUT_DESTINATION) { | ||
labwareId = destLabwareId | ||
} | ||
|
||
const labwareWellDepth = | ||
labwareId != null && labwareEntities[String(labwareId)]?.def != null | ||
? getWellDepth(labwareEntities[String(labwareId)].def, 'A1') | ||
: 0 | ||
|
||
return ( | ||
<> | ||
<Tooltip tooltipProps={tooltipProps}>{tooltipContent}</Tooltip> | ||
{isModalOpen ? ( | ||
<ZTipPositionModal | ||
closeModal={() => { | ||
setModalOpen(false) | ||
}} | ||
name={name} | ||
zValue={Number(value)} | ||
updateValue={updateValue} | ||
wellDepthMm={labwareWellDepth} | ||
/> | ||
) : null} | ||
|
||
<Flex {...targetProps}> | ||
<InputField | ||
title={t('protocol_steps:blowout_position')} | ||
disabled={disabled} | ||
readOnly | ||
onClick={ | ||
disabled | ||
? undefined | ||
: () => { | ||
setModalOpen(true) | ||
} | ||
} | ||
value={String(value)} | ||
isIndeterminate={isIndeterminate} | ||
units={t('units.millimeter')} | ||
id={`TipPositionField_${name}`} | ||
/> | ||
</Flex> | ||
</> | ||
) | ||
} |
117 changes: 117 additions & 0 deletions
117
...-designer/src/pages/Designer/ProtocolSteps/StepForm/PipetteFields/DisposalVolumeField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { useTranslation } from 'react-i18next' | ||
import { useSelector } from 'react-redux' | ||
import { Flex, DIRECTION_COLUMN, SPACING } from '@opentrons/components' | ||
import { getMaxDisposalVolumeForMultidispense } from '../../../../../steplist/formLevel/handleFormChange/utils' | ||
import { selectors as stepFormSelectors } from '../../../../../step-forms' | ||
import { selectors as uiLabwareSelectors } from '../../../../../ui/labware' | ||
import { | ||
CheckboxExpandStepFormField, | ||
DropdownStepFormField, | ||
InputStepFormField, | ||
} from '../../../../../molecules' | ||
import { getBlowoutLocationOptionsForForm } from '../utils' | ||
import { FlowRateField } from './FlowRateField' | ||
import { BlowoutZOffsetField } from './BlowoutZOffsetField' | ||
|
||
import type { PathOption, StepType } from '../../../../../form-types' | ||
import type { FieldPropsByName } from '../types' | ||
|
||
interface DisposalVolumeFieldProps { | ||
path: PathOption | ||
pipette: string | null | ||
propsForFields: FieldPropsByName | ||
stepType: StepType | ||
volume: string | null | ||
aspirate_airGap_checkbox?: boolean | null | ||
aspirate_airGap_volume?: string | null | ||
tipRack?: string | null | ||
} | ||
|
||
export const DisposalVolumeField = ( | ||
props: DisposalVolumeFieldProps | ||
): JSX.Element => { | ||
const { | ||
path, | ||
stepType, | ||
volume, | ||
pipette, | ||
propsForFields, | ||
aspirate_airGap_checkbox, | ||
aspirate_airGap_volume, | ||
tipRack, | ||
} = props | ||
const { t } = useTranslation(['application', 'form']) | ||
|
||
const disposalOptions = useSelector(uiLabwareSelectors.getDisposalOptions) | ||
const pipetteEntities = useSelector(stepFormSelectors.getPipetteEntities) | ||
const blowoutLocationOptions = getBlowoutLocationOptionsForForm({ | ||
path, | ||
stepType, | ||
}) | ||
const maxDisposalVolume = getMaxDisposalVolumeForMultidispense( | ||
{ | ||
aspirate_airGap_checkbox, | ||
aspirate_airGap_volume, | ||
path, | ||
pipette, | ||
volume, | ||
tipRack, | ||
}, | ||
pipetteEntities | ||
) | ||
const disposalDestinationOptions = [ | ||
...disposalOptions, | ||
...blowoutLocationOptions, | ||
] | ||
|
||
const volumeBoundsCaption = | ||
maxDisposalVolume != null | ||
? t('protocol_steps:max_disposal_volume', { | ||
vol: maxDisposalVolume, | ||
unit: t('units.microliter'), | ||
}) | ||
: '' | ||
|
||
const { value, updateValue } = propsForFields.disposalVolume_checkbox | ||
return ( | ||
<CheckboxExpandStepFormField | ||
title={t('protocol_steps:multi_dispense_options')} | ||
checkboxValue={value} | ||
isChecked={value === true} | ||
checkboxUpdateValue={updateValue} | ||
> | ||
{value ? ( | ||
<Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing6}> | ||
<InputStepFormField | ||
{...propsForFields.disposalVolume_volume} | ||
title={t('protocol_steps:disposal_volume')} | ||
units={t('units.microliter')} | ||
padding="0" | ||
showTooltip={false} | ||
caption={volumeBoundsCaption} | ||
/> | ||
<DropdownStepFormField | ||
{...propsForFields.blowout_location} | ||
options={disposalDestinationOptions} | ||
title={t('protocol_steps:blowout_location')} | ||
addPadding={false} | ||
width="16.5rem" | ||
/> | ||
<FlowRateField | ||
{...propsForFields.blowout_flowRate} | ||
pipetteId={pipette} | ||
flowRateType="blowout" | ||
volume={propsForFields.volume?.value ?? 0} | ||
tiprack={propsForFields.tipRack.value} | ||
/> | ||
<BlowoutZOffsetField | ||
{...propsForFields.blowout_z_offset} | ||
sourceLabwareId={propsForFields.aspirate_labware.value} | ||
destLabwareId={propsForFields.dispense_labware.value} | ||
blowoutLabwareId={propsForFields.blowout_location.value} | ||
/> | ||
</Flex> | ||
) : null} | ||
</CheckboxExpandStepFormField> | ||
) | ||
} |
Oops, something went wrong.