-
Notifications
You must be signed in to change notification settings - Fork 175
/
DeckMapContent.stories.tsx
157 lines (148 loc) · 4.02 KB
/
DeckMapContent.stories.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import * as React from 'react'
import { css } from 'styled-components'
import { DeckMapContent } from '.'
import { Box, RESPONSIVENESS, BORDERS } from '@opentrons/components'
import type { Meta, StoryObj } from '@storybook/react'
import {
FLEX_ROBOT_TYPE,
OT2_ROBOT_TYPE,
fixture96Plate,
fixtureTiprack1000ul,
HEATERSHAKER_MODULE_V1,
MAGNETIC_BLOCK_V1,
TEMPERATURE_MODULE_V2,
THERMOCYCLER_MODULE_V2,
} from '@opentrons/shared-data'
import type { ModuleLocation, LabwareDefinition2 } from '@opentrons/shared-data'
import {
EXTENDED_DECK_CONFIG_FIXTURE,
STANDARD_SLOT_DECK_CONFIG_FIXTURE,
WASTE_CHUTE_DECK_CONFIG_FIXTURE,
} from './__fixtures__'
import { TwoColumn } from './TwoColumn'
import { StandInContent } from './story-utils/StandIn'
const DEFAULT_MODULES_ON_DECK = [
{
moduleLocation: { slotName: 'B1' },
moduleModel: THERMOCYCLER_MODULE_V2,
nestedLabwareDef: fixture96Plate as LabwareDefinition2,
innerProps: { lidMotorState: 'open' },
},
{
moduleLocation: { slotName: 'D1' },
moduleModel: TEMPERATURE_MODULE_V2,
nestedLabwareDef: fixture96Plate as LabwareDefinition2,
},
{
moduleLocation: { slotName: 'B3' },
moduleModel: HEATERSHAKER_MODULE_V1,
nestedLabwareDef: fixture96Plate as LabwareDefinition2,
},
{
moduleLocation: { slotName: 'D2' },
moduleModel: MAGNETIC_BLOCK_V1,
nestedLabwareDef: fixture96Plate as LabwareDefinition2,
},
]
const DEFAULT_LABWARE_ON_DECK = [
{
labwareLocation: { slotName: 'C2' },
definition: fixture96Plate as LabwareDefinition2,
},
{
labwareLocation: { slotName: 'C3' },
definition: fixtureTiprack1000ul as LabwareDefinition2,
},
]
const CONSOLE_LOG_ON_SELECT = (location: ModuleLocation): void => {
console.log(`selected location is ${location?.slotName}`)
}
const meta: Meta<React.ComponentProps<typeof DeckMapContent>> = {
title: 'App/Molecules/InterventionModal/DeckMapContent',
component: DeckMapContent,
argTypes: {
robotType: {
control: {
type: 'select',
},
options: [OT2_ROBOT_TYPE, FLEX_ROBOT_TYPE],
default: FLEX_ROBOT_TYPE,
},
kind: {
control: {
type: 'select',
},
options: ['intervention', 'deck-config'],
},
setSelectedLocation: {
control: {
type: 'select',
},
options: ['print-to-console'],
mapping: {
'print-to-console': CONSOLE_LOG_ON_SELECT,
},
if: { arg: 'kind', eq: 'deck-config' },
},
deckConfig: {
control: {
type: 'select',
},
options: ['staging-area', 'waste-chute', 'standard'],
mapping: {
'staging-area': EXTENDED_DECK_CONFIG_FIXTURE,
'waste-chute': WASTE_CHUTE_DECK_CONFIG_FIXTURE,
standard: STANDARD_SLOT_DECK_CONFIG_FIXTURE,
},
if: { arg: 'kind', eq: 'intervention' },
},
labwareOnDeck: {
if: { arg: 'kind', eq: 'intervention' },
},
modulesOnDeck: {
if: { arg: 'kind', eq: 'intervention' },
},
highlightLabwareEventuallyIn: {
if: { arg: 'kind', eq: 'intervention' },
},
},
decorators: [
Story => (
<Box
css={css`
border: 4px solid #000000;
border-radius: ${BORDERS.borderRadius8};
max-width: 47rem;
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
max-width: 62rem;
max-height: 33.5rem;
}
`}
>
<TwoColumn>
<StandInContent />
<Story />
</TwoColumn>
</Box>
),
],
}
export default meta
type Story = StoryObj<typeof DeckMapContent>
export const InterventionMap: Story = {
args: {
kind: 'intervention',
robotType: FLEX_ROBOT_TYPE,
deckConfig: EXTENDED_DECK_CONFIG_FIXTURE,
labwareOnDeck: DEFAULT_LABWARE_ON_DECK,
modulesOnDeck: DEFAULT_MODULES_ON_DECK,
highlightLabwareEventuallyIn: ['thermocyclerModuleV2', 'C3'],
},
}
export const DeckConfigMap: Story = {
args: {
kind: 'deck-config',
robotType: FLEX_ROBOT_TYPE,
setSelectedLocation: CONSOLE_LOG_ON_SELECT,
},
}