@@ -13,12 +13,17 @@ import { TipDisposalSlot } from '../SecondWindow/TipDisposalSlot'
1313import { TipPickupSlot } from '../SecondWindow/TipPickupSlot'
1414import styles from './slotdetails.module.css'
1515
16- import type { Liquid , ProtocolAnalysisOutput } from '@opentrons/shared-data'
16+ import type {
17+ Liquid ,
18+ LoadLabwareRunTimeCommand ,
19+ ProtocolAnalysisOutput ,
20+ } from '@opentrons/shared-data'
1721import type {
1822 HopperLocationMapKey ,
1923 InvariantContext ,
2024 RobotState ,
2125} from '@opentrons/step-generation'
26+ import type { LabwareEntityExtended } from '../DeckView'
2227
2328interface SlotDetailsProps {
2429 slotId : string
@@ -37,6 +42,9 @@ export function SlotDetails(props: SlotDetailsProps): JSX.Element {
3742 moduleEntities,
3843 } = invariantContext
3944 const { commands } = analysis
45+ const loadLabwareCommands = commands . filter (
46+ command => command . commandType === 'loadLabware'
47+ )
4048 const stackOfLabwareOnSlot = getFullStackFromLabwares ( labware , slotId )
4149 const isHopperSlot = HOPPER_FAKE_LOCATIONS . includes ( slotId )
4250 const mappedSlot = isHopperSlot
@@ -45,6 +53,22 @@ export function SlotDetails(props: SlotDetailsProps): JSX.Element {
4553 const moduleOnSlot = Object . entries ( modules ) . find (
4654 ( [ id , module ] ) => module . slot === mappedSlot
4755 )
56+ const labwareEntitiesExtended = Object . entries ( labwareEntities ) . reduce (
57+ ( acc : Record < string , LabwareEntityExtended > , [ key , entity ] ) => {
58+ const matchingCommand =
59+ loadLabwareCommands . find (
60+ ( command ) : command is LoadLabwareRunTimeCommand =>
61+ command . result ?. labwareId === entity . id
62+ ) ?? null
63+ acc [ key ] = {
64+ ...entity ,
65+ nickName : matchingCommand ?. params ?. displayName ?? null ,
66+ }
67+ return acc
68+ } ,
69+ { }
70+ )
71+
4872 const topMostLabwareOnSlot =
4973 stackOfLabwareOnSlot ?. length > 1 ? stackOfLabwareOnSlot [ 0 ] : null
5074 const isTopmostLabwareATiprack =
@@ -81,7 +105,7 @@ export function SlotDetails(props: SlotDetailsProps): JSX.Element {
81105 case 'tiprack' :
82106 return (
83107 < TipPickupSlot
84- tiprackEntity = { labwareEntities [ topMostLabwareOnSlot ] }
108+ tiprackEntity = { labwareEntitiesExtended [ topMostLabwareOnSlot ] }
85109 robotState = { robotState }
86110 />
87111 )
0 commit comments