diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/LabwareInfoOverlay.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/LabwareInfoOverlay.tsx
index 789baf8004a4..c03bb6ab91b3 100644
--- a/app/src/organisms/Desktop/Devices/ProtocolRun/LabwareInfoOverlay.tsx
+++ b/app/src/organisms/Desktop/Devices/ProtocolRun/LabwareInfoOverlay.tsx
@@ -1,6 +1,4 @@
import { css } from 'styled-components'
-import { useTranslation } from 'react-i18next'
-import { getLabwareDisplayName } from '@opentrons/shared-data'
import {
ALIGN_FLEX_START,
Box,
@@ -17,13 +15,10 @@ import {
LegacyStyledText,
TYPOGRAPHY,
} from '@opentrons/components'
-import { LegacyOffsetVector } from '/app/molecules/LegacyOffsetVector'
import type { LabwareDefinition2 } from '@opentrons/shared-data'
-import { useLabwareOffsetForLabware } from './useLabwareOffsetForLabware'
interface LabwareInfoProps {
- displayName: string | null
- definitionDisplayName: string
+ displayName: string
labwareId: string
runId: string
labwareHasLiquid?: boolean
@@ -40,9 +35,7 @@ const labwareDisplayNameStyle = css`
-webkit-box-orient: vertical;
`
const LabwareInfo = (props: LabwareInfoProps): JSX.Element | null => {
- const { displayName, definitionDisplayName, labwareId, runId, hover } = props
- const { t } = useTranslation('protocol_setup')
- const vector = useLabwareOffsetForLabware(runId, labwareId)?.vector
+ const { displayName, labwareId, hover } = props
return (
{
- {displayName ?? definitionDisplayName}
+ {displayName}
{props.labwareHasLiquid && (
)}
- {vector != null && (
- <>
-
- {t('offset_data')}
-
-
- >
- )}
)
}
@@ -89,15 +70,16 @@ const LabwareInfo = (props: LabwareInfoProps): JSX.Element | null => {
interface LabwareInfoOverlayProps {
definition: LabwareDefinition2
labwareId: string
- displayName: string | null
+ displayName: string
runId: string
- hover?: boolean
labwareHasLiquid?: boolean
+ hover?: boolean
}
export const LabwareInfoOverlay = (
props: LabwareInfoOverlayProps
): JSX.Element => {
- const { definition, labwareId, displayName, runId } = props
+ const { definition, labwareId, displayName, runId, labwareHasLiquid } = props
+
const width = definition.dimensions.xDimension
const height = definition.dimensions.yDimension
return (
@@ -113,11 +95,10 @@ export const LabwareInfoOverlay = (
>
)
diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx
index 8d5558d17cd6..187f28c74610 100644
--- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx
+++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/SetupLabwareMap.tsx
@@ -133,6 +133,7 @@ export function SetupLabwareMap({
labwareId={topLabwareId}
displayName={topLabwareDisplayName}
runId={runId}
+ labwareHasLiquid={Object.values(wellFill).length > 0}
/>
) : null}
@@ -195,12 +196,13 @@ export function SetupLabwareMap({
setHoverLabwareId(null)
}}
>
- {topLabwareDefinition != null ? (
+ {topLabwareDisplayName != null ? (
0}
/>
) : null}
diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx
index a47f37e11360..f8a4ee6a3b2e 100644
--- a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx
+++ b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx
@@ -1,38 +1,12 @@
-import { when } from 'vitest-when'
import { screen } from '@testing-library/react'
-import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest'
-import {
- getLabwareDisplayName,
- fixtureTiprack300ul,
-} from '@opentrons/shared-data'
-import { nestedTextMatcher, renderWithProviders } from '/app/__testing-utils__'
+import { describe, it, beforeEach, vi, afterEach } from 'vitest'
+import { fixtureTiprack300ul } from '@opentrons/shared-data'
+import { renderWithProviders } from '/app/__testing-utils__'
import { i18n } from '/app/i18n'
-import { useCurrentRun } from '/app/resources/runs'
-import { getLabwareLocation } from '/app/transformations/commands'
import { LabwareInfoOverlay } from '../LabwareInfoOverlay'
-import { getLabwareDefinitionUri } from '/app/transformations/protocols'
-import { useLabwareOffsetForLabware } from '../useLabwareOffsetForLabware'
import type { ComponentProps } from 'react'
-import type {
- LabwareDefinition2,
- ProtocolFile,
- LoadedLabware,
-} from '@opentrons/shared-data'
-
-vi.mock('/app/resources/runs')
-vi.mock('/app/transformations/commands')
-vi.mock('../../hooks')
-vi.mock('/app/transformations/protocols')
-vi.mock('../useLabwareOffsetForLabware')
-
-vi.mock('@opentrons/shared-data', async importOriginal => {
- const actual = await importOriginal()
- return {
- ...actual,
- getLabwareDisplayName: vi.fn(),
- }
-})
+import type { LabwareDefinition2 } from '@opentrons/shared-data'
const render = (props: ComponentProps) => {
return renderWithProviders(
@@ -46,15 +20,10 @@ const render = (props: ComponentProps) => {
}
const MOCK_LABWARE_ID = 'some_labware_id'
-const MOCK_LABWARE_DEFINITION_URI = 'some_labware_definition_uri'
-const MOCK_SLOT_NAME = '4'
-const MOCK_LABWARE_VECTOR = { x: 1, y: 2, z: 3 }
const MOCK_RUN_ID = 'fake_run_id'
describe('LabwareInfoOverlay', () => {
let props: ComponentProps
- let labware: LoadedLabware[]
- let labwareDefinitions: ProtocolFile<{}>['labwareDefinitions']
beforeEach(() => {
props = {
definition: fixtureTiprack300ul as LabwareDefinition2,
@@ -62,40 +31,6 @@ describe('LabwareInfoOverlay', () => {
labwareId: MOCK_LABWARE_ID,
runId: MOCK_RUN_ID,
}
- labware = [
- {
- id: MOCK_LABWARE_ID,
- definitionUri: MOCK_LABWARE_DEFINITION_URI,
- } as LoadedLabware,
- ]
- labwareDefinitions = {
- [MOCK_LABWARE_DEFINITION_URI]: fixtureTiprack300ul as LabwareDefinition2,
- }
- when(vi.mocked(getLabwareDisplayName))
- .calledWith(props.definition)
- .thenReturn('mock definition display name')
-
- when(vi.mocked(useLabwareOffsetForLabware))
- .calledWith(MOCK_RUN_ID, MOCK_LABWARE_ID)
- .thenReturn({
- id: 'fake_offset_id',
- createdAt: 'fake_timestamp',
- definitionUri: 'fake_def_uri',
- location: { slotName: MOCK_SLOT_NAME },
- vector: MOCK_LABWARE_VECTOR,
- })
-
- when(vi.mocked(useCurrentRun))
- .calledWith()
- .thenReturn({} as any)
-
- when(vi.mocked(getLabwareLocation))
- .calledWith(MOCK_LABWARE_ID, [])
- .thenReturn({ slotName: MOCK_SLOT_NAME })
-
- when(vi.mocked(getLabwareDefinitionUri))
- .calledWith(MOCK_LABWARE_ID, labware, labwareDefinitions)
- .thenReturn(MOCK_LABWARE_DEFINITION_URI)
})
afterEach(() => {
vi.restoreAllMocks()
@@ -105,39 +40,4 @@ describe('LabwareInfoOverlay', () => {
render(props)
screen.getByText('fresh tips')
})
-
- it('should render the labware def display name if no user displayName present', () => {
- render({
- ...props,
- displayName: null,
- })
- screen.getByText('mock definition display name')
- })
-
- it('should render NOT render the offset data label when offset data does not exist', () => {
- render(props)
- expect(screen.queryByText('Labware Offsets')).toBeNull()
- })
-
- it('should render the offset data when offset data exists', () => {
- when(vi.mocked(useCurrentRun))
- .calledWith()
- .thenReturn({
- data: {
- labwareOffsets: [
- {
- id: '1',
- definitionUri: MOCK_LABWARE_DEFINITION_URI,
- location: { slotName: MOCK_SLOT_NAME },
- vector: MOCK_LABWARE_VECTOR,
- },
- ],
- },
- } as any)
- render(props)
- screen.getByText('Offset Data')
- screen.getByText(nestedTextMatcher('X1.0'))
- screen.getByText(nestedTextMatcher('Y2.0'))
- screen.getByText(nestedTextMatcher('Z3.0'))
- })
})
diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/useLabwareOffsetForLabware.ts b/app/src/organisms/Desktop/Devices/ProtocolRun/useLabwareOffsetForLabware.ts
deleted file mode 100644
index 5046ddcf24c8..000000000000
--- a/app/src/organisms/Desktop/Devices/ProtocolRun/useLabwareOffsetForLabware.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { getLoadedLabwareDefinitionsByUri } from '@opentrons/shared-data'
-
-import { getLabwareDefinitionUri } from '/app/transformations/protocols'
-import {
- getLegacyLabwareOffsetLocation,
- getCurrentOffsetForLabwareInLocation,
-} from '/app/transformations/analysis'
-import {
- useNotifyRunQuery,
- useMostRecentCompletedAnalysis,
-} from '/app/resources/runs'
-
-import type { LabwareOffset } from '@opentrons/api-client'
-
-export function useLabwareOffsetForLabware(
- runId: string,
- labwareId: string
-): LabwareOffset | null {
- const mostRecentAnalysis = useMostRecentCompletedAnalysis(runId)
- const { data: runRecord } = useNotifyRunQuery(runId)
- if (mostRecentAnalysis == null) return null
-
- const labwareDefinitionsByUri = getLoadedLabwareDefinitionsByUri(
- mostRecentAnalysis.commands
- )
- const labwareDefinitionUri = getLabwareDefinitionUri(
- labwareId,
- mostRecentAnalysis.labware,
- labwareDefinitionsByUri
- )
-
- const labwareLocation = getLegacyLabwareOffsetLocation(
- labwareId,
- mostRecentAnalysis?.commands ?? [],
- mostRecentAnalysis?.modules ?? [],
- mostRecentAnalysis?.labware ?? []
- )
- if (labwareLocation == null || labwareDefinitionUri == null) return null
- const labwareOffsets = runRecord?.data?.labwareOffsets ?? []
-
- return (
- getCurrentOffsetForLabwareInLocation(
- labwareOffsets,
- labwareDefinitionUri,
- labwareLocation
- ) ?? null
- )
-}