Skip to content

Commit

Permalink
fix(protocol-designer): dropdown option text refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Dec 19, 2024
1 parent 5030e9d commit cda3432
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
2 changes: 0 additions & 2 deletions components/src/hardware-sim/DeckConfigurator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import { MagneticBlockFixture } from './MagneticBlockFixture'
import { ThermocyclerFixture } from './ThermocyclerFixture'
import { AbsorbanceReaderFixture } from './AbsorbanceReaderFixture'

export * from './constants'

interface DeckConfiguratorProps {
deckConfig: DeckConfiguration
handleClickAdd: (cutoutId: CutoutId) => void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('MaterialsListModal', () => {
lidTargetTemp: null,
lidOpen: false,
},
slot: 'span7_8_10_11',
slot: '7',
type: 'thermocyclerModuleType',
},
] as ModuleOnDeck[]
Expand Down
8 changes: 3 additions & 5 deletions protocol-designer/src/ui/labware/__tests__/selectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
THERMOCYCLER_MODULE_TYPE,
THERMOCYCLER_MODULE_V1,
} from '@opentrons/shared-data'
import { SPAN7_8_10_11_SLOT } from '../../../constants'
import {
getDisposalOptions,
getLabwareOptions,
Expand All @@ -23,7 +22,6 @@ import {
} from '@opentrons/shared-data/labware/fixtures/2'

import type { LabwareEntities } from '@opentrons/step-generation'
import type { InitialDeckSetup } from '../../../step-forms'

describe('labware selectors', () => {
let names: Record<string, string>
Expand Down Expand Up @@ -161,7 +159,7 @@ describe('labware selectors', () => {
...tipracks,
...otherLabware,
}
const initialDeckSetup: InitialDeckSetup = {
const initialDeckSetup = {
labware: labwareEntities,
modules: {},
pipettes: {},
Expand Down Expand Up @@ -203,7 +201,7 @@ describe('labware selectors', () => {
},
}
const labwareEntities = { ...trash, ...labware }
const initialDeckSetup: InitialDeckSetup = {
const initialDeckSetup = {
pipettes: {},
labware: {
...trash,
Expand Down Expand Up @@ -275,7 +273,7 @@ describe('labware selectors', () => {
},
}
const labwareEntities = { ...trash, ...labware }
const initialDeckSetup: InitialDeckSetup = {
const initialDeckSetup = {
pipettes: {},
labware: {
...labware,
Expand Down
14 changes: 6 additions & 8 deletions protocol-designer/src/ui/labware/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { createSelector } from 'reselect'
import mapValues from 'lodash/mapValues'
import reduce from 'lodash/reduce'
import {
WASTE_CHUTE_DISPLAY_NAME,
TRASH_BIN_DISPLAY_NAME,
} from '@opentrons/components'
import {
FLEX_ROBOT_TYPE,
OT2_ROBOT_TYPE,
Expand All @@ -27,6 +23,8 @@ import type {
SavedStepFormState,
} from '../../step-forms'

const TRASH_BIN = 'Trash bin'

export const getLabwareNicknamesById: Selector<
Record<string, string>
> = createSelector(
Expand All @@ -44,8 +42,8 @@ export const _sortLabwareDropdownOptions = (
): DropdownOption[] =>
options.sort((a, b) => {
// special case for trash (always at the bottom of the list)
if (a.name === TRASH_BIN_DISPLAY_NAME) return 1
if (b.name === TRASH_BIN_DISPLAY_NAME) return -1
if (a.name === TRASH_BIN) return 1
if (b.name === TRASH_BIN) return -1
// sort by name everything else by name
return a.name.localeCompare(b.name)
})
Expand Down Expand Up @@ -228,7 +226,7 @@ export const getWasteChuteOption: Selector<DropdownOption | null> = createSelect
const wasteChuteOption: DropdownOption | null =
wasteChuteEntity != null
? {
name: WASTE_CHUTE_DISPLAY_NAME,
name: 'Waste chute',
value: wasteChuteEntity.id,
}
: null
Expand All @@ -252,7 +250,7 @@ export const getDisposalOptions = createSelector(
? [
...acc,
{
name: TRASH_BIN_DISPLAY_NAME,
name: TRASH_BIN,
value: additionalEquipment.id ?? '',
},
]
Expand Down
3 changes: 1 addition & 2 deletions protocol-designer/src/ui/labware/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
RobotType,
THERMOCYCLER_MODULE_TYPE,
} from '@opentrons/shared-data'
import { WASTE_CHUTE_DISPLAY_NAME } from '@opentrons/components'
import type { InitialDeckSetup, SavedStepFormState } from '../../step-forms'

function resolveSlotLocation(
Expand Down Expand Up @@ -58,7 +57,7 @@ export function getLabwareLatestSlot(
hasWasteChute &&
(initialSlot === 'D3' || moveLabwareStep?.newLocation === 'D3')
) {
return WASTE_CHUTE_DISPLAY_NAME
return 'Waste chute'
}

if (moveLabwareStep?.newLocation != null) {
Expand Down

0 comments on commit cda3432

Please sign in to comment.