Skip to content

Commit

Permalink
use getFixtureDisplayName in device details fixture list
Browse files Browse the repository at this point in the history
  • Loading branch information
brenthagen committed Oct 3, 2023
1 parent 3fd5d16 commit 97f1a57
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
3 changes: 0 additions & 3 deletions app/src/assets/localization/en/device_details.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@
"set_temperature": "Set temperature",
"shake_speed": "shake speed",
"shaker": "Shaker",
"staging_area_slot": "Staging area slot",
"status": "Status",
"target_speed": "Target: {{speed}} rpm",
"target_temp": "Target: {{temp}} °C",
Expand All @@ -155,7 +154,6 @@
"this_robot_will_restart_with_update": "<block>This robot has to restart to update its software. Restarting will immediately stop the current run or calibration.</block><block>Do you want to update now anyway?</block>",
"tip_pickup_drop": "Tip Pickup / Drop",
"to_run_protocol_go_to_protocols_page": "To run a protocol on this robot, import a protocol on the <navlink>Protocols page</navlink>",
"trash": "Trash",
"update_now": "Update now",
"updating_firmware": "Updating firmware...",
"usb_port_not_connected": "usb not connected",
Expand All @@ -164,7 +162,6 @@
"view_pipette_setting": "Pipette Settings",
"view_run_record": "View protocol run record",
"view": "View",
"waste_chute": "Waste chute",
"welcome_modal_description": "A place to run protocols, manage your instruments, and view robot status.",
"welcome_to_your_dashboard": "Welcome to your dashboard!",
"yes_update_now": "Yes, update now"
Expand Down
30 changes: 12 additions & 18 deletions app/src/organisms/DeviceDetailsDeckConfiguration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,23 @@ import {
BORDERS,
COLORS,
DIRECTION_COLUMN,
SIZE_5,
SPACING,
TYPOGRAPHY,
SIZE_5,
} from '@opentrons/components'
import {
useDeckConfigurationQuery,
useUpdateDeckConfigurationMutation,
} from '@opentrons/react-api-client'
import {
getFixtureDisplayName,
STAGING_AREA_LOAD_NAME,
STANDARD_SLOT_LOAD_NAME,
TRASH_BIN_LOAD_NAME,
WASTE_CHUTE_LOAD_NAME,
} from '@opentrons/shared-data'

import { StyledText } from '../../atoms/text'

import type { FixtureLoadName } from '@opentrons/shared-data'

interface DeviceDetailsDeckConfigurationProps {
robotName: string
}
Expand Down Expand Up @@ -67,14 +65,10 @@ export function DeviceDetailsDeckConfiguration({
})
}

// TODO: replace with getFixtureDisplayName
const fixtureDisplayNameDictionary: Record<FixtureLoadName, string | null> = {
[STAGING_AREA_LOAD_NAME]: t('staging_area_slot'),
// do not display standard slot
[STANDARD_SLOT_LOAD_NAME]: null,
[TRASH_BIN_LOAD_NAME]: t('trash'),
[WASTE_CHUTE_LOAD_NAME]: t('waste_chute'),
}
// do not show standard slot in fixture display list
const fixtureDisplayList = deckConfig.filter(
fixture => fixture.loadName !== STANDARD_SLOT_LOAD_NAME
)

return (
<Flex
Expand Down Expand Up @@ -128,10 +122,8 @@ export function DeviceDetailsDeckConfiguration({
<StyledText>{t('location')}</StyledText>
<StyledText>{t('fixture')}</StyledText>
</Flex>
{deckConfig.map(fixture => {
const fixtureDisplayName =
fixtureDisplayNameDictionary[fixture.loadName]
return fixtureDisplayName != null ? (
{fixtureDisplayList.map(fixture => {
return (
<Flex
key={fixture.fixtureId}
backgroundColor={COLORS.fundamentalsBackground}
Expand All @@ -141,9 +133,11 @@ export function DeviceDetailsDeckConfiguration({
css={TYPOGRAPHY.labelRegular}
>
<StyledText>{fixture.fixtureLocation}</StyledText>
<StyledText>{fixtureDisplayName}</StyledText>
<StyledText>
{getFixtureDisplayName(fixture.loadName)}
</StyledText>
</Flex>
) : null
)
})}
</Flex>
</Flex>
Expand Down
8 changes: 7 additions & 1 deletion shared-data/js/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { STAGING_AREA_LOAD_NAME, WASTE_CHUTE_LOAD_NAME } from './constants'
import {
STAGING_AREA_LOAD_NAME,
TRASH_BIN_LOAD_NAME,
WASTE_CHUTE_LOAD_NAME,
} from './constants'
import type { FixtureLoadName } from './types'

export function getFixtureDisplayName(loadName: FixtureLoadName): string {
if (loadName === STAGING_AREA_LOAD_NAME) {
return 'Staging Area Slot'
} else if (loadName === TRASH_BIN_LOAD_NAME) {
return 'Trash Bin'
} else if (loadName === WASTE_CHUTE_LOAD_NAME) {
return 'Waste Chute'
} else {
Expand Down

0 comments on commit 97f1a57

Please sign in to comment.