diff --git a/components/src/legacy-hardware-sim/Labware.css b/components/src/legacy-hardware-sim/Labware.css deleted file mode 100644 index a5a3c3db224..00000000000 --- a/components/src/legacy-hardware-sim/Labware.css +++ /dev/null @@ -1,23 +0,0 @@ -@import '..'; - -.fallback_plate_text { - height: 100%; - width: 100%; - font-size: var(--fs-body-1); - font-style: italic; - color: gray; - display: flex; - flex-direction: column; - justify-content: space-around; - align-items: center; -} - -.labware_outline { - fill: var(--c-white); - stroke: var(--c-black); -} - -.tiprack_outline { - fill: var(--c-plate-bg); - stroke: var(--c-charcoal); -} \ No newline at end of file diff --git a/components/src/legacy-hardware-sim/LabwareNameOverlay.tsx b/components/src/legacy-hardware-sim/LabwareNameOverlay.tsx index d199e118dcb..72ffa5ab43f 100644 --- a/components/src/legacy-hardware-sim/LabwareNameOverlay.tsx +++ b/components/src/legacy-hardware-sim/LabwareNameOverlay.tsx @@ -8,6 +8,7 @@ export interface LabwareNameOverlayProps { className?: string } +/** @deprecated use LabwareDisplayName or custom RobotCoordsForeignDiv */ export function LabwareNameOverlay( props: LabwareNameOverlayProps ): JSX.Element { diff --git a/components/src/legacy-hardware-sim/ModuleViz.css b/components/src/legacy-hardware-sim/ModuleViz.css deleted file mode 100644 index 27d8941b018..00000000000 --- a/components/src/legacy-hardware-sim/ModuleViz.css +++ /dev/null @@ -1,19 +0,0 @@ -@import '..'; - -.module_viz { - rx: 6; - stroke: var(--c-plate-bg); - stroke-width: 1; - fill: var(--c-lightest-gray); -} - -.module_slot_area { - fill: transparent; - stroke: var(--c-plate-bg); - stroke-width: 2; - stroke-dasharray: 8 4; -} - -.module_slot_text { - fill: var(--c-plate-bg); -} diff --git a/components/src/legacy-hardware-sim/ModuleViz.tsx b/components/src/legacy-hardware-sim/ModuleViz.tsx deleted file mode 100644 index 5bf4f71d383..00000000000 --- a/components/src/legacy-hardware-sim/ModuleViz.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import * as React from 'react' -import styles from './ModuleViz.css' -import { getModuleVizDims, ModuleType } from '@opentrons/shared-data' - -interface Props { - x: number - y: number - orientation: 'left' | 'right' - moduleType: ModuleType -} - -export const ModuleViz = (props: Props): JSX.Element => { - const moduleType = props.moduleType - const { - xOffset, - yOffset, - xDimension, - yDimension, - childXOffset, - childYOffset, - childXDimension, - childYDimension, - } = getModuleVizDims(props.orientation, moduleType) - - return ( - - - - - ) -} diff --git a/components/src/legacy-hardware-sim/Well.css b/components/src/legacy-hardware-sim/Well.css deleted file mode 100644 index 9ab048b0a6a..00000000000 --- a/components/src/legacy-hardware-sim/Well.css +++ /dev/null @@ -1,48 +0,0 @@ -@import '@opentrons/components'; - -/* Well fill contents, the "bottom layer" */ - -.well_fill { - fill: currentColor; -} - -/* Styles for border + overlay, the "top layer" */ - -.well_border { - stroke-width: 0.4; - stroke: var(--c-black); - fill: transparent; -} - -.selected { - stroke-width: 1; - stroke: var(--c-highlight); - fill: color-mod(var(--c-highlight) alpha(20%)); -} - -.highlighted { - stroke-width: 1; - stroke: var(--c-highlight); - fill: transparent; -} - -.error { - stroke-width: 1; - stroke: var(--c-red); -} - -/* Tip-specific */ - -.tip_border { - stroke-width: 0.6; - stroke: var(--c-near-black); - fill: transparent; -} - -.empty_tip { - fill: color-mod(var(--c-charcoal) alpha(40%)); -} - -.tip_fill { - fill: var(--c-white); -} \ No newline at end of file diff --git a/components/src/legacy-hardware-sim/constants.ts b/components/src/legacy-hardware-sim/constants.ts deleted file mode 100644 index 0510e32e210..00000000000 --- a/components/src/legacy-hardware-sim/constants.ts +++ /dev/null @@ -1,15 +0,0 @@ -// @deprecated TODO: remove final usage of this in PD and replace with deck definition accessor -export const sortedSlotnames = [ - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - '10', - '11', - '12', -] diff --git a/components/src/legacy-hardware-sim/index.ts b/components/src/legacy-hardware-sim/index.ts index a258942f94f..7caf9ec14f5 100644 --- a/components/src/legacy-hardware-sim/index.ts +++ b/components/src/legacy-hardware-sim/index.ts @@ -1,4 +1,3 @@ export * from './constants' export * from './LabwareNameOverlay' -export * from './ModuleViz' // legacy PD module rendering export * from './ModuleItem' // legacy App module rendering diff --git a/protocol-designer/src/labware-defs/utils.ts b/protocol-designer/src/labware-defs/utils.ts index 8963bb8a826..d7dbe8cb71f 100644 --- a/protocol-designer/src/labware-defs/utils.ts +++ b/protocol-designer/src/labware-defs/utils.ts @@ -6,6 +6,32 @@ import { } from '@opentrons/shared-data' import { LabwareDefByDefURI } from './types' + +// require all definitions in the labware/definitions/1 directory +// require.context is webpack-specific method +const labwareSchemaV1DefsContext = require.context( + '@opentrons/shared-data/labware/definitions/1', + true, // traverse subdirectories + /\.json$/, // import filter + 'sync' // load every definition into one synchronous chunk +) +let labwareSchemaV1Defs: Readonly | null = null +function getLegacyLabwareDefs(): Readonly { + if (!labwareSchemaV1Defs) { + labwareSchemaV1Defs = labwareSchemaV1DefsContext + .keys() + .map((name: string) => labwareSchemaV1DefsContext(name)) + } + + return labwareSchemaV1Defs as Readonly +} +export function getLegacyLabwareDef( + loadName: string | null | undefined +): LabwareDefinition1 | null { + const def = getLegacyLabwareDefs().find(d => d.metadata.name === loadName) + return def || null +} + // TODO: Ian 2019-04-11 getAllDefinitions also exists (differently) in labware-library, // should reconcile differences & make a general util fn imported from shared-data // require all definitions in the labware/definitions/2 directory diff --git a/protocol-designer/src/load-file/migration/1_1_0.ts b/protocol-designer/src/load-file/migration/1_1_0.ts index 13e28d4fd87..5eb8a2e217a 100644 --- a/protocol-designer/src/load-file/migration/1_1_0.ts +++ b/protocol-designer/src/load-file/migration/1_1_0.ts @@ -4,12 +4,13 @@ import mapValues from 'lodash/mapValues' import omit from 'lodash/omit' import omitBy from 'lodash/omitBy' import flow from 'lodash/flow' -import { getLabwareV1Def, getPipetteNameSpecs } from '@opentrons/shared-data' +import { getPipetteNameSpecs } from '@opentrons/shared-data' import { FileLabware, FilePipette, ProtocolFile, } from '@opentrons/shared-data/protocol/types/schemaV1' +import { getLegacyLabwareDef } from '../../labware-defs/utils' import { FormPatch } from '../../steplist/actions' import { FormData } from '../../form-types' export interface PDMetadata { @@ -70,7 +71,7 @@ function getPipetteCapacityLegacy( } // @ts-expect-error unable to cast type string from manipulation above to type PipetteName const specs = getPipetteNameSpecs(pipetteName) - const tiprackDef = getLabwareV1Def(pipette.tiprackModel) + const tiprackDef = getLegacyLabwareDef(pipette.tiprackModel) if (specs && tiprackDef && tiprackDef.metadata.tipVolume) { return Math.min(specs.maxVolume, tiprackDef.metadata.tipVolume) diff --git a/shared-data/js/getLabware.ts b/shared-data/js/getLabware.ts index 4ed1aa26c58..74678b91885 100644 --- a/shared-data/js/getLabware.ts +++ b/shared-data/js/getLabware.ts @@ -54,15 +54,6 @@ export const PD_DO_NOT_LIST = [ 'opentrons_96_aluminumblock_nest_wellplate_100ul', ] -export function getLabwareV1Def( - labwareName: string -): LabwareDefinition1 | null | undefined { - const labware: LabwareDefinition1 | null | undefined = - // @ts-expect-error(mc, 2021-04-27): make lookup more strict or remove v1 defs entirely - definitions[labwareName] - return labware -} - export function getIsLabwareV1Tiprack(def: LabwareDefinition1): boolean { return Boolean(def?.metadata?.isTiprack) }