Skip to content

Commit

Permalink
filter out nonzero offsets and pass as prop to currentoffsetstable
Browse files Browse the repository at this point in the history
  • Loading branch information
ncdiehl11 committed Oct 2, 2023
1 parent fed11a1 commit 2907539
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { StyledText } from '../../../../atoms/text'
import { LabwareOffsetTabs } from '../../../LabwareOffsetTabs'
import { OffsetVector } from '../../../../molecules/OffsetVector'
import { PythonLabwareOffsetSnippet } from '../../../../molecules/PythonLabwareOffsetSnippet'
import { getLatestCurrentOffsets } from './utils'
import type { LabwareOffset } from '@opentrons/api-client'
import type {
RunTimeCommand,
Expand Down Expand Up @@ -71,7 +70,6 @@ export function CurrentOffsetsTable(
const isLabwareOffsetCodeSnippetsOn = useSelector(
getIsLabwareOffsetCodeSnippetsOn
)
const latestCurrentOffsets = getLatestCurrentOffsets(currentOffsets)

const TableComponent = (
<OffsetTable>
Expand All @@ -83,7 +81,7 @@ export function CurrentOffsetsTable(
</tr>
</thead>
<tbody>
{latestCurrentOffsets.map(offset => {
{currentOffsets.map(offset => {
const labwareDisplayName =
offset.definitionUri in defsByURI
? getLabwareDisplayName(defsByURI[offset.definitionUri])
Expand Down Expand Up @@ -112,7 +110,7 @@ export function CurrentOffsetsTable(
const JupyterSnippet = (
<PythonLabwareOffsetSnippet
mode="jupyter"
labwareOffsets={latestCurrentOffsets.map(o =>
labwareOffsets={currentOffsets.map(o =>
pick(o, ['definitionUri', 'location', 'vector'])
)}
commands={commands ?? []}
Expand All @@ -123,7 +121,7 @@ export function CurrentOffsetsTable(
const CommandLineSnippet = (
<PythonLabwareOffsetSnippet
mode="cli"
labwareOffsets={latestCurrentOffsets.map(o =>
labwareOffsets={currentOffsets.map(o =>
pick(o, ['definitionUri', 'location', 'vector'])
)}
commands={commands ?? []}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ const mockCurrentOffsets: LabwareOffset[] = [
location: { slotName: '1', moduleModel: 'heaterShakerModuleV1' },
vector: { x: 0, y: 0, z: 0 },
},
{
createdAt: '2022-12-20T14:09:08.688756+00:00',
definitionUri: 'opentrons/opentrons_96_tiprack_10ul/1',
id: '494ec3d1-224f-4f9a-a83b-3dd3060ea332',
location: { slotName: '2' },
vector: { x: 0, y: -0.09999999999999432, z: -0.09999999999999432 },
},
{
createdAt: '2022-12-20T14:09:08.689813+00:00',
definitionUri:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { CurrentOffsetsTable } from './CurrentOffsetsTable'
import { useLaunchLPC } from '../../../LabwarePositionCheck/useLaunchLPC'
import { StyledText } from '../../../../atoms/text'
import type { LabwareOffset } from '@opentrons/api-client'
import { getLatestCurrentOffsets } from './utils'

interface SetupLabwarePositionCheckProps {
expandLabwareStep: () => void
Expand Down Expand Up @@ -64,15 +65,17 @@ export function SetupLabwarePositionCheck(

const { launchLPC, LPCWizard } = useLaunchLPC(runId)

const nonIdentityOffsets = getLatestCurrentOffsets(sortedOffsets)

return (
<Flex
flexDirection={DIRECTION_COLUMN}
marginTop={SPACING.spacing16}
gridGap={SPACING.spacing16}
>
{sortedOffsets.length > 0 ? (
{nonIdentityOffsets.length > 0 ? (
<CurrentOffsetsTable
currentOffsets={sortedOffsets}
currentOffsets={nonIdentityOffsets}
commands={protocolData?.commands ?? []}
labware={protocolData?.labware ?? []}
modules={protocolData?.modules ?? []}
Expand Down

0 comments on commit 2907539

Please sign in to comment.