Skip to content

Commit 9dac3e1

Browse files
authored
feat(app): Show labware versions in LPC (#18870)
Closes EXEC-1592
1 parent 0e9b20d commit 9dac3e1

File tree

7 files changed

+79
-11
lines changed

7 files changed

+79
-11
lines changed

app/src/assets/localization/en/labware_position_check.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
"total_offsets": "Total Offsets",
188188
"try_again": "Try again",
189189
"unsaved_changes_will_be_lost": "Unsaved changes will be lost",
190+
"version_number": "v{{version}}",
190191
"view_current_offsets": "view current offsets",
191192
"view_data": "View data",
192193
"view_labware_list": "View labware list",

app/src/organisms/LabwareOffsetsTable/AccordionHeader.tsx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import {
1010
RESPONSIVENESS,
1111
SPACING,
1212
StyledText,
13+
truncateString,
1314
} from '@opentrons/components'
1415

16+
import { getIsOnDevice } from '/app/redux/config'
1517
import { selectTotalOrMissingOffsetRequiredCountForLwCopy } from '/app/redux/protocol-runs'
1618

1719
import type { TFunction } from 'i18next'
@@ -20,26 +22,40 @@ export interface AccordionHeaderProps {
2022
runId: string
2123
uri: string
2224
lwDisplayName: string
25+
lwVersion: number
2326
}
2427

2528
export function AccordionHeader({
2629
lwDisplayName,
2730
runId,
2831
uri,
32+
lwVersion,
2933
}: AccordionHeaderProps): JSX.Element {
3034
const { t } = useTranslation('labware_position_check')
3135
const offsetCopy = useSelector(
3236
selectTotalOrMissingOffsetRequiredCountForLwCopy(runId, uri, t as TFunction)
3337
)
38+
const isOnDevice = useSelector(getIsOnDevice)
39+
const nameString = isOnDevice
40+
? truncateString(lwDisplayName, 43)
41+
: lwDisplayName
3442

3543
return (
3644
<Flex css={ACCORDION_HEADER_CONTAINER_STYLE}>
37-
<StyledText
38-
oddStyle="bodyTextSemiBold"
39-
desktopStyle="bodyDefaultSemiBold"
40-
>
41-
{lwDisplayName}
42-
</StyledText>
45+
<Flex css={LABWARE_COPY_CONTAINER_STYLE}>
46+
<StyledText
47+
oddStyle="bodyTextSemiBold"
48+
desktopStyle="bodyDefaultSemiBold"
49+
>
50+
{nameString}
51+
</StyledText>
52+
<StyledText
53+
oddStyle="bodyTextRegular"
54+
desktopStyle="bodyDefaultRegular"
55+
>
56+
{t('version_number', { version: lwVersion })}
57+
</StyledText>
58+
</Flex>
4359
<StyledText
4460
css={OFFSET_COPY_STYLE}
4561
oddStyle="bodyTextRegular"
@@ -57,6 +73,10 @@ const ACCORDION_HEADER_CONTAINER_STYLE = css`
5773
justify-content: ${JUSTIFY_SPACE_BETWEEN};
5874
`
5975

76+
const LABWARE_COPY_CONTAINER_STYLE = css`
77+
gap: ${SPACING.spacing8};
78+
`
79+
6080
const OFFSET_COPY_STYLE = css`
6181
width: 6.85rem;
6282
text-wrap: ${NO_WRAP};

app/src/organisms/LabwareOffsetsTable/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export function LabwareOffsetsTable(
6161
{...props}
6262
uri={aLwInfo.uri}
6363
lwDisplayName={aLwInfo.info.displayName}
64+
lwVersion={aLwInfo.info.version}
6465
/>
6566
}
6667
>

app/src/organisms/LabwarePositionCheck/LPCFlows/hooks/useLPCLabwareInfo/getLPCLabwareInfoFrom/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { getLabwareDefURI, getLabwareDisplayName } from '@opentrons/shared-data'
1+
import {
2+
getLabwareDefURI,
3+
getLabwareDisplayName,
4+
splitLabwareDefURI,
5+
} from '@opentrons/shared-data'
26

37
import {
48
getTotalCountNonHardCodedLocationSpecificOffsets,
@@ -64,6 +68,7 @@ function getLabwareInfoRecords(
6468
labwareDetails[uri] = {
6569
id: getALabwareIdFromUri({ ...params, uri }),
6670
displayName: getDisplayNameFromUri({ ...params, uri }),
71+
version: splitLabwareDefURI(uri).version,
6772
defaultOffsetDetails: getDefaultOffsetDetailsForLabware({
6873
...params,
6974
uri,

app/src/organisms/LabwarePositionCheck/__fixtures__/mockLabwareInfo.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { LwGeometryDetails } from '/app/redux/protocol-runs'
33
export const mockLabwareInfo: Record<string, LwGeometryDetails> = {
44
'labware-uri-1': {
55
id: 'labware-1',
6+
version: 1,
67
displayName: 'Labware 1',
78
defaultOffsetDetails: {
89
existingOffset: null,
@@ -22,6 +23,7 @@ export const mockLabwareInfo: Record<string, LwGeometryDetails> = {
2223
},
2324
'labware-uri-2': {
2425
id: 'labware-2',
26+
version: 2,
2527
displayName: 'Labware 2',
2628
defaultOffsetDetails: {
2729
existingOffset: {

app/src/organisms/LabwarePositionCheck/steps/HandleLabware/LPCLabwareList.tsx

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
SPACING,
2121
StyledText,
2222
TextListTableContent,
23+
truncateString,
2324
} from '@opentrons/components'
2425

2526
import { LPCContentContainer } from '/app/organisms/LabwarePositionCheck/LPCContentContainer'
@@ -199,9 +200,10 @@ function LabwareItem({
199200
>
200201
<Flex css={CONTENT_CONTAINER_STYLE}>
201202
<Flex css={TEXT_CONTAINER_STYLE}>
202-
<StyledText oddStyle="level4HeaderSemiBold">
203-
{info.displayName}
204-
</StyledText>
203+
<LabwareInfoCopy
204+
displayName={info.displayName}
205+
version={info.version}
206+
/>
205207
<StyledText oddStyle="bodyTextRegular" css={SUBTEXT_STYLE}>
206208
{offsetCopy}
207209
</StyledText>
@@ -211,7 +213,12 @@ function LabwareItem({
211213
</ListButton>
212214
) : (
213215
<RadioButton
214-
buttonLabel={info.displayName}
216+
buttonLabel={
217+
<LabwareInfoCopy
218+
displayName={info.displayName}
219+
version={info.version}
220+
/>
221+
}
215222
buttonValue={info.displayName}
216223
largeDesktopBorderRadius={true}
217224
buttonSubLabel={{ label: offsetCopy }}
@@ -223,13 +230,44 @@ function LabwareItem({
223230
)
224231
}
225232

233+
function LabwareInfoCopy({
234+
displayName,
235+
version,
236+
}: {
237+
displayName: LwGeometryDetails['displayName']
238+
version: LwGeometryDetails['version']
239+
}): JSX.Element {
240+
const { t } = useTranslation('labware_position_check')
241+
const isOnDevice = useSelector(getIsOnDevice)
242+
const nameString = isOnDevice ? truncateString(displayName, 40) : displayName
243+
244+
return (
245+
<Flex css={LABWARE_COPY_CONTAINER_STYLE}>
246+
<StyledText
247+
desktopStyle="bodyDefaultSemiBold"
248+
oddStyle="level4HeaderSemiBold"
249+
>
250+
{nameString}
251+
</StyledText>
252+
<StyledText desktopStyle="bodyDefaultRegular" oddStyle="bodyTextRegular">
253+
{t('version_number', { version })}
254+
</StyledText>
255+
</Flex>
256+
)
257+
}
258+
226259
const CONTENT_CONTAINER_STYLE = css`
227260
width: 100%;
228261
grid-gap: ${SPACING.spacing24};
229262
justify-content: ${JUSTIFY_SPACE_BETWEEN};
230263
align-items: ${ALIGN_CENTER};
231264
`
232265

266+
const LABWARE_COPY_CONTAINER_STYLE = css`
267+
gap: ${SPACING.spacing8};
268+
align-items: ${ALIGN_CENTER};
269+
`
270+
233271
const TEXT_CONTAINER_STYLE = css`
234272
width: 100%;
235273
flex-grow: 1;

app/src/redux/protocol-runs/types/lpc/labware.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export interface ConflictTimestampInfo {
4949
export interface LwGeometryDetails {
5050
id: string
5151
displayName: string
52+
version: number
5253
defaultOffsetDetails: DefaultOffsetDetails
5354
locationSpecificOffsetDetails: LocationSpecificOffsetDetails[]
5455
}

0 commit comments

Comments
 (0)