Skip to content

Commit

Permalink
clean up types and test
Browse files Browse the repository at this point in the history
  • Loading branch information
ncdiehl11 committed Dec 17, 2024
1 parent 997baec commit b583dd9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions protocol-designer/src/labware-ingred/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export type OrderedLiquids = Array<{
}>
// TODO: Ian 2018-10-15 audit & rename these confusing types
export interface LiquidGroup {
name: string | null | undefined
description: string | null | undefined
name: string | null
description: string | null
displayColor: string
liquidClass: string | null
serialize: boolean
Expand Down
6 changes: 5 additions & 1 deletion protocol-designer/src/liquid-defs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ export const getLiquidClassDisplayName = (
if (liquidClass == null) {
return null
}
return liquidClassDefs[liquidClass]?.displayName ?? null
if (!(liquidClass in liquidClassDefs)) {
console.warn(`Liquid class ${liquidClass} not found`)
return null
}
return liquidClassDefs[liquidClass].displayName
}
8 changes: 4 additions & 4 deletions protocol-designer/src/organisms/DefineLiquidsModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ import type { LiquidGroup } from '../../labware-ingred/types'
interface LiquidEditFormValues {
name: string
displayColor: string
description?: string | null
liquidClass: string | null
serialize?: boolean
description: string
liquidClass: string
serialize: boolean
[key: string]: unknown
}

Expand Down Expand Up @@ -144,7 +144,7 @@ export function DefineLiquidsModal(
name: values.name,
displayColor: values.displayColor,
liquidClass: values.liquidClass ? values.liquidClass : null,
description: values.description ?? null,
description: values.description ? values.description : null,
serialize: values.serialize ?? false,
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function LiquidDefinitions({
<Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing4}>
{Object.keys(allIngredientGroupFields).length > 0 ? (
Object.values(allIngredientGroupFields).map((liquid, index) => {
console.log(getLiquidDescription(liquid, enableLiquidClasses))
return (
<ListItem
type="noActive"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const mockAllIngredientGroupFields = {
name: 'Amplicon PCR sample + AMPure XP beads',
displayColor: '#9dffd8',
description: '25µl Amplicon PCR + 20 µl AMPure XP beads',
liquidClass: null,
liquidClass: 'Water',
serialize: false,
liquidGroupId: '2',
},
Expand Down

0 comments on commit b583dd9

Please sign in to comment.