Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Aug 20, 2024
1 parent 87cd4c5 commit a1b859f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"reservoir": "Reservoir",
"starting_deck_state": "Starting deck state",
"tipRack": "Tip rack",
"tiprack": "Tiprack",
"tubeRack": "Tube rack",
"wellPlate": "Well plate"
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface DeckSetupToolsProps {
onCloseClick: () => void
}

export const DeckSetupTools = (props: DeckSetupToolsProps): JSX.Element => {
export function DeckSetupTools(props: DeckSetupToolsProps): JSX.Element {
const { slot, onCloseClick, cutoutId } = props
const { t } = useTranslation(['starting_deck_state', 'shared'])
const robotType = useSelector(getRobotType)
Expand Down Expand Up @@ -182,7 +182,7 @@ export const DeckSetupTools = (props: DeckSetupToolsProps): JSX.Element => {
// create module
dispatch(
createModule({
slot: slot,
slot,
type: getModuleType(moduleModel),
model: moduleModel,
})
Expand Down
16 changes: 9 additions & 7 deletions protocol-designer/src/pages/StartingDeckState/LabwareTools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useDispatch, useSelector } from 'react-redux'
import {
COLORS,
DIRECTION_COLUMN,
DISPLAY_INLINE_BLOCK,
Flex,
ListButton,
ListButtonAccordion,
Expand Down Expand Up @@ -55,7 +56,8 @@ import type { LabwareDefByDefURI } from '../../labware-defs'
import type { Fixture } from './constants'

const CUSTOM_CATEGORY = 'custom'

const STANDARD_X_DIMENSION = 127.75
const STANDARD_Y_DIMENSION = 85.48
interface LabwareToolsProps {
slot: DeckSlotId
selectedHardware: ModuleModel | Fixture | null
Expand All @@ -67,7 +69,7 @@ interface LabwareToolsProps {
selectedNestedSelectedLabwareDefURI: string | null
}

export const LabwareTools = (props: LabwareToolsProps): JSX.Element => {
export function LabwareTools(props: LabwareToolsProps): JSX.Element {
const {
slot,
selectedHardware,
Expand All @@ -81,10 +83,8 @@ export const LabwareTools = (props: LabwareToolsProps): JSX.Element => {
const dispatch = useDispatch<ThunkDispatch<any>>()
const permittedTipracks = useSelector(stepFormSelectors.getPermittedTipracks)
const pipetteEntities = useSelector(getPipetteEntities)
const has96Channel = getHas96Channel(pipetteEntities)
const customLabwareDefs = useSelector(getCustomLabwareDefsByURI)
const deckSetup = useSelector(stepFormSelectors.getInitialDeckSetup)
const defs = getOnlyLatestDefs()
// TODO(ja, 8/16/24): We are always filtering recommended labware, check with designs
// where to add the filter checkbox/button
const [filterRecommended, setFilterRecommended] = React.useState<boolean>(
Expand All @@ -95,6 +95,8 @@ export const LabwareTools = (props: LabwareToolsProps): JSX.Element => {
)
const [filterHeight, setFilterHeight] = React.useState<boolean>(false)

const has96Channel = getHas96Channel(pipetteEntities)
const defs = getOnlyLatestDefs()
const modulesById = deckSetup.modules
const moduleModel = MODULE_MODELS.includes(selectedHardware as ModuleModel)
? (selectedHardware as ModuleModel)
Expand Down Expand Up @@ -134,8 +136,8 @@ export const LabwareTools = (props: LabwareToolsProps): JSX.Element => {
const { dimensions, parameters } = labwareDef
const { xDimension, yDimension } = dimensions

const isSmallXDimension = xDimension < 127.75
const isSmallYDimension = yDimension < 85.48
const isSmallXDimension = xDimension < STANDARD_X_DIMENSION
const isSmallYDimension = yDimension < STANDARD_Y_DIMENSION
const isIrregularSize = isSmallXDimension && isSmallYDimension

const isAdapter = labwareDef.allowedRoles?.includes('adapter')
Expand Down Expand Up @@ -388,7 +390,7 @@ export const LabwareTools = (props: LabwareToolsProps): JSX.Element => {
const StyledLabel = styled.label`
text-decoration: ${TYPOGRAPHY.textDecorationUnderline};
text-align: ${TYPOGRAPHY.textAlignCenter}};
display: inline-block;
display: ${DISPLAY_INLINE_BLOCK}
cursor: pointer;
input[type='file'] {
display: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ describe('LabwareTools', () => {
// set labware
expect(props.setSelectedLabwareDefURI).toHaveBeenCalled()
})
it('renders slot with heater-shaker on it and selects an adapter and labware', () => {
props.selectedHardware = HEATERSHAKER_MODULE_V1
props.selecteLabwareDefURI = 'fixture/opentrons_universal_flat_adapter/1'
it('renders deck slot and selects an adapter and labware', () => {
props.selecteLabwareDefURI =
'fixture/fixture_universal_flat_bottom_adapter/1'
render(props)
screen.getByText('Adapter')
fireEvent.click(screen.getAllByTestId('ListButton_noActive')[0])
fireEvent.click(screen.getAllByTestId('ListButton_noActive')[4])
// set adapter
fireEvent.click(
screen.getByRole('label', {
Expand All @@ -97,7 +97,12 @@ describe('LabwareTools', () => {
)
// set labware
screen.getByText('Adapter compatible labware')
fireEvent.click(screen.getAllByRole('label')[1])
screen.getByText('Fixture Corning 96 Well Plate 360 µL Flat')
fireEvent.click(
screen.getByRole('label', {
name: 'Fixture Corning 96 Well Plate 360 µL Flat',
})
)
expect(props.setNestedSelectedLabwareDefURI).toHaveBeenCalled()
})

Expand Down
4 changes: 2 additions & 2 deletions protocol-designer/src/pages/StartingDeckState/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ export const OT2_MODULE_MODELS: ModuleModel[] = [

export type Fixture =
| 'stagingArea'
| 'wasteChute'
| 'trashBin'
| 'wasteChute'
| 'wasteChuteAndStagingArea'

export const FIXTURES: Fixture[] = [
'stagingArea',
'wasteChute',
'trashBin',
'wasteChute',
'wasteChuteAndStagingArea',
]

Expand Down
12 changes: 3 additions & 9 deletions shared-data/js/__tests__/labwareDefSchemaV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,9 @@ describe('test schemas of all v2 labware fixtures', () => {
})

it(`fixture file name matches loadName: ${labwarePath}`, () => {
// filtering out this fixture since we need the exact loadName to test
// for PD's heater-shaker adapter/labware combos
if (
labwareDef.parameters.loadName !== 'opentrons_universal_flat_adapter'
) {
expect(labwareDef.parameters.loadName).toEqual(
path.basename(filename, '.json')
)
}
expect(labwareDef.parameters.loadName).toEqual(
path.basename(filename, '.json')
)
})

it(`namespace is "fixture": ${labwarePath}`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1049,15 +1049,10 @@
"version": 2,
"schemaVersion": 2,
"stackingOffsetWithLabware": {
"opentrons_universal_flat_adapter": {
"fixture_universal_flat_bottom_adapter": {
"x": 0,
"y": 0,
"z": 10.22
},
"opentrons_aluminum_flat_bottom_plate": {
"x": 0,
"y": 0,
"z": 5.45
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"tags": []
},
"dimensions": {
"xDimension": 111,
"yDimension": 75,
"zDimension": 12
"xDimension": 156.5,
"yDimension": 93,
"zDimension": 132
},
"wells": {},
"groups": [
Expand All @@ -27,7 +27,7 @@
"quirks": [],
"isTiprack": false,
"isMagneticModuleCompatible": false,
"loadName": "opentrons_universal_flat_adapter"
"loadName": "fixture_universal_flat_bottom_adapter"
},
"namespace": "fixture",
"version": 1,
Expand Down

0 comments on commit a1b859f

Please sign in to comment.