Skip to content

Commit

Permalink
PLAT-547 command text strings for plate reader commands
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed Oct 15, 2024
1 parent 4e575b4 commit df16079
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/src/assets/localization/en/protocol_command_text.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"absorbance_reader_open_lid": "Opening Absorbance Reader lid",
"absorbance_reader_close_lid": "Closing Absorbance Reader lid",
"absorbance_reader_initialize": "Initializing Absorbance Reader to perform {{mode}} measurement at {{wavelengths}}",
"absorbance_reader_read": "Reading plate in Absorbance Reader",
"adapter_in_mod_in_slot": "{{adapter}} on {{module}} in {{slot}}",
"adapter_in_slot": "{{adapter}} in {{slot}}",
"aspirate": "Aspirating {{volume}} µL from well {{well_name}} of {{labware}} in {{labware_location}} at {{flow_rate}} µL/sec",
Expand Down
12 changes: 11 additions & 1 deletion app/src/molecules/Command/hooks/useCommandTextString/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,17 @@ export function useCommandTextString(
command,
}),
}

case 'absorbanceReader/openLid':
case 'absorbanceReader/closeLid':
case 'absorbanceReader/initialize':
case 'absorbanceReader/read':
return {
kind: 'generic',
commandText: utils.getAbsorbanceReaderCommandText({
...fullParams,
command,
}),
}
case 'thermocycler/runProfile':
return utils.getTCRunProfileCommandText({ ...fullParams, command })

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type {
AbsorbanceReaderOpenLidRunTimeCommand,
AbsorbanceReaderCloseLidRunTimeCommand,
AbsorbanceReaderInitializeRunTimeCommand,
AbsorbanceReaderReadRunTimeCommand,
RunTimeCommand,
} from '@opentrons/shared-data'
import type { HandlesCommands } from './types'

export type AbsorbanceCreateCommand =
| AbsorbanceReaderOpenLidRunTimeCommand
| AbsorbanceReaderCloseLidRunTimeCommand
| AbsorbanceReaderInitializeRunTimeCommand
| AbsorbanceReaderReadRunTimeCommand

const KEYS_BY_COMMAND_TYPE: {
[commandType in AbsorbanceCreateCommand['commandType']]: string
} = {
'absorbanceReader/openLid': 'absorbance_reader_open_lid',
'absorbanceReader/closeLid': 'absorbance_reader_close_lid',
'absorbanceReader/initialize': 'absorbance_reader_initialize',
'absorbanceReader/read': 'absorbance_reader_read',
}

type HandledCommands = Extract<
RunTimeCommand,
{ commandType: keyof typeof KEYS_BY_COMMAND_TYPE }
>

type GetAbsorbanceReaderCommandText = HandlesCommands<HandledCommands>

export const getAbsorbanceReaderCommandText = ({
command,
t,
}: GetAbsorbanceReaderCommandText): string => {
console.log(t(KEYS_BY_COMMAND_TYPE[command.commandType]))
if (command.commandType === 'absorbanceReader/initialize') {
const wavelengths = command.params.sampleWavelengths.join(' nm, ') + ` nm`
return t('absorbance_reader_initialize', {
mode: command.params.measureMode,
wavelengths: wavelengths,
})
}
return t(KEYS_BY_COMMAND_TYPE[command.commandType])
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ export { getUnknownCommandText } from './getUnknownCommandText'
export { getPipettingCommandText } from './getPipettingCommandText'
export { getLiquidProbeCommandText } from './getLiquidProbeCommandText'
export { getRailLightsCommandText } from './getRailLightsCommandText'
export { getAbsorbanceReaderCommandText } from './getAbsorbanceReaderCommandText'

0 comments on commit df16079

Please sign in to comment.