Skip to content

Commit f833e59

Browse files
authored
refactor(components, app, shared-data): move ProtocolDeck and utils to shared directories (#18949)
I moved `ProtocolDeck` to `components` and all utils it uses to `shared-data` so that Protocol Library can have an up to date `@opentrons/components` that supports Flex stacker.
1 parent 525512a commit f833e59

39 files changed

+194
-270
lines changed

app/src/molecules/LabwareStackContents/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { getIsOnDevice } from '/app/redux/config'
1717

1818
import type { Dispatch, SetStateAction } from 'react'
1919
import type { StyleProps } from '@opentrons/components'
20-
import type { LabwareInStack } from '/app/transformations/commands'
20+
import type { LabwareInStack } from '@opentrons/shared-data'
2121

2222
const HIDE_SCROLLBAR = css`
2323
::-webkit-scrollbar {

app/src/molecules/LiquidDetailCard/LiquidCardList.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ import { getIsOnDevice } from '/app/redux/config'
99
import { LiquidDetailCard } from './LiquidDetailCard'
1010

1111
import type { Dispatch, SetStateAction } from 'react'
12-
import type { LabwareDefinition, ParsedLiquid } from '@opentrons/shared-data'
13-
import type { LabwareByLiquidId } from '/app/transformations/commands'
12+
import type {
13+
LabwareByLiquidId,
14+
LabwareDefinition,
15+
ParsedLiquid,
16+
} from '@opentrons/shared-data'
1417

1518
interface LiquidCardListProps {
1619
selectedLabwareDefinition: LabwareDefinition

app/src/organisms/Desktop/ChooseProtocolSlideout/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
NO_WRAP,
3030
OVERFLOW_WRAP_ANYWHERE,
3131
PrimaryButton,
32+
ProtocolDeck,
3233
SecondaryButton,
3334
SPACING,
3435
Tooltip,
@@ -52,7 +53,6 @@ import { useTrackCreateProtocolRunEvent } from '/app/organisms/Desktop/Devices/h
5253
import { getAnalysisStatus } from '/app/organisms/Desktop/ProtocolsLanding/utils'
5354
import { LegacyApplyHistoricOffsets } from '/app/organisms/LegacyApplyHistoricOffsets'
5455
import { useOffsetCandidatesForAnalysis } from '/app/organisms/LegacyApplyHistoricOffsets/hooks/useOffsetCandidatesForAnalysis'
55-
import { ProtocolDeck } from '/app/organisms/ProtocolDeck'
5656
import { useRobotType } from '/app/redux-resources/robots'
5757
import { OPENTRONS_USB } from '/app/redux/discovery'
5858
import { getStoredProtocols } from '/app/redux/protocol-storage'

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/LabwareListItem.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ import {
2727
} from '@opentrons/components'
2828
import { useCreateLiveCommandMutation } from '@opentrons/react-api-client'
2929
import {
30+
getLabwareLiquidRenderInfoFromStack,
3031
getLabwareViewBox,
32+
getModuleFromStack,
3133
getModuleType,
3234
HEATERSHAKER_MODULE_TYPE,
3335
MAGNETIC_MODULE_TYPE,
@@ -36,27 +38,21 @@ import {
3638
} from '@opentrons/shared-data'
3739

3840
import { ToggleButton } from '/app/atoms/buttons'
39-
import {
40-
getLabwareLiquidRenderInfoFromStack,
41-
getModuleFromStack,
42-
} from '/app/transformations/commands'
4341

4442
import { SecureLabwareModal } from './SecureLabwareModal'
4543

4644
import type { MouseEvent } from 'react'
4745
import type {
4846
HeaterShakerCloseLatchCreateCommand,
4947
HeaterShakerOpenLatchCreateCommand,
50-
LabwareDefinition,
51-
ModuleType,
52-
} from '@opentrons/shared-data'
53-
import type { ModuleRenderInfoForProtocol } from '/app/resources/runs'
54-
import type {
5548
LabwareByLiquidId,
49+
LabwareDefinition,
5650
LabwareDefinitionsByURI,
5751
LabwareInStack,
52+
ModuleType,
5853
StackItem,
59-
} from '/app/transformations/commands'
54+
} from '@opentrons/shared-data'
55+
import type { ModuleRenderInfoForProtocol } from '/app/resources/runs'
6056
import type { ModuleTypesThatRequireExtraAttention } from '../utils/getModuleTypesThatRequireExtraAttention'
6157

6258
interface LabwareListItemProps {

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/OffDeckLabwareList.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ import {
1111
import { LabwareListItem } from './LabwareListItem'
1212

1313
import type { Dispatch, SetStateAction } from 'react'
14-
import type {
15-
LabwareDefinitionsByURI,
16-
StackItem,
17-
} from '/app/transformations/commands'
14+
import type { LabwareDefinitionsByURI, StackItem } from '@opentrons/shared-data'
1815

1916
interface OffDeckLabwareListProps {
2017
labwareItems: StackItem[]

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/SetupLabwareList.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,21 @@ import {
88
SPACING,
99
StyledText,
1010
} from '@opentrons/components'
11-
1211
import {
1312
getLabwareInfoByLiquidId,
1413
getStackedItemsOnStartingDeck,
1514
getStacksWithLabware,
16-
} from '/app/transformations/commands'
15+
} from '@opentrons/shared-data'
1716

1817
import { LabwareListItem } from './LabwareListItem'
1918
import { SlotDetailModal } from './SlotDetailModal'
2019

2120
import type {
2221
CompletedProtocolAnalysis,
2322
ProtocolAnalysisOutput,
23+
StackItem,
2424
} from '@opentrons/shared-data'
2525
import type { ModuleRenderInfoForProtocol } from '/app/resources/runs'
26-
import type { StackItem } from '/app/transformations/commands'
2726
import type { ModuleTypesThatRequireExtraAttention } from '../utils/getModuleTypesThatRequireExtraAttention'
2827

2928
interface SetupLabwareListProps {

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@ import {
1212
import {
1313
FLEX_ROBOT_TYPE,
1414
FLEX_STACKER_MODULE_TYPE,
15-
getModuleType,
16-
getSimplestDeckConfigForProtocol,
17-
THERMOCYCLER_MODULE_V1,
18-
} from '@opentrons/shared-data'
19-
20-
import { getStandardDeckViewLayerBlockList } from '/app/local-resources/deck_configuration'
21-
import { getWellFillFromLabwareId } from '/app/organisms/ProtocolDeck'
22-
import {
2315
getLabwareDefinitionsByURIForProtocol,
2416
getLabwareInfoByLiquidId,
2517
getLabwareOnDeck,
18+
getModuleType,
19+
getSimplestDeckConfigForProtocol,
2620
getStackedItemsOnStartingDeck,
2721
getStacksOnModules,
2822
getTopLabwareFromStack,
29-
} from '/app/transformations/commands'
23+
getWellFillFromLabwareId,
24+
THERMOCYCLER_MODULE_V1,
25+
} from '@opentrons/shared-data'
26+
27+
import { getStandardDeckViewLayerBlockList } from '/app/local-resources/deck_configuration'
3028

3129
import { LabwareInfoOverlay } from '../LabwareInfoOverlay'
3230
import { OffDeckLabwareList } from './OffDeckLabwareList'
@@ -36,8 +34,8 @@ import type { LabwareOnDeck } from '@opentrons/components'
3634
import type {
3735
CompletedProtocolAnalysis,
3836
ProtocolAnalysisOutput,
37+
StackItem,
3938
} from '@opentrons/shared-data'
40-
import type { StackItem } from '/app/transformations/commands'
4139

4240
interface SetupLabwareMapProps {
4341
runId: string

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/SlotDetailModal.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,27 @@ import {
1919
TYPOGRAPHY,
2020
} from '@opentrons/components'
2121
import {
22+
getLabwareDefinitionsByURIForProtocol,
2223
getLabwareViewBox,
24+
getWellFillFromLabwareId,
2325
parseLiquidsInLoadOrder,
2426
} from '@opentrons/shared-data'
2527

2628
import { LabwareStackContents } from '/app/molecules/LabwareStackContents'
2729
import { LiquidCardList } from '/app/molecules/LiquidDetailCard'
28-
import { getWellFillFromLabwareId } from '/app/organisms/ProtocolDeck'
2930
import {
3031
getDisabledWellGroupForLiquidId,
3132
getLiquidsByIdForLabware,
3233
getWellGroupForLiquidId,
3334
} from '/app/transformations/analysis'
34-
import { getLabwareDefinitionsByURIForProtocol } from '/app/transformations/commands'
3535

3636
import type {
3737
CompletedProtocolAnalysis,
38-
ProtocolAnalysisOutput,
39-
} from '@opentrons/shared-data'
40-
import type {
4138
LabwareByLiquidId,
4239
LabwareInStack,
40+
ProtocolAnalysisOutput,
4341
StackItem,
44-
} from '/app/transformations/commands'
42+
} from '@opentrons/shared-data'
4543

4644
interface SlotDetailModalProps {
4745
closeModal: () => void

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareList.test.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,28 @@ import { MemoryRouter } from 'react-router-dom'
22
import { screen } from '@testing-library/react'
33
import { beforeEach, describe, it, vi } from 'vitest'
44

5-
import { multiple_tipacks_with_tc } from '@opentrons/shared-data'
5+
import {
6+
getStacksWithLabware,
7+
multiple_tipacks_with_tc,
8+
} from '@opentrons/shared-data'
69

710
import { renderWithProviders } from '/app/__testing-utils__'
811
import { i18n } from '/app/i18n'
9-
import { getStacksWithLabware } from '/app/transformations/commands'
1012

1113
import { LabwareListItem } from '../LabwareListItem'
1214
import { SetupLabwareList } from '../SetupLabwareList'
1315

1416
import type { ComponentProps } from 'react'
1517
import type { CompletedProtocolAnalysis } from '@opentrons/shared-data'
1618

17-
vi.mock('/app/transformations/commands')
1819
vi.mock('../LabwareListItem')
19-
20+
vi.mock('@opentrons/shared-data', async importOriginal => {
21+
const actual = await importOriginal<typeof getStacksWithLabware>()
22+
return {
23+
...actual,
24+
getStacksWithLabware: vi.fn(),
25+
}
26+
})
2027
const protocolWithTC = (multiple_tipacks_with_tc as unknown) as CompletedProtocolAnalysis
2128

2229
const render = (props: ComponentProps<typeof SetupLabwareList>) => {

app/src/organisms/Desktop/ProtocolDetails/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
OVERFLOW_WRAP_ANYWHERE,
3434
POSITION_RELATIVE,
3535
PrimaryButton,
36+
ProtocolDeck,
3637
SecondaryButton,
3738
SIZE_1,
3839
SIZE_5,
@@ -53,7 +54,6 @@ import {
5354
import { getTopPortalEl } from '/app/App/portal'
5455
import { Divider } from '/app/atoms/structure'
5556
import { ChooseRobotToRunProtocolSlideout } from '/app/organisms/Desktop/ChooseRobotToRunProtocolSlideout'
56-
import { ProtocolDeck } from '/app/organisms/ProtocolDeck'
5757
import {
5858
ANALYTICS_PROTOCOL_PROCEED_TO_RUN,
5959
useTrackEvent,

0 commit comments

Comments
 (0)