Skip to content

Commit 59814e6

Browse files
authored
fix(app): support special cased slot name copy (#16823)
Closes RQA-3585
1 parent 7cbee8e commit 59814e6

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"tc_starting_extended_profile_cycle": "{{repetitions}} repetitions of the following steps:",
7979
"tc_starting_profile": "Running thermocycler profile with {{stepCount}} steps:",
8080
"touch_tip": "Touching tip",
81+
"trash_bin": "Trash Bin",
8182
"trash_bin_in_slot": "Trash Bin in {{slot_name}}",
8283
"turning_rail_lights_off": "Turning rail lights off",
8384
"turning_rail_lights_on": "Turning rail lights on",

app/src/local-resources/labware/utils/__tests__/getLabwareDisplayLocation.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,24 @@ describe('getLabwareDisplayLocation with translations', () => {
137137
screen.getByText('Slot C1')
138138
})
139139

140+
it('should special case the slotName if it contains "waste chute"', () => {
141+
render({
142+
location: { slotName: 'gripperWasteChute' },
143+
params: { ...defaultParams, detailLevel: 'slot-only' },
144+
})
145+
146+
screen.getByText('Waste Chute')
147+
})
148+
149+
it('should special case the slotName if it contains "trash bin"', () => {
150+
render({
151+
location: { slotName: 'trashBin' },
152+
params: { ...defaultParams, detailLevel: 'slot-only' },
153+
})
154+
155+
screen.getByText('Trash Bin')
156+
})
157+
140158
it('should handle an adapter on module location when the detail level is full', () => {
141159
const mockLoadedLabwares = [
142160
{

app/src/local-resources/labware/utils/getLabwareDisplayLocation.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
getOccludedSlotCountForModule,
55
THERMOCYCLER_MODULE_V1,
66
THERMOCYCLER_MODULE_V2,
7+
TRASH_BIN_FIXTURE,
8+
WASTE_CHUTE_ADDRESSABLE_AREAS,
79
} from '@opentrons/shared-data'
810
import { getLabwareLocation } from './getLabwareLocation'
911

@@ -12,6 +14,7 @@ import type {
1214
LocationSlotOnlyParams,
1315
LocationFullParams,
1416
} from './getLabwareLocation'
17+
import type { AddressableAreaName } from '@opentrons/shared-data'
1518

1619
export interface DisplayLocationSlotOnlyParams extends LocationSlotOnlyParams {
1720
t: TFunction
@@ -47,7 +50,8 @@ export function getLabwareDisplayLocation(
4750
}
4851
// Simple slot location
4952
else if (moduleModel == null && adapterName == null) {
50-
return isOnDevice ? slotName : t('slot', { slot_name: slotName })
53+
const validatedSlotCopy = handleSpecialSlotNames(slotName, t)
54+
return isOnDevice ? validatedSlotCopy.odd : validatedSlotCopy.desktop
5155
}
5256
// Module location without adapter
5357
else if (moduleModel != null && adapterName == null) {
@@ -91,3 +95,20 @@ export function getLabwareDisplayLocation(
9195
return ''
9296
}
9397
}
98+
99+
// Sometimes we don't want to show the actual slotName, so we special case the text here.
100+
function handleSpecialSlotNames(
101+
slotName: string,
102+
t: TFunction
103+
): { odd: string; desktop: string } {
104+
if (WASTE_CHUTE_ADDRESSABLE_AREAS.includes(slotName as AddressableAreaName)) {
105+
return { odd: t('waste_chute'), desktop: t('waste_chute') }
106+
} else if (slotName === TRASH_BIN_FIXTURE) {
107+
return { odd: t('trash_bin'), desktop: t('trash_bin') }
108+
} else {
109+
return {
110+
odd: slotName,
111+
desktop: t('slot', { slot_name: slotName }),
112+
}
113+
}
114+
}

shared-data/js/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ export const SINGLE_RIGHT_SLOT_FIXTURE: 'singleRightSlot' = 'singleRightSlot'
513513
export const STAGING_AREA_RIGHT_SLOT_FIXTURE: 'stagingAreaRightSlot' =
514514
'stagingAreaRightSlot'
515515

516+
export const TRASH_BIN_FIXTURE: 'trashBin' = 'trashBin'
516517
export const TRASH_BIN_ADAPTER_FIXTURE: 'trashBinAdapter' = 'trashBinAdapter'
517518

518519
export const WASTE_CHUTE_RIGHT_ADAPTER_COVERED_FIXTURE: 'wasteChuteRightAdapterCovered' =

0 commit comments

Comments
 (0)