Skip to content

Commit

Permalink
fix(app): update LPC labware and pipette render for labware and pipet…
Browse files Browse the repository at this point in the history
…te combos

Labware render highlighted wells and pipette render box and emanating nozzles position and number
should reflect the number of pipette channels, the labware layout, and whether probe (Flex) or tip
(OT-2) LPC is being utilized.
  • Loading branch information
ncdiehl11 committed Jan 16, 2024
1 parent 77e47c2 commit 08752e1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
6 changes: 5 additions & 1 deletion app/src/organisms/LabwarePositionCheck/JogToWell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ export const JogToWell = (props: JogToWellProps): JSX.Element | null => {
}, [])

let wellsToHighlight: string[] = []
if (getPipetteNameSpecs(pipetteName)?.channels === 8) {
if (
getPipetteNameSpecs(pipetteName)?.channels === 8 &&
!shouldUseMetalProbe
) {
wellsToHighlight = labwareDef.ordering[0]
} else {
wellsToHighlight = ['A1']
Expand Down Expand Up @@ -150,6 +153,7 @@ export const JogToWell = (props: JogToWellProps): JSX.Element | null => {
<PipetteRender
labwareDef={labwareDef}
pipetteName={pipetteName}
usingMetalProbe={shouldUseMetalProbe}
/>
</>
)}
Expand Down
44 changes: 33 additions & 11 deletions components/src/hardware-sim/Pipette/PipetteRender.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'
import classNames from 'classnames'
import {
getPipetteNameSpecs,
LabwareDefinition2,
Expand All @@ -13,17 +14,20 @@ import {
MULTI_CHANNEL_PIPETTE_HEIGHT,
MULTI_CHANNEL_CENTER_Y_NOZZLE,
MULTI_CHANNEL_Y_OFFSET,
NINETY_SIX_CHANNEL_PIPETTE_WIDTH,
} from './constants'
import { EmanatingNozzle } from './EmanatingNozzle'
import { EightEmanatingNozzles } from './EightEmanatingNozzles'
import styles from './styles.css'

interface PipetteRenderProps {
labwareDef: LabwareDefinition2
pipetteName: PipetteName
usingMetalProbe?: boolean
}

export const PipetteRender = (props: PipetteRenderProps): JSX.Element => {
const { labwareDef, pipetteName } = props
const { labwareDef, pipetteName, usingMetalProbe = false } = props
const channels = getPipetteNameSpecs(pipetteName)?.channels
const cx =
channels === 1
Expand All @@ -36,21 +40,33 @@ export const PipetteRender = (props: PipetteRenderProps): JSX.Element => {
const x = labwareDef.wells.A1.x - cx
const y = channels === 1 ? labwareDef.wells.A1.y - cy : MULTI_CHANNEL_Y_OFFSET

let boxWidth
let probeOffsetX = 0
let probeOffsetY = 0
if (channels === 1) {
boxWidth = SINGLE_CHANNEL_PIPETTE_WIDTH
} else if (channels === 8) {
boxWidth = MULTI_CHANNEL_PIPETTE_WIDTH
probeOffsetY = 63
} else {
boxWidth = NINETY_SIX_CHANNEL_PIPETTE_WIDTH
probeOffsetY = 63

Check warning on line 53 in components/src/hardware-sim/Pipette/PipetteRender.tsx

View check run for this annotation

Codecov / codecov/patch

components/src/hardware-sim/Pipette/PipetteRender.tsx#L52-L53

Added lines #L52 - L53 were not covered by tests
if (Object.keys(labwareDef.wells).length === 1) {
probeOffsetX = 99 / 2

Check warning on line 55 in components/src/hardware-sim/Pipette/PipetteRender.tsx

View check run for this annotation

Codecov / codecov/patch

components/src/hardware-sim/Pipette/PipetteRender.tsx#L55

Added line #L55 was not covered by tests
}
}

return (
<RobotCoordsForeignDiv
width={
channels === 1
? SINGLE_CHANNEL_PIPETTE_WIDTH
: MULTI_CHANNEL_PIPETTE_WIDTH
}
width={boxWidth}
height={
channels === 1
? SINGLE_CHANNEL_PIPETTE_HEIGHT
: MULTI_CHANNEL_PIPETTE_HEIGHT
}
x={x}
x={x - probeOffsetX}
y={y}
outerProps={{ style: { overflow: 'visible' } }}
className={classNames(styles.overflow)}

Check failure on line 69 in components/src/hardware-sim/Pipette/PipetteRender.tsx

View workflow job for this annotation

GitHub Actions / js checks

Type '{ children: Element; width: number; height: number; x: number; y: number; className: string; innerDivProps: { style: { width: string; height: string; overflow: string; boxSizing: string; borderRadius: string; boxShadow: string; backgroundColor: string; }; }; }' is not assignable to type 'IntrinsicAttributes & RobotCoordsForeignDivProps'.

Check failure on line 69 in components/src/hardware-sim/Pipette/PipetteRender.tsx

View workflow job for this annotation

GitHub Actions / js checks

Type '{ children: Element; width: number; height: number; x: number; y: number; className: string; innerDivProps: { style: { width: string; height: string; overflow: string; boxSizing: string; borderRadius: string; boxShadow: string; backgroundColor: string; }; }; }' is not assignable to type 'IntrinsicAttributes & RobotCoordsForeignDivProps'.
innerDivProps={{
style: {
width: '100%',
Expand All @@ -64,10 +80,16 @@ export const PipetteRender = (props: PipetteRenderProps): JSX.Element => {
}}
>
<svg overflow="visible">
{channels === 1 ? (
<EmanatingNozzle cx={cx} cy={cy} />
{channels === 1 || usingMetalProbe ? (
<EmanatingNozzle
cx={cx}
cy={usingMetalProbe ? cy + probeOffsetY : cy}
/>
) : (
<EightEmanatingNozzles cx={cx} initialCy={cy} />
<EightEmanatingNozzles
cx={usingMetalProbe ? cx - probeOffsetX : cx}
initialCy={usingMetalProbe ? cy + probeOffsetY : cy}
/>
)}
</svg>
</RobotCoordsForeignDiv>
Expand Down
2 changes: 2 additions & 0 deletions components/src/hardware-sim/Pipette/constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// These constants are used only in pipette render in LPC. The values do not necessarily reflect physical pipette dimensions.
export const SINGLE_CHANNEL_PIPETTE_WIDTH = 18.7
export const SINGLE_CHANNEL_PIPETTE_HEIGHT = 30.5

export const MULTI_CHANNEL_PIPETTE_WIDTH = 18.7
export const MULTI_CHANNEL_PIPETTE_HEIGHT = 90.3
export const NINETY_SIX_CHANNEL_PIPETTE_WIDTH = 117.7

export const MULTI_CHANNEL_CENTER_Y_NOZZLE = 13.3
export const MULTI_CHANNEL_Y_OFFSET = -2.5

0 comments on commit 08752e1

Please sign in to comment.