From 92be4901075d6abbd4f8d6b7159bef9f4b62c2fd Mon Sep 17 00:00:00 2001
From: ahiuchingau <20424172+ahiuchingau@users.noreply.github.com>
Date: Fri, 24 May 2024 14:23:26 -0400
Subject: [PATCH] add absorbance reader to app deck configuration
---
.../AddFixtureModal.tsx | 1 +
.../AbsorbanceReaderFixture.tsx | 92 +++++++++++++++++++
.../hardware-sim/DeckConfigurator/index.tsx | 15 +++
3 files changed, 108 insertions(+)
create mode 100644 components/src/hardware-sim/DeckConfigurator/AbsorbanceReaderFixture.tsx
diff --git a/app/src/organisms/DeviceDetailsDeckConfiguration/AddFixtureModal.tsx b/app/src/organisms/DeviceDetailsDeckConfiguration/AddFixtureModal.tsx
index 7be620ffe19f..c6e978758b01 100644
--- a/app/src/organisms/DeviceDetailsDeckConfiguration/AddFixtureModal.tsx
+++ b/app/src/organisms/DeviceDetailsDeckConfiguration/AddFixtureModal.tsx
@@ -247,6 +247,7 @@ export function AddFixtureModal({
{
cutoutId,
cutoutFixtureId: ABSORBANCE_READER_V1_FIXTURE,
+ opentronsModuleSerialNumber: mod.serialNumber,
},
])
availableOptions = [
diff --git a/components/src/hardware-sim/DeckConfigurator/AbsorbanceReaderFixture.tsx b/components/src/hardware-sim/DeckConfigurator/AbsorbanceReaderFixture.tsx
new file mode 100644
index 000000000000..4c8dce02423c
--- /dev/null
+++ b/components/src/hardware-sim/DeckConfigurator/AbsorbanceReaderFixture.tsx
@@ -0,0 +1,92 @@
+import * as React from 'react'
+import { Icon } from '../../icons'
+import { Btn, Text } from '../../primitives'
+import { TYPOGRAPHY } from '../../ui-style-constants'
+import { COLORS } from '../../helix-design-system'
+import { RobotCoordsForeignObject } from '../Deck/RobotCoordsForeignObject'
+import {
+ COLUMN_3_X_ADJUSTMENT,
+ CONFIG_STYLE_EDITABLE,
+ CONFIG_STYLE_READ_ONLY,
+ FIXTURE_HEIGHT,
+ COLUMN_3_SINGLE_SLOT_FIXTURE_WIDTH,
+ Y_ADJUSTMENT,
+ CONFIG_STYLE_SELECTED,
+} from './constants'
+
+import type {
+ CutoutFixtureId,
+ CutoutId,
+ DeckDefinition,
+} from '@opentrons/shared-data'
+
+
+interface AbsorbanceReaderFixtureProps {
+ deckDefinition: DeckDefinition
+ fixtureLocation: CutoutId
+ cutoutFixtureId: CutoutFixtureId
+ handleClickRemove?: (
+ fixtureLocation: CutoutId,
+ cutoutFixtureId: CutoutFixtureId
+ ) => void
+ selected?: boolean
+}
+
+const ABSORBANCE_READER_FIXTURE_DISPLAY_NAME = 'Absorbance Reader'
+
+export function AbsorbanceReaderFixture(
+ props: AbsorbanceReaderFixtureProps
+): JSX.Element {
+ const {
+ deckDefinition,
+ handleClickRemove,
+ fixtureLocation,
+ cutoutFixtureId,
+ selected = false,
+ } = props
+
+ const cutoutDef = deckDefinition.locations.cutouts.find(
+ cutout => cutout.id === fixtureLocation
+ )
+
+ /**
+ * deck definition cutout position is the position of the single slot located within that cutout
+ * so, to get the position of the cutout itself we must add an adjustment to the slot position
+ * the adjustment for x is different for right side/left side
+ */
+ // TODO (AA): fix the slot length for the absorbance reader fixture
+ const [xSlotPosition = 0, ySlotPosition = 0] = cutoutDef?.position ?? []
+
+ const x = xSlotPosition + COLUMN_3_X_ADJUSTMENT
+
+ const y = ySlotPosition + Y_ADJUSTMENT
+
+ const editableStyle = selected ? CONFIG_STYLE_SELECTED : CONFIG_STYLE_EDITABLE
+ return (
+
+ handleClickRemove(fixtureLocation, cutoutFixtureId)
+ : () => {}
+ }
+ >
+
+ {ABSORBANCE_READER_FIXTURE_DISPLAY_NAME}
+
+ {handleClickRemove != null ? (
+
+ ) : null}
+
+
+ )
+}
diff --git a/components/src/hardware-sim/DeckConfigurator/index.tsx b/components/src/hardware-sim/DeckConfigurator/index.tsx
index 67e9f972e25e..4943b03806d4 100644
--- a/components/src/hardware-sim/DeckConfigurator/index.tsx
+++ b/components/src/hardware-sim/DeckConfigurator/index.tsx
@@ -12,6 +12,7 @@ import {
HEATERSHAKER_MODULE_V1_FIXTURE,
TEMPERATURE_MODULE_V2_FIXTURE,
MAGNETIC_BLOCK_V1_FIXTURE,
+ ABSORBANCE_READER_V1_FIXTURE,
STAGING_AREA_SLOT_WITH_MAGNETIC_BLOCK_V1_FIXTURE,
} from '@opentrons/shared-data'
@@ -34,6 +35,7 @@ import { TemperatureModuleFixture } from './TemperatureModuleFixture'
import { HeaterShakerFixture } from './HeaterShakerFixture'
import { MagneticBlockFixture } from './MagneticBlockFixture'
import { ThermocyclerFixture } from './ThermocyclerFixture'
+import { AbsorbanceReaderFixture } from './AbsorbanceReaderFixture'
interface DeckConfiguratorProps {
deckConfig: DeckConfiguration
@@ -105,6 +107,7 @@ export function DeckConfigurator(props: DeckConfiguratorProps): JSX.Element {
STAGING_AREA_SLOT_WITH_MAGNETIC_BLOCK_V1_FIXTURE,
] as CutoutFixtureId[]).includes(cutoutFixtureId)
)
+ const absorbanceReaderFixtures = deckConfig.filter(({ cutoutFixtureId }) => cutoutFixtureId === ABSORBANCE_READER_V1_FIXTURE )
return (
))}
+ {absorbanceReaderFixtures.map(({ cutoutId, cutoutFixtureId }) => (
+
+ ))}
{additionalStaticFixtures?.map(staticFixture => (