-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLAT-547 command text strings for plate reader commands
- Loading branch information
Showing
4 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
app/src/molecules/Command/hooks/useCommandTextString/utils/getAbsorbanceReaderCommandText.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters