Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app): add labware selection and volume entry screens #15074

Merged
merged 10 commits into from
May 3, 2024
Prev Previous commit
Next Next commit
Updated linting and ts errors
  • Loading branch information
smb2268 committed May 2, 2024
commit 3e1ba3e6bbc6adae71a71dd32f6f1a18d0ee4c4c
4 changes: 2 additions & 2 deletions app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@
): JSX.Element | null {
const { onNext, onBack, exitButtonProps, state, dispatch } = props
const { i18n, t } = useTranslation(['quick_transfer', 'shared'])
if (state.pipette == null) return null
const labwareDisplayCategoryFilters: LabwareFilter[] = [
'all',
'wellPlate',
'reservoir',
]
if (state.pipette?.channels === 1) {
if (state.pipette.channels === 1) {
labwareDisplayCategoryFilters.push('tubeRack')
}
const [selectedCategory, setSelectedCategory] = React.useState<LabwareFilter>(

Check failure on line 46 in app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?

Check failure on line 46 in app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?
'all'
)
if (state.pipette == null) return null
const compatibleLabwareDefinitions = getCompatibleLabwareByCategory(
state.pipette.channels,
selectedCategory
)

const [selectedLabware, setSelectedLabware] = React.useState<

Check failure on line 54 in app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?

Check failure on line 54 in app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?
LabwareDefinition2 | 'source' | undefined
>(state.destination)

Expand Down
2 changes: 1 addition & 1 deletion app/src/organisms/QuickTransferFlow/SelectDestWells.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function SelectDestWells(props: SelectDestWellsProps): JSX.Element {
type: 'SET_DEST_WELLS',
wells: Object.keys(state.source.wells),
})
} else if (state.destination != 'source' && state.destination != null) {
} else if (state.destination !== 'source' && state.destination != null) {
dispatch({
type: 'SET_DEST_WELLS',
wells: Object.keys(state.destination.wells),
Expand Down
1 change: 0 additions & 1 deletion app/src/organisms/QuickTransferFlow/SelectPipette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useInstrumentsQuery } from '@opentrons/react-api-client'
import { getPipetteSpecsV2, RIGHT, LEFT } from '@opentrons/shared-data'
import { SmallButton, LargeButton } from '../../atoms/buttons'
import { ChildNavigation } from '../ChildNavigation'
import { generateCompatibleLabwareForPipette } from './utils'

import type { PipetteData, Mount } from '@opentrons/api-client'
import type {
Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@
): JSX.Element | null {
const { onNext, onBack, exitButtonProps, state, dispatch } = props
const { i18n, t } = useTranslation(['quick_transfer', 'shared'])
if (state.pipette == null) return null
const labwareDisplayCategoryFilters: LabwareFilter[] = [
'all',
'wellPlate',
'reservoir',
]
if (state.pipette?.channels === 1) {
if (state.pipette.channels === 1) {
labwareDisplayCategoryFilters.push('tubeRack')
}
const [selectedCategory, setSelectedCategory] = React.useState<LabwareFilter>(

Check failure on line 46 in app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?

Check failure on line 46 in app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?
'all'
)
if (state.pipette == null) return null

const compatibleLabwareDefinitions = getCompatibleLabwareByCategory(
state.pipette.channels,
selectedCategory
)

const [selectedLabware, setSelectedLabware] = React.useState<

Check failure on line 55 in app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?

Check failure on line 55 in app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?
LabwareDefinition2 | undefined
>(state.source)

Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/QuickTransferFlow/VolumeEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function VolumeEntry(props: VolumeEntryProps): JSX.Element {
}

const error =
volume != '' &&
volume !== '' &&
(volumeAsNumber < volumeRange.min || volumeAsNumber > volumeRange.max)
? t(`value_out_of_range`, {
min: volumeRange.min,
Expand All @@ -82,7 +82,7 @@ export function VolumeEntry(props: VolumeEntryProps): JSX.Element {
onClickButton={handleClickNext}
secondaryButtonProps={exitButtonProps}
top={SPACING.spacing8}
buttonIsDisabled={error != null || volume == ''}
buttonIsDisabled={error != null || volume === ''}
/>
<Flex
alignSelf={ALIGN_CENTER}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import type { QuickTransferSetupState } from '../types'

describe('getVolumeLimits', () => {
let state: QuickTransferSetupState = {
const state: QuickTransferSetupState = {
pipette: {
liquids: [
{
Expand Down
19 changes: 12 additions & 7 deletions app/src/organisms/QuickTransferFlow/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,20 @@
const maxPipetteVolume = Object.values(state.pipette.liquids)[0].maxVolume
const tipRackVolume = Object.values(state.tipRack.wells)[0].totalLiquidVolume
const sourceLabwareVolume = Math.min(
...state.sourceWells.map(well => state.source.wells[well].totalLiquidVolume)
...state.sourceWells.map(well =>
state.source ? state.source.wells[well].totalLiquidVolume : 0
)
)

const destLabwareVolume = Math.min(
...state.destinationWells.map(well =>
state.destination === 'source'
? state.source.wells[well].totalLiquidVolume
: state.destination.wells[well].totalLiquidVolume
)
...state.destinationWells.map(well => {
{

Check failure on line 161 in app/src/organisms/QuickTransferFlow/utils.ts

View workflow job for this annotation

GitHub Actions / js checks

Nested block is redundant

Check failure on line 161 in app/src/organisms/QuickTransferFlow/utils.ts

View workflow job for this annotation

GitHub Actions / js checks

Nested block is redundant
if (state.source == null || state.destination == null) return 0
return state.destination === 'source'
? state.source.wells[well].totalLiquidVolume
: state.destination.wells[well].totalLiquidVolume
}
})
)
let maxVolume = maxPipetteVolume
if (state.sourceWells.length === state.destinationWells.length) {
Expand Down Expand Up @@ -210,7 +215,7 @@

const compatibleDefUriList = allLabwareDefinitions.reduce<string[]>(
(acc, definition) => {
if (pipetteSpecs.channels == 1) {
if (pipetteSpecs.channels === 1) {
return [...acc, getLabwareDefURI(definition)]
} else {
const isCompatible = canPipetteUseLabware(pipetteSpecs, definition)
Expand Down
Loading