Skip to content

Commit 00e59b3

Browse files
authored
Merge branch 'edge' into release-script
2 parents 13f3b66 + 7512850 commit 00e59b3

File tree

47 files changed

+1195
-551
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1195
-551
lines changed

app/src/molecules/InterventionModal/DeckMapContent.tsx

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { useEffect } from 'react'
22
import { css } from 'styled-components'
33

44
import {
5-
AlignControlToModule,
65
BaseDeck,
76
Box,
7+
CenterLabwareInModuleChildSlot,
8+
CenterLabwareInSlot,
89
COLORS,
910
DIRECTION_COLUMN,
1011
DISPLAY_FLEX,
@@ -15,10 +16,9 @@ import {
1516
import {
1617
FLEX_STACKER_MODULE_TYPE,
1718
getDeckDefFromRobotType,
19+
getLabwareViewBox,
1820
getModuleDef,
1921
getModuleType,
20-
getSchema2CornerOffsetFromSlot,
21-
getSchema2Dimensions,
2222
} from '@opentrons/shared-data'
2323

2424
import type { ComponentProps } from 'react'
@@ -73,10 +73,16 @@ function InterventionStyleDeckMapContent(
7373
? {
7474
...labwareOnDeck,
7575
labwareChildren: (
76-
<LabwareHighlight
77-
highlight={true}
78-
definition={labwareOnDeck.definition}
79-
/>
76+
<CenterLabwareInSlot definition={labwareOnDeck.definition}>
77+
{/*
78+
LabwareHighlight is a valid "labware" in CenterLabwareInSlot because it
79+
sizes and positions itself exactly like the underlying labware definition would.
80+
*/}
81+
<LabwareHighlight
82+
highlight={true}
83+
definition={labwareOnDeck.definition}
84+
/>
85+
</CenterLabwareInSlot>
8086
),
8187
}
8288
: labwareOnDeck
@@ -96,16 +102,20 @@ function InterventionStyleDeckMapContent(
96102
...module,
97103
moduleChildren:
98104
module?.nestedLabwareDefsBottomToTop.length > 0 ? (
99-
<AlignControlToModule
100-
// todo(mm, 2025-07-14): This <AlignControlToModule> ought to be a
101-
// <AlignLabwareToModule>; right now, this will misalign the highlight
102-
// for schema-3 labware definitions. Before we can do that,
103-
// <LabwareHighlight> and probably <BaseDeck>'s labwareChildren prop
104-
// will need to be modified.
105+
<CenterLabwareInModuleChildSlot
105106
deckId={deckDef.otId}
106107
slotId={module.moduleLocation.slotName}
107108
moduleDefinition={getModuleDef(module.moduleModel)}
109+
labwareDefinition={
110+
module.nestedLabwareDefsBottomToTop[
111+
module.nestedLabwareDefsBottomToTop.length - 1
112+
]
113+
}
108114
>
115+
{/*
116+
LabwareHighlight is a valid "labware" in CenterLabwareInModuleChildSlot because it
117+
sizes and positions itself exactly like the underlying labware definition would.
118+
*/}
109119
<LabwareHighlight
110120
highlight={true}
111121
definition={
@@ -114,7 +124,7 @@ function InterventionStyleDeckMapContent(
114124
]
115125
}
116126
/>
117-
</AlignControlToModule>
127+
</CenterLabwareInModuleChildSlot>
118128
) : undefined,
119129
}
120130
: module
@@ -144,22 +154,22 @@ function DeckConfigStyleDeckMapContent({
144154
return <>{DeckLocationSelect}</>
145155
}
146156

147-
export function LabwareHighlight({
157+
function LabwareHighlight({
148158
highlight,
149159
definition,
150160
}: {
151161
highlight: boolean
152162
definition: LabwareDefinition
153163
}): JSX.Element {
154-
const { xDimension: width, yDimension: height } =
155-
getSchema2Dimensions(definition)
156-
const cornerOffsetFromSlot = getSchema2CornerOffsetFromSlot(definition)
164+
// Size and position ourselves exactly like the underlying labware.
165+
const { minX, minY, xDimension, yDimension } = getLabwareViewBox(definition)
157166

158167
return (
159168
<RobotCoordsForeignDiv
160-
x={cornerOffsetFromSlot.x}
161-
y={cornerOffsetFromSlot.y}
162-
{...{ width, height }}
169+
x={minX}
170+
y={minY}
171+
width={xDimension}
172+
height={yDimension}
163173
innerDivProps={{
164174
display: DISPLAY_FLEX,
165175
flexDirection: DIRECTION_COLUMN,

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { useMemo, useState } from 'react'
22

33
import {
4-
AlignControlToModule,
4+
AlignToModuleChildSlot,
55
BaseDeck,
66
Box,
7+
CenterLabwareInSlot,
78
DIRECTION_COLUMN,
89
Flex,
910
LabwareInfoOverlay,
@@ -89,6 +90,8 @@ export function SetupLabwareMap({
8990
: null
9091
// TODO: ja 8.27.25: find a better way to find the matching lid def without
9192
// relying on the lidDisplayNames
93+
// TODO: mm 12.3.25: deduplicate with other places where we're doing the same thing
94+
// (grep for matchingLidDef)
9295
const matchingLidDef = Object.values(labwareDefinitionsByURI).find(
9396
uri => uri.metadata.displayName === topLabwareInfo?.lidDisplayName
9497
)
@@ -142,10 +145,7 @@ export function SetupLabwareMap({
142145
cursor="pointer"
143146
>
144147
{topLabwareDefinition != null && topLabwareInfo != null ? (
145-
<AlignControlToModule
146-
// todo(mm, 2025-07-14): This <AlignControlToModule> ought to be an
147-
// <AlignLabwareToModule>. Right now, this will misalign the overlay
148-
// for schema-3 labware definitions.
148+
<AlignToModuleChildSlot
149149
deckId={deckDef.otId}
150150
slotId={slotName}
151151
moduleDefinition={moduleDefinition}
@@ -163,7 +163,7 @@ export function SetupLabwareMap({
163163
: 0
164164
}
165165
/>
166-
</AlignControlToModule>
166+
</AlignToModuleChildSlot>
167167
) : null}
168168
</g>
169169
),
@@ -178,6 +178,10 @@ export function SetupLabwareMap({
178178
topLabwareInfo != null
179179
? labwareDefinitionsByURI[topLabwareInfo.definitionUri]
180180
: null
181+
// TODO: ja 8.27.25: find a better way to find the matching lid def without
182+
// relying on the lidDisplayNames
183+
// TODO: mm 12.3.25: deduplicate with other places where we're doing the same thing
184+
// (grep for matchingLidDef)
181185
const matchingLidDef = Object.values(labwareDefinitionsByURI).find(
182186
uri => uri.metadata.displayName === topLabwareInfo?.lidDisplayName
183187
)
@@ -199,10 +203,12 @@ export function SetupLabwareMap({
199203
labwareChildren: (
200204
<>
201205
{matchingLidDef != null ? (
202-
<LabwareRender
203-
definition={matchingLidDef}
204-
positioningMode="passThrough"
205-
/>
206+
<CenterLabwareInSlot definition={matchingLidDef}>
207+
<LabwareRender
208+
definition={matchingLidDef}
209+
positioningMode="passThrough"
210+
/>
211+
</CenterLabwareInSlot>
206212
) : null}
207213
<g
208214
cursor="pointer"

app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/SetupModulesMap.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
AlignControlToModule,
2+
AlignToModuleChildSlot,
33
BaseDeck,
44
Box,
55
DIRECTION_COLUMN,
@@ -70,7 +70,7 @@ export const SetupModulesMap = ({
7070
moduleModel: module.moduleDef.model,
7171
moduleLocation: { slotName: module.slotName },
7272
moduleChildren: (
73-
<AlignControlToModule
73+
<AlignToModuleChildSlot
7474
deckId={deckDef.otId}
7575
slotId={module.slotName}
7676
moduleDefinition={module.moduleDef}
@@ -81,7 +81,7 @@ export const SetupModulesMap = ({
8181
physicalPort={parseModuleUSBPort(module.attachedModuleMatch)}
8282
runId={runId}
8383
/>
84-
</AlignControlToModule>
84+
</AlignToModuleChildSlot>
8585
),
8686
})
8787
)

app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLabware/LabwareMapView.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { useMemo } from 'react'
22

3-
import { BaseDeck, Flex, LabwareRender } from '@opentrons/components'
3+
import {
4+
BaseDeck,
5+
CenterLabwareInSlot,
6+
Flex,
7+
LabwareRender,
8+
} from '@opentrons/components'
49
import {
510
FLEX_ROBOT_TYPE,
611
getLabwareDefinitionsByURIForProtocol,
@@ -52,6 +57,8 @@ export function LabwareMapView(props: LabwareMapViewProps): JSX.Element {
5257
: null
5358
// TODO: ja 8.27.25: find a better way to find the matching lid def without
5459
// relying on the lidDisplayNames
60+
// TODO: mm 12.3.25: deduplicate with other places where we're doing the same thing
61+
// (grep for matchingLidDef)
5562
const matchingLidDef = Object.values(definitionsByURI).find(
5663
uri => uri.metadata.displayName === topLabwareInfo?.lidDisplayName
5764
)
@@ -97,6 +104,10 @@ export function LabwareMapView(props: LabwareMapViewProps): JSX.Element {
97104
topLabwareInfo != null
98105
? definitionsByURI[topLabwareInfo.definitionUri]
99106
: null
107+
// TODO: ja 8.27.25: find a better way to find the matching lid def without
108+
// relying on the lidDisplayNames
109+
// TODO: mm 12.3.25: deduplicate with other places where we're doing the same thing
110+
// (grep for matchingLidDef)
100111
const matchingLidDef = Object.values(definitionsByURI).find(
101112
uri => uri.metadata.displayName === topLabwareInfo?.lidDisplayName
102113
)
@@ -116,15 +127,17 @@ export function LabwareMapView(props: LabwareMapViewProps): JSX.Element {
116127
onLabwareClick: () => {
117128
handleLabwareClick([slotName, stackedItems])
118129
},
119-
wellFill: wellFill,
130+
wellFill,
120131
highlight: true,
121132
stacked: isLabwareInStack,
122133
labwareChildren:
123134
matchingLidDef != null ? (
124-
<LabwareRender
125-
definition={matchingLidDef}
126-
positioningMode="passThrough"
127-
/>
135+
<CenterLabwareInSlot definition={matchingLidDef}>
136+
<LabwareRender
137+
definition={matchingLidDef}
138+
positioningMode="passThrough"
139+
/>
140+
</CenterLabwareInSlot>
128141
) : null,
129142
}
130143
})

app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/ModulesAndDeckMapView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AlignControlToModule, BaseDeck, Flex } from '@opentrons/components'
1+
import { AlignToModuleChildSlot, BaseDeck, Flex } from '@opentrons/components'
22
import {
33
FLEX_ROBOT_TYPE,
44
getDeckDefFromRobotType,
@@ -37,7 +37,7 @@ export function ModulesAndDeckMapView({
3737
moduleModel: module.moduleDef.model,
3838
moduleLocation: { slotName: module.slotName },
3939
moduleChildren: (
40-
<AlignControlToModule
40+
<AlignToModuleChildSlot
4141
deckId={deckDef.otId}
4242
slotId={module.slotName}
4343
moduleDefinition={module.moduleDef}
@@ -48,7 +48,7 @@ export function ModulesAndDeckMapView({
4848
physicalPort={parseModuleUSBPort(module.attachedModuleMatch)}
4949
runId={runId}
5050
/>
51-
</AlignControlToModule>
51+
</AlignToModuleChildSlot>
5252
),
5353
})
5454
)

0 commit comments

Comments
 (0)