Skip to content

Commit 8ca3abe

Browse files
authored
refactor(protocol-designer): show lid on deck view always (#18710)
closes AUTH-1911, AUTH-1945
1 parent 4471f04 commit 8ca3abe

File tree

6 files changed

+24
-39
lines changed

6 files changed

+24
-39
lines changed

protocol-designer/src/components/organisms/SelectLabwareModal/index.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ import {
6464
getLabwareIsRecommended,
6565
getStackerDefinition,
6666
} from '../../../pages/Designer/DeckSetup/utils'
67-
import { TC_LID_LOADNAME } from '../../../pages/Designer/utils'
67+
import { TIPRACK_LID_LOADNAME } from '../../../pages/Designer/utils'
6868
import { selectors as stepFormSelectors } from '../../../step-forms'
6969
import { getPipetteEntities } from '../../../step-forms/selectors'
7070
import { getHas96Channel } from '../../../utils'
@@ -118,6 +118,14 @@ export function SelectLabwareModal(
118118
const customLabwareDefs = useSelector(getCustomLabwareDefsByURI)
119119
const has96Channel = getHas96Channel(pipetteEntities)
120120
const defs = getOnlyLatestDefs()
121+
const lidLoadNames = Object.values(defs)
122+
.filter(
123+
def =>
124+
def.allowedRoles?.includes('lid') &&
125+
def.parameters.loadName !== TIPRACK_LID_LOADNAME
126+
)
127+
?.map(def => def.parameters.loadName)
128+
121129
const deckSetup = useSelector(stepFormSelectors.getInitialDeckSetup)
122130
const zoomedInSlotInfo = useSelector(selectors.getZoomedInSlotInfo)
123131
const {
@@ -542,7 +550,7 @@ export function SelectLabwareModal(
542550
loadName={loadName}
543551
allowInputField={
544552
onFlexStacker ||
545-
loadName === TC_LID_LOADNAME
553+
lidLoadNames.includes(loadName)
546554
}
547555
stackingProps={stackingProps ?? undefined}
548556
id={`${index}_${category}_${loadName}`}
@@ -736,11 +744,10 @@ export function SelectLabwareModal(
736744
nestedDef.parameters
737745
.loadName
738746
}
739-
allowInputField={
747+
allowInputField={lidLoadNames.includes(
740748
nestedDef.parameters
741-
.loadName ===
742-
TC_LID_LOADNAME
743-
}
749+
.loadName
750+
)}
744751
stackingProps={
745752
stackingProps ?? undefined
746753
}

protocol-designer/src/pages/Designer/DeckSetup/DeckSetupDetails.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
getStagingAreaAddressableAreas,
3030
getTopmostLabwareOnModuleFromStack,
3131
} from '../../../utils'
32-
import { getShowTCLid } from '../../ProtocolOverview/utils'
3332
import { HighlightLabware } from '../HighlightLabware'
3433
import { getSlotInformation } from '../utils'
3534
import { HighlightItems } from './HighlightItems'
@@ -429,8 +428,7 @@ export function DeckSetupDetails(props: DeckSetupDetailsProps): JSX.Element {
429428
if (
430429
getSlotInLocationStack(labware.stack) === 'offDeck' ||
431430
allModules.some(m => labware.stack.includes(m.id)) ||
432-
labware.id === adjacentLabware?.id ||
433-
getShowTCLid(labware)
431+
labware.id === adjacentLabware?.id
434432
) {
435433
return null
436434
}

protocol-designer/src/pages/Designer/utils.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { reduce } from 'lodash'
44

55
import {
66
FLEX_ROBOT_TYPE,
7+
getAllLabwareDefs,
78
getIsTiprack,
89
getPositionFromSlotId,
910
TC_MODULE_LOCATION_OT2,
@@ -49,7 +50,6 @@ import type { Fixture } from './DeckSetup/constants'
4950

5051
export const TIPRACK_LID_LOADNAME = 'opentrons_flex_tiprack_lid'
5152
export const TC_LID_LOADNAME = 'opentrons_tough_pcr_auto_sealing_lid'
52-
export const LID_LOADNAMES = [TIPRACK_LID_LOADNAME, TC_LID_LOADNAME]
5353

5454
export interface AdditionalEquipment {
5555
name: AdditionalEquipmentName
@@ -86,6 +86,10 @@ export const getSlotInformation = (
8686
modules: deckSetupModules,
8787
additionalEquipmentOnDeck,
8888
} = deckSetup
89+
const latestDefs = getAllLabwareDefs()
90+
const lidLoadNames = Object.values(latestDefs)
91+
.filter(def => def.allowedRoles?.includes('lid'))
92+
?.map(def => def.parameters.loadName)
8993
const offDeckLabware = deckSetupLabware[slot]
9094
const slotPosition =
9195
deckDef != null && offDeckLabware == null
@@ -111,26 +115,24 @@ export const getSlotInformation = (
111115
fullStackFromLabwares?.filter(
112116
id =>
113117
deckSetupLabware[id] != null &&
114-
deckSetupLabware[id].def.parameters.loadName === TC_LID_LOADNAME
118+
lidLoadNames.includes(deckSetupLabware[id].def.parameters.loadName) &&
119+
deckSetupLabware[id].def.parameters.loadName !== TIPRACK_LID_LOADNAME
115120
)?.length ?? 0
116-
117121
const labwareIdsFromFullStack =
118122
fullStackFromLabwares?.filter(
119123
id =>
120124
deckSetupLabware[id] != null &&
121125
// remove lid from stack if its a labware + lid
122126
(numOfTcLidsOnStack === 1 && labwareStackOnSlot.length > 1
123-
? !LID_LOADNAMES.includes(
124-
deckSetupLabware[id].def.parameters.loadName
125-
)
127+
? !lidLoadNames.includes(deckSetupLabware[id].def.parameters.loadName)
126128
: // otherwise, count lid in stack if its a stack of lids
127129
deckSetupLabware[id].def.parameters.loadName !==
128130
TIPRACK_LID_LOADNAME)
129131
) ?? []
130132

131133
const lidIdFromStack = fullStackFromLabwares?.find(id =>
132134
numOfTcLidsOnStack === 1
133-
? LID_LOADNAMES.includes(deckSetupLabware[id].def.parameters.loadName)
135+
? lidLoadNames.includes(deckSetupLabware[id].def.parameters.loadName)
134136
: deckSetupLabware[id]?.def.parameters.loadName === TIPRACK_LID_LOADNAME
135137
)
136138

protocol-designer/src/pages/ProtocolOverview/DeckThumbnailDetails.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
getTopmostLabwareOnModuleFromStack,
2323
} from '../../utils'
2424
import { SlotHover } from './SlotHover'
25-
import { getShowTCLid } from './utils'
2625

2726
import type { Dispatch, SetStateAction } from 'react'
2827
import type {
@@ -127,8 +126,7 @@ export const DeckThumbnailDetails = (
127126
{allLabware.map(labware => {
128127
if (
129128
getSlotInLocationStack(labware.stack) === 'offDeck' ||
130-
allModules.some(m => labware.stack.includes(m.id)) ||
131-
getShowTCLid(labware)
129+
allModules.some(m => labware.stack.includes(m.id))
132130
) {
133131
return null
134132
}

protocol-designer/src/pages/ProtocolOverview/utils.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

shared-data/js/getLabware.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export const PD_DO_NOT_LIST = [
7979
'opentrons_tough_1_reservoir_300ml',
8080
'opentrons_tough_4_reservoir_72ml',
8181
'opentrons_tough_12_reservoir_22ml',
82-
'opentrons_tough_universal_lid',
8382
]
8483

8584
export function getIsLabwareV1Tiprack(def: LabwareDefinition1): boolean {

0 commit comments

Comments
 (0)