diff --git a/app/src/assets/localization/en/protocol_command_text.json b/app/src/assets/localization/en/protocol_command_text.json index b050ff7bc7a..379a047cda8 100644 --- a/app/src/assets/localization/en/protocol_command_text.json +++ b/app/src/assets/localization/en/protocol_command_text.json @@ -66,6 +66,8 @@ "setting_temperature_module_temp": "Setting Temperature Module to {{temp}} (rounded to nearest integer)", "setting_thermocycler_block_temp": "Setting Thermocycler block temperature to {{temp}} with hold time of {{hold_time_seconds}} seconds after target reached", "setting_thermocycler_lid_temp": "Setting Thermocycler lid temperature to {{temp}}", + "turning_rail_lights_off": "Turning rail lights off", + "turning_rail_lights_on": "Turning rail lights on", "slot": "Slot {{slot_name}}", "target_temperature": "target temperature", "tc_awaiting_for_duration": "Waiting for Thermocycler profile to complete", diff --git a/app/src/molecules/Command/hooks/useCommandTextString/index.tsx b/app/src/molecules/Command/hooks/useCommandTextString/index.tsx index 05552f062f9..d10a9aa3211 100644 --- a/app/src/molecules/Command/hooks/useCommandTextString/index.tsx +++ b/app/src/molecules/Command/hooks/useCommandTextString/index.tsx @@ -217,6 +217,11 @@ export function useCommandTextString( commandText: utils.getCustomCommandText({ ...fullParams, command }), } + case 'setRailLights': + return { + commandText: utils.getRailLightsCommandText({ ...fullParams, command }), + } + case undefined: case null: return { commandText: '' } diff --git a/app/src/molecules/Command/hooks/useCommandTextString/utils/getRailLightsCommandText.ts b/app/src/molecules/Command/hooks/useCommandTextString/utils/getRailLightsCommandText.ts new file mode 100644 index 00000000000..b731d3ec392 --- /dev/null +++ b/app/src/molecules/Command/hooks/useCommandTextString/utils/getRailLightsCommandText.ts @@ -0,0 +1,15 @@ +import type { RunTimeCommand } from '@opentrons/shared-data/command' +import type { HandlesCommands } from './types' + +type HandledCommands = Extract + +export type GetRailLightsCommandText = HandlesCommands + +export function getRailLightsCommandText({ + command, + t, +}: GetRailLightsCommandText): string { + return command.params.on + ? t('turning_rail_lights_on') + : t('turning_rail_lights_off') +} diff --git a/app/src/molecules/Command/hooks/useCommandTextString/utils/index.ts b/app/src/molecules/Command/hooks/useCommandTextString/utils/index.ts index f7946ff1e47..ff3ad43fc8c 100644 --- a/app/src/molecules/Command/hooks/useCommandTextString/utils/index.ts +++ b/app/src/molecules/Command/hooks/useCommandTextString/utils/index.ts @@ -21,3 +21,4 @@ export { getCustomCommandText } from './getCustomCommandText' export { getUnknownCommandText } from './getUnknownCommandText' export { getPipettingCommandText } from './getPipettingCommandText' export { getLiquidProbeCommandText } from './getLiquidProbeCommandText' +export { getRailLightsCommandText } from './getRailLightsCommandText' diff --git a/shared-data/command/types/incidental.ts b/shared-data/command/types/incidental.ts index 9c67ea05106..bb754dcbee5 100644 --- a/shared-data/command/types/incidental.ts +++ b/shared-data/command/types/incidental.ts @@ -1,9 +1,13 @@ import type { CommonCommandRunTimeInfo, CommonCommandCreateInfo } from '.' import type { StatusBarAnimation } from '../../js/types' -export type IncidentalCreateCommand = SetStatusBarCreateCommand +export type IncidentalCreateCommand = + | SetStatusBarCreateCommand + | SetRailLightsCreateCommand -export type IncidentalRunTimeCommand = SetStatusBarRunTimeCommand +export type IncidentalRunTimeCommand = + | SetStatusBarRunTimeCommand + | SetRailLightsRunTimeCommand export interface SetStatusBarCreateCommand extends CommonCommandCreateInfo { commandType: 'setStatusBar' @@ -19,3 +23,18 @@ export interface SetStatusBarRunTimeCommand interface SetStatusBarParams { animation: StatusBarAnimation } + +export interface SetRailLightsCreateCommand extends CommonCommandCreateInfo { + commandType: 'setRailLights' + params: SetRailLightsParams +} + +export interface SetRailLightsRunTimeCommand + extends CommonCommandRunTimeInfo, + SetRailLightsCreateCommand { + result?: any +} + +interface SetRailLightsParams { + on: boolean +}