Skip to content

Commit 0832c04

Browse files
authored
fix(components): fix storybook deck configurator (#14038)
* fix(components): fix storybook deck configurator
1 parent fcbe7f5 commit 0832c04

File tree

3 files changed

+66
-44
lines changed

3 files changed

+66
-44
lines changed

components/src/hardware-sim/BaseDeck/BaseDeck.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const BaseDeck: Story = {
5151
args: {
5252
robotType: FLEX_ROBOT_TYPE,
5353
deckConfig: EXTENDED_DECK_CONFIG_FIXTURE,
54-
labwareLocations: [
54+
labwareOnDeck: [
5555
{
5656
labwareLocation: { slotName: 'C2' },
5757
definition: fixture_96_plate as LabwareDefinition2,
@@ -61,7 +61,7 @@ export const BaseDeck: Story = {
6161
definition: fixture_tiprack_1000_ul as LabwareDefinition2,
6262
},
6363
],
64-
moduleLocations: [
64+
modulesOnDeck: [
6565
{
6666
moduleLocation: { slotName: 'B1' },
6767
moduleModel: THERMOCYCLER_MODULE_V2,
Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import * as React from 'react'
2-
import { v4 as uuidv4 } from 'uuid'
32

43
import {
5-
STAGING_AREA_LOAD_NAME,
6-
STANDARD_SLOT_LOAD_NAME,
7-
TRASH_BIN_LOAD_NAME,
8-
WASTE_CHUTE_LOAD_NAME,
4+
SINGLE_CENTER_SLOT_FIXTURE,
5+
SINGLE_LEFT_SLOT_FIXTURE,
6+
STAGING_AREA_RIGHT_SLOT_FIXTURE,
7+
TRASH_BIN_ADAPTER_FIXTURE,
8+
WASTE_CHUTE_RIGHT_ADAPTER_COVERED_FIXTURE,
99
} from '@opentrons/shared-data'
1010

1111
import { DeckConfigurator } from '.'
1212

1313
import type { Story, Meta } from '@storybook/react'
14-
import type { Fixture } from '@opentrons/shared-data'
14+
import type { CutoutConfig } from '@opentrons/shared-data'
1515

1616
export default {
1717
title: 'Library/Molecules/Simulation/DeckConfigurator',
@@ -20,62 +20,68 @@ export default {
2020
const Template: Story<React.ComponentProps<typeof DeckConfigurator>> = args => (
2121
<DeckConfigurator {...args} />
2222
)
23-
const deckConfig: Fixture[] = [
23+
const deckConfig: CutoutConfig[] = [
2424
{
25-
fixtureLocation: 'cutoutA1',
26-
loadName: STANDARD_SLOT_LOAD_NAME,
27-
fixtureId: uuidv4(),
25+
cutoutId: 'cutoutA1',
26+
cutoutFixtureId: SINGLE_LEFT_SLOT_FIXTURE,
2827
},
2928
{
30-
fixtureLocation: 'cutoutB1',
31-
loadName: STANDARD_SLOT_LOAD_NAME,
32-
fixtureId: uuidv4(),
29+
cutoutId: 'cutoutB1',
30+
cutoutFixtureId: SINGLE_LEFT_SLOT_FIXTURE,
3331
},
3432
{
35-
fixtureLocation: 'cutoutC1',
36-
loadName: STANDARD_SLOT_LOAD_NAME,
37-
fixtureId: uuidv4(),
33+
cutoutId: 'cutoutC1',
34+
cutoutFixtureId: SINGLE_LEFT_SLOT_FIXTURE,
3835
},
3936
{
40-
fixtureLocation: 'cutoutD1',
41-
loadName: STANDARD_SLOT_LOAD_NAME,
42-
fixtureId: uuidv4(),
37+
cutoutId: 'cutoutD1',
38+
cutoutFixtureId: SINGLE_LEFT_SLOT_FIXTURE,
4339
},
4440
{
45-
fixtureLocation: 'cutoutA3',
46-
loadName: TRASH_BIN_LOAD_NAME,
47-
fixtureId: uuidv4(),
41+
cutoutFixtureId: SINGLE_CENTER_SLOT_FIXTURE,
42+
cutoutId: 'cutoutA2',
4843
},
4944
{
50-
fixtureLocation: 'cutoutB3',
51-
loadName: STANDARD_SLOT_LOAD_NAME,
52-
fixtureId: uuidv4(),
45+
cutoutFixtureId: SINGLE_CENTER_SLOT_FIXTURE,
46+
cutoutId: 'cutoutB2',
5347
},
5448
{
55-
fixtureLocation: 'cutoutC3',
56-
loadName: STAGING_AREA_LOAD_NAME,
57-
fixtureId: uuidv4(),
49+
cutoutFixtureId: SINGLE_CENTER_SLOT_FIXTURE,
50+
cutoutId: 'cutoutC2',
5851
},
5952
{
60-
fixtureLocation: 'cutoutD3',
61-
loadName: WASTE_CHUTE_LOAD_NAME,
62-
fixtureId: uuidv4(),
53+
cutoutFixtureId: SINGLE_CENTER_SLOT_FIXTURE,
54+
cutoutId: 'cutoutD2',
55+
},
56+
{
57+
cutoutId: 'cutoutA3',
58+
cutoutFixtureId: TRASH_BIN_ADAPTER_FIXTURE,
59+
},
60+
{
61+
cutoutId: 'cutoutB3',
62+
cutoutFixtureId: STAGING_AREA_RIGHT_SLOT_FIXTURE,
63+
},
64+
{
65+
cutoutId: 'cutoutC3',
66+
cutoutFixtureId: STAGING_AREA_RIGHT_SLOT_FIXTURE,
67+
},
68+
{
69+
cutoutId: 'cutoutD3',
70+
cutoutFixtureId: WASTE_CHUTE_RIGHT_ADAPTER_COVERED_FIXTURE,
6371
},
6472
]
6573

6674
export const Default = Template.bind({})
6775
Default.args = {
6876
deckConfig,
69-
handleClickAdd: fixtureLocation => console.log(`add at ${fixtureLocation}`),
70-
handleClickRemove: fixtureLocation =>
71-
console.log(`remove at ${fixtureLocation}`),
77+
handleClickAdd: cutoutId => console.log(`add at ${cutoutId}`),
78+
handleClickRemove: cutoutId => console.log(`remove at ${cutoutId}`),
7279
}
7380

7481
export const ReadOnly = Template.bind({})
7582
ReadOnly.args = {
7683
deckConfig,
77-
handleClickAdd: fixtureLocation => console.log(`add at ${fixtureLocation}`),
78-
handleClickRemove: fixtureLocation =>
79-
console.log(`remove at ${fixtureLocation}`),
84+
handleClickAdd: cutoutId => console.log(`add at ${cutoutId}`),
85+
handleClickRemove: cutoutId => console.log(`remove at ${cutoutId}`),
8086
readOnly: true,
8187
}

components/src/hooks/useSelectDeckLocation/SelectDeckLocation.stories.tsx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,49 @@ import { DeckLocationSelect as DeckLocationSelectComponent } from './'
33
import {
44
FLEX_ROBOT_TYPE,
55
getDeckDefFromRobotType,
6+
OT2_ROBOT_TYPE,
67
} from '@opentrons/shared-data'
78

89
import type { Meta, StoryObj } from '@storybook/react'
10+
import type { RobotType } from '@opentrons/shared-data'
911

1012
const meta: Meta<React.ComponentProps<typeof DeckLocationSelectComponent>> = {
1113
component: DeckLocationSelectComponent,
1214
title: 'Library/Molecules/Simulation/SelectDeckLocation',
1315
} as Meta
1416

1517
export default meta
16-
type Story = StoryObj<{ disabledSlotNames: string[] }>
18+
type Story = StoryObj<{ disabledSlotNames: string[]; robotType: RobotType }>
1719

18-
export const DeckLocationSelect: Story = {
20+
export const FlexDeckLocationSelect: Story = {
1921
render: args => {
2022
return <Wrapper {...args} />
2123
},
2224
args: {
2325
disabledSlotNames: ['A2'],
26+
robotType: FLEX_ROBOT_TYPE,
2427
},
2528
}
2629

27-
function Wrapper(props: { disabledSlotNames: string[] }): JSX.Element {
30+
export const OT2DeckLocationSelect: Story = {
31+
render: args => {
32+
return <Wrapper {...args} />
33+
},
34+
args: {
35+
disabledSlotNames: ['2'],
36+
robotType: OT2_ROBOT_TYPE,
37+
},
38+
}
39+
40+
function Wrapper(props: {
41+
disabledSlotNames: string[]
42+
robotType: RobotType
43+
}): JSX.Element {
2844
const [selectedLocation, setSelectedLocation] = React.useState({
29-
slotName: 'A1',
45+
slotName: props.robotType === FLEX_ROBOT_TYPE ? 'A1' : '1',
3046
})
3147

32-
const deckDef = getDeckDefFromRobotType(FLEX_ROBOT_TYPE)
48+
const deckDef = getDeckDefFromRobotType(props.robotType)
3349
return (
3450
<DeckLocationSelectComponent
3551
{...{ selectedLocation, setSelectedLocation, deckDef }}

0 commit comments

Comments
 (0)