Skip to content

Commit

Permalink
refactor(protocol-designer): misc staging area slot bugs addressing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader authored Dec 12, 2023
1 parent 918284a commit a32571e
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 41 deletions.
3 changes: 2 additions & 1 deletion protocol-designer/src/components/DeckSetup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ export const DeckSetup = (): JSX.Element => {
aE =>
STAGING_AREA_CUTOUTS.includes(aE.location as CutoutId) &&
aE.name === 'stagingArea' &&
aE.location === WASTE_CHUTE_CUTOUT
aE.location === WASTE_CHUTE_CUTOUT &&
wasteChuteFixtures.length > 0
)

const hasWasteChute =
Expand Down
26 changes: 10 additions & 16 deletions protocol-designer/src/components/modules/StagingAreasModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {
DIRECTION_ROW,
Box,
Text,
JUSTIFY_CENTER,
ALIGN_CENTER,
JUSTIFY_FLEX_END,
JUSTIFY_END,
DeckConfigurator,
DIRECTION_COLUMN,
} from '@opentrons/components'
import {
CutoutId,
Expand Down Expand Up @@ -120,11 +120,12 @@ const StagingAreasModalComponent = (

return (
<Form>
<Box paddingX={SPACING.spacing32}>
<Flex height="20rem" flexDirection={DIRECTION_COLUMN}>
<Flex
justifyContent={JUSTIFY_END}
alignItems={ALIGN_CENTER}
height="3.125rem"
height="4rem"
paddingX={SPACING.spacing32}
>
<Box>
{hasConflictedSlot ? (
Expand All @@ -138,19 +139,12 @@ const StagingAreasModalComponent = (
) : null}
</Box>
</Flex>

<Flex
height="20rem"
marginTop="-2.5rem"
justifyContent={JUSTIFY_CENTER}
>
<DeckConfigurator
deckConfig={updatedSlots}
handleClickAdd={handleClickAdd}
handleClickRemove={handleClickRemove}
/>
</Flex>
</Box>
<DeckConfigurator
deckConfig={updatedSlots}
handleClickAdd={handleClickAdd}
handleClickRemove={handleClickRemove}
/>
</Flex>
<Flex
flexDirection={DIRECTION_ROW}
justifyContent={JUSTIFY_FLEX_END}
Expand Down
34 changes: 10 additions & 24 deletions protocol-designer/src/ui/labware/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ import { createSelector } from 'reselect'
import mapValues from 'lodash/mapValues'
import reduce from 'lodash/reduce'
import { getIsTiprack, getLabwareDisplayName } from '@opentrons/shared-data'
import {
AdditionalEquipmentEntity,
COLUMN_4_SLOTS,
} from '@opentrons/step-generation'
import { AdditionalEquipmentEntity } from '@opentrons/step-generation'
import { i18n } from '../../localization'
import * as stepFormSelectors from '../../step-forms/selectors'
import { selectors as labwareIngredSelectors } from '../../labware-ingred/selectors'
import { getModuleUnderLabware } from '../modules/utils'
import { getLabwareOffDeck } from './utils'
import { getLabwareOffDeck, getLabwareInColumn4 } from './utils'

import type { LabwareEntity } from '@opentrons/step-generation'
import type { DropdownOption, Options } from '@opentrons/components'
Expand Down Expand Up @@ -82,23 +79,6 @@ export const getLabwareOptions: Selector<Options> = createSelector(
savedStepForms ?? {},
labwareId
)
const isStartingInColumn4 = COLUMN_4_SLOTS.includes(
initialDeckSetup.labware[labwareId]?.slot
)

const isInColumn4 =
savedStepForms != null
? Object.values(savedStepForms)
?.reverse()
.some(
form =>
form.stepType === 'moveLabware' &&
form.labware === labwareId &&
(COLUMN_4_SLOTS.includes(form.newLocation) ||
(isStartingInColumn4 &&
!COLUMN_4_SLOTS.includes(form.newLocation)))
)
: false

const isAdapterOrAluminumBlock =
isAdapter ||
Expand All @@ -116,12 +96,18 @@ export const getLabwareOptions: Selector<Options> = createSelector(
)
: null

const isLabwareInColumn4 = getLabwareInColumn4(
initialDeckSetup,
savedStepForms ?? {},
labwareId
)

let nickName = nicknamesById[labwareId]
if (module != null) {
nickName = `${nicknamesById[labwareId]} in ${module}`
} else if (isOffDeck) {
nickName = `Off-deck - ${nicknamesById[labwareId]}`
} else if (isInColumn4) {
nickName = `${nicknamesById[labwareId]} off-deck`
} else if (isLabwareInColumn4) {
nickName = `${nicknamesById[labwareId]} in staging area slot`
}

Expand Down
31 changes: 31 additions & 0 deletions protocol-designer/src/ui/labware/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { COLUMN_4_SLOTS } from '@opentrons/step-generation'
import type { InitialDeckSetup, SavedStepFormState } from '../../step-forms'

export function getLabwareOffDeck(
Expand All @@ -24,3 +25,33 @@ export function getLabwareOffDeck(
return true
} else return false
}

export function getLabwareInColumn4(
initialDeckSetup: InitialDeckSetup,
savedStepForms: SavedStepFormState,
labwareId: string
): boolean {
const isStartingInColumn4 = COLUMN_4_SLOTS.includes(
initialDeckSetup.labware[labwareId]?.slot
)
// latest moveLabware step related to labwareId
const moveLabwareStep = Object.values(savedStepForms)
.filter(
state =>
state.stepType === 'moveLabware' &&
labwareId != null &&
labwareId === state.labware
)
.reverse()[0]

if (
moveLabwareStep?.newLocation != null &&
COLUMN_4_SLOTS.includes(moveLabwareStep.newLocation)
) {
return true
} else if (moveLabwareStep == null && isStartingInColumn4) {
return true
} else {
return false
}
}

0 comments on commit a32571e

Please sign in to comment.