From 979a2c1791be83063b1d4ac72602fca9ee4b08df Mon Sep 17 00:00:00 2001 From: Jethary Date: Tue, 16 Jan 2024 14:09:36 -0500 Subject: [PATCH] fix more --- .../src/components/FileSidebar/index.ts | 3 ++ .../StepEditForm/fields/PathField/index.ts | 8 ++-- .../src/components/StepEditForm/utils.ts | 1 - .../StepSelectionBannerComponent.tsx | 36 ++++++++-------- .../src/components/modals/GateModal/index.tsx | 3 +- .../src/components/steplist/StepItem.tsx | 37 +++++++++------- protocol-designer/src/initialize.ts | 3 +- .../src/step-forms/selectors/index.ts | 3 +- .../utils/createPresavedStepForm.ts | 4 ++ .../src/steplist/fieldLevel/errors.ts | 5 +-- .../src/steplist/formLevel/createBlankForm.ts | 6 +-- .../formLevel/moveLabwareFormErrors.ts | 11 ++--- .../src/steplist/formLevel/warnings.tsx | 42 +++++++------------ protocol-designer/src/ui/labware/selectors.ts | 9 +--- protocol-designer/src/ui/modules/utils.ts | 19 ++++++++- protocol-designer/src/ui/steps/utils.ts | 25 ++++++++--- protocol-designer/src/utils/index.ts | 32 +++++++------- 17 files changed, 134 insertions(+), 113 deletions(-) diff --git a/protocol-designer/src/components/FileSidebar/index.ts b/protocol-designer/src/components/FileSidebar/index.ts index c27fc8a2fb8..70d95785327 100644 --- a/protocol-designer/src/components/FileSidebar/index.ts +++ b/protocol-designer/src/components/FileSidebar/index.ts @@ -28,6 +28,7 @@ interface SP { savedStepForms: SavedStepFormState robotType: RobotType additionalEquipment: AdditionalEquipment + t: any } export const FileSidebar = connect( mapStateToProps, @@ -54,6 +55,7 @@ function mapStateToProps(state: BaseState): SP { // Ignore clicking 'CREATE NEW' button in these cases _canCreateNew: !selectors.getNewProtocolModal(state), _hasUnsavedChanges: loadFileSelectors.getHasUnsavedChanges(state), + t, } } @@ -73,6 +75,7 @@ function mergeProps( savedStepForms, robotType, additionalEquipment, + t, } = stateProps const { dispatch } = dispatchProps return { diff --git a/protocol-designer/src/components/StepEditForm/fields/PathField/index.ts b/protocol-designer/src/components/StepEditForm/fields/PathField/index.ts index 4bfadddeace..7ccd037f6fd 100644 --- a/protocol-designer/src/components/StepEditForm/fields/PathField/index.ts +++ b/protocol-designer/src/components/StepEditForm/fields/PathField/index.ts @@ -1,5 +1,5 @@ import * as React from 'react' -import {useTranslation} from 'react-i18next' +import { useTranslation } from 'react-i18next' import { connect } from 'react-redux' import { Path } from './Path' import { selectors as stepFormSelectors } from '../../../../step-forms' @@ -21,7 +21,7 @@ function mapSTP(state: BaseState, ownProps: OP): SP { pipette, volume, } = ownProps - const {t} = useTranslation('form') + const { t } = useTranslation('form') const pipetteEntities = stepFormSelectors.getPipetteEntities(state) const disabledPathMap = getDisabledPathMap( { @@ -33,8 +33,8 @@ function mapSTP(state: BaseState, ownProps: OP): SP { pipette, volume, }, - pipetteEntities - t: + pipetteEntities, + t ) return { disabledPathMap, diff --git a/protocol-designer/src/components/StepEditForm/utils.ts b/protocol-designer/src/components/StepEditForm/utils.ts index 5f598f20b7c..de60322a310 100644 --- a/protocol-designer/src/components/StepEditForm/utils.ts +++ b/protocol-designer/src/components/StepEditForm/utils.ts @@ -5,7 +5,6 @@ import { SOURCE_WELL_BLOWOUT_DESTINATION, DEST_WELL_BLOWOUT_DESTINATION, } from '@opentrons/step-generation' -import { i18n } from '../../localization' import { PROFILE_CYCLE, FormData, diff --git a/protocol-designer/src/components/StepSelectionBanner/StepSelectionBannerComponent.tsx b/protocol-designer/src/components/StepSelectionBanner/StepSelectionBannerComponent.tsx index e444e6ec564..489f5c41a74 100644 --- a/protocol-designer/src/components/StepSelectionBanner/StepSelectionBannerComponent.tsx +++ b/protocol-designer/src/components/StepSelectionBanner/StepSelectionBannerComponent.tsx @@ -1,4 +1,5 @@ import * as React from 'react' +import { useTranslation } from 'react-i18next' import startCase from 'lodash/startCase' import { css } from 'styled-components' import { @@ -24,7 +25,6 @@ import { SPACING_3, TYPOGRAPHY, } from '@opentrons/components' -import { i18n } from '../../localization' import { CountPerStepType, StepType } from '../../form-types' interface StepPillProps { @@ -49,10 +49,9 @@ const stepPillStyles = css` ` const StepPill = (props: StepPillProps): JSX.Element => { + const { t } = useTranslation('application') const { count, stepType } = props - const label = `${startCase( - i18n.t(`application.stepType.${stepType}`) - )} (${count})` + const label = `${startCase(t(`stepType.${stepType}`))} (${count})` return ( {label} @@ -62,18 +61,20 @@ const StepPill = (props: StepPillProps): JSX.Element => { export const ExitBatchEditButton = (props: { handleExitBatchEdit: StepSelectionBannerProps['handleExitBatchEdit'] -}): JSX.Element => ( - - - {i18n.t('application.exit_batch_edit')} - - -) - +}): JSX.Element => { + const { t } = useTranslation('application') + return ( + + + {t('exit_batch_edit')} + + + ) +} export interface StepSelectionBannerProps { countPerStepType: CountPerStepType handleExitBatchEdit: () => unknown @@ -82,6 +83,7 @@ export interface StepSelectionBannerProps { export const StepSelectionBannerComponent = ( props: StepSelectionBannerProps ): JSX.Element => { + const { t } = useTranslation('application') const { countPerStepType, handleExitBatchEdit } = props const numSteps = Object.keys(countPerStepType).reduce( // @ts-expect-error(sa, 2021-6-23): refactor to use Object.entries to preserve type safety @@ -112,7 +114,7 @@ export const StepSelectionBannerComponent = ( textTransform={TYPOGRAPHY.textTransformUppercase} id="StepSelectionBannerComponent_numberStepsSelected" > - {i18n.t('application.n_steps_selected', { n: numSteps })} + {t('n_steps_selected', { n: numSteps })} diff --git a/protocol-designer/src/components/modals/GateModal/index.tsx b/protocol-designer/src/components/modals/GateModal/index.tsx index c43dc47aeb8..9a1e524ed83 100644 --- a/protocol-designer/src/components/modals/GateModal/index.tsx +++ b/protocol-designer/src/components/modals/GateModal/index.tsx @@ -1,7 +1,6 @@ import * as React from 'react' import { useTranslation } from 'react-i18next' -import { useSelector } from 'react-redux' -import { useDispatch } from 'react-redux' +import { useSelector, useDispatch } from 'react-redux' import cx from 'classnames' import { AlertModal } from '@opentrons/components' import { diff --git a/protocol-designer/src/components/steplist/StepItem.tsx b/protocol-designer/src/components/steplist/StepItem.tsx index 723ff6ee408..ea9e25c8404 100644 --- a/protocol-designer/src/components/steplist/StepItem.tsx +++ b/protocol-designer/src/components/steplist/StepItem.tsx @@ -146,6 +146,7 @@ interface ProfileStepSubstepRowProps { export const ProfileStepSubstepRow = ( props: ProfileStepSubstepRowProps ): JSX.Element => { + const { t } = useTranslation(['modules', 'application']) const { repetitionsDisplay, stepNumber } = props const { temperature, durationMinutes, durationSeconds } = props.step return ( @@ -165,7 +166,7 @@ export const ProfileStepSubstepRow = ( {stepNumber} - {makeTemperatureText(temperature)} + {makeTemperatureText(temperature, t)} { const { step, stepNumber } = props + const { t } = useTranslation(['modules', 'application']) + return (
{stepNumber} - {makeTemperatureText(step.temperature)} + {makeTemperatureText(step.temperature, t)} {makeDurationText(step.durationMinutes, step.durationSeconds)} @@ -299,7 +302,7 @@ export const StepItemContents = ( hoveredSubstep, additionalEquipmentEntities, } = props - const { t } = useTranslation('modules') + const { t } = useTranslation(['modules', 'application']) if (!rawForm) { return null } @@ -322,7 +325,7 @@ export const StepItemContents = ( } if (substeps && substeps.substepType === 'temperature') { - const temperature = makeTemperatureText(substeps.temperature) + const temperature = makeTemperatureText(substeps.temperature, t) return ( @@ -447,9 +452,9 @@ export const StepItemContents = ( } if (substeps && substeps.substepType === THERMOCYCLER_STATE) { - const blockTemperature = makeTemperatureText(substeps.blockTargetTemp) - const lidTemperature = makeTemperatureText(substeps.lidTargetTemp) - const lidLabelText = makeLidLabelText(substeps.lidOpen) + const blockTemperature = makeTemperatureText(substeps.blockTargetTemp, t) + const lidTemperature = makeTemperatureText(substeps.lidTargetTemp, t) + const lidLabelText = makeLidLabelText(substeps.lidOpen, t) return ( ): void => { @@ -6,7 +5,7 @@ export const initialize = (store: Record): void => { window.onbeforeunload = (_e: unknown) => { // NOTE: the custom text will be ignored in modern browsers return loadFileSelectors.getHasUnsavedChanges(store.getState()) - ? i18n.t('alert.window.confirm_leave') + ? 'Are you sure you want to leave? You will lose any unsaved changes.' : undefined } } diff --git a/protocol-designer/src/step-forms/selectors/index.ts b/protocol-designer/src/step-forms/selectors/index.ts index 25c86aa3880..6cf2d744f66 100644 --- a/protocol-designer/src/step-forms/selectors/index.ts +++ b/protocol-designer/src/step-forms/selectors/index.ts @@ -39,7 +39,6 @@ import { selectors as labwareDefSelectors, LabwareDefByDefURI, } from '../../labware-defs' -import { i18n } from '../../localization' import { InstrumentGroup } from '@opentrons/components' import type { DropdownOption, @@ -376,7 +375,7 @@ export const getEquippedPipetteOptions: Selector< return reduce( pipettes, (acc: DropdownOption[], pipette: PipetteOnDeck, id: string) => { - const mountLabel = i18n.t(`form.pipette_mount_label.${pipette.mount}`) + const mountLabel = pipette.mount === 'left' ? '(L}' : '{R}' const nextOption = { name: pipettesSame ? `${_getPipetteDisplayName(pipette.name)} ${mountLabel}` diff --git a/protocol-designer/src/step-forms/utils/createPresavedStepForm.ts b/protocol-designer/src/step-forms/utils/createPresavedStepForm.ts index e934b430dc5..f76f61d972f 100644 --- a/protocol-designer/src/step-forms/utils/createPresavedStepForm.ts +++ b/protocol-designer/src/step-forms/utils/createPresavedStepForm.ts @@ -1,4 +1,5 @@ import last from 'lodash/last' +import { useTranslation } from 'react-i18next' import { HEATERSHAKER_MODULE_TYPE, MAGNETIC_MODULE_TYPE, @@ -262,9 +263,12 @@ export const createPresavedStepForm = ({ robotStateTimeline, additionalEquipmentEntities, }: CreatePresavedStepFormArgs): FormData => { + const { t } = useTranslation('application') + const formData = createBlankForm({ stepId, stepType, + t, }) const updateDefaultDropTip = _patchDefaultDropTipLocation({ diff --git a/protocol-designer/src/steplist/fieldLevel/errors.ts b/protocol-designer/src/steplist/fieldLevel/errors.ts index 8e1b2f0286b..3097c71a09e 100644 --- a/protocol-designer/src/steplist/fieldLevel/errors.ts +++ b/protocol-designer/src/steplist/fieldLevel/errors.ts @@ -1,5 +1,4 @@ import isArray from 'lodash/isArray' -import { i18n } from '../../localization' /******************* ** Error Messages ** @@ -56,9 +55,7 @@ export const temperatureRangeFieldValue = ( ): ErrorChecker => (value: unknown): string | null => value === null || (Number(value) <= maximum && Number(value) >= minimum) ? null - : `${FIELD_ERRORS.OUTSIDE_OF_RANGE} ${minimum} and ${maximum} ${i18n.t( - 'application.units.degrees' - )}` + : `${FIELD_ERRORS.OUTSIDE_OF_RANGE} ${minimum} and ${maximum} °C` export const realNumber: ErrorChecker = (value: unknown) => isNaN(Number(value)) ? FIELD_ERRORS.NOT_A_REAL_NUMBER : null diff --git a/protocol-designer/src/steplist/formLevel/createBlankForm.ts b/protocol-designer/src/steplist/formLevel/createBlankForm.ts index 62456d517ca..8c10cbea5f8 100644 --- a/protocol-designer/src/steplist/formLevel/createBlankForm.ts +++ b/protocol-designer/src/steplist/formLevel/createBlankForm.ts @@ -1,17 +1,17 @@ -import { i18n } from '../../localization' import { getDefaultsForStepType } from './getDefaultsForStepType' import { StepType, StepIdType, BlankForm, FormData } from '../../form-types' interface NewFormArgs { stepId: StepIdType stepType: StepType + t: any } // Add default values to a new step form export function createBlankForm(args: NewFormArgs): FormData { - const { stepId, stepType } = args + const { stepId, stepType, t } = args const baseForm: BlankForm = { id: stepId, stepType: stepType, - stepName: i18n.t(`application.stepType.${stepType}`), + stepName: t(`stepType.${stepType}`), stepDetails: '', } return { ...baseForm, ...getDefaultsForStepType(stepType) } diff --git a/protocol-designer/src/steplist/formLevel/moveLabwareFormErrors.ts b/protocol-designer/src/steplist/formLevel/moveLabwareFormErrors.ts index a24d7cae689..28828c7524d 100644 --- a/protocol-designer/src/steplist/formLevel/moveLabwareFormErrors.ts +++ b/protocol-designer/src/steplist/formLevel/moveLabwareFormErrors.ts @@ -1,5 +1,4 @@ import { LabwareLocation } from '@opentrons/shared-data' -import { i18n } from '../../localization' import { COMPATIBLE_LABWARE_ALLOWLIST_BY_MODULE_TYPE, COMPATIBLE_LABWARE_ALLOWLIST_FOR_ADAPTER, @@ -12,6 +11,8 @@ import type { ProfileFormError } from './profileErrors' type HydratedFormData = any +// TODO(Jr, 1/16/24): look into the use case of this util since the i18n strings +// previously listed in this util were not found in any json. const getMoveLabwareError = ( labware: LabwareEntity, newLocation: LabwareLocation, @@ -27,9 +28,7 @@ const getMoveLabwareError = ( invariantContext.moduleEntities[newLocation.moduleId].type const modAllowList = COMPATIBLE_LABWARE_ALLOWLIST_BY_MODULE_TYPE[moduleType] errorString = !modAllowList.includes(loadName) - ? i18n.t( - 'form.step_edit_form.labwareLabel.errors.labwareIncompatibleWithMod' - ) + ? 'labware incompatible with this module' : null } else if ('labwareId' in newLocation) { const adapterValueDefUri = @@ -38,9 +37,7 @@ const getMoveLabwareError = ( const adapterAllowList = COMPATIBLE_LABWARE_ALLOWLIST_FOR_ADAPTER[adapterValueDefUri] errorString = !adapterAllowList?.includes(selectedLabwareDefUri) - ? i18n.t( - 'form.step_edit_form.labwareLabel.errors.labwareIncompatibleWithAdapter' - ) + ? 'labware incompatible with this adapter' : null } return errorString diff --git a/protocol-designer/src/steplist/formLevel/warnings.tsx b/protocol-designer/src/steplist/formLevel/warnings.tsx index de0387d3e71..cc57188e4d2 100644 --- a/protocol-designer/src/steplist/formLevel/warnings.tsx +++ b/protocol-designer/src/steplist/formLevel/warnings.tsx @@ -1,6 +1,5 @@ import * as React from 'react' import { getWellTotalVolume } from '@opentrons/shared-data' -import { i18n } from '../../localization' import { KnowledgeBaseLink } from '../../components/KnowledgeBaseLink' import { FormError } from './errors' /******************* @@ -19,49 +18,40 @@ export type FormWarning = FormError & { const belowMinAirGapVolumeWarning = (min: number): FormWarning => ({ type: 'BELOW_MIN_AIR_GAP_VOLUME', - title: i18n.t(`alert.form.warning.BELOW_MIN_AIR_GAP_VOLUME.title`, { - min, - }), - body: ( - - {i18n.t(`alert.form.warning.BELOW_MIN_AIR_GAP_VOLUME.body`)} - - ), + title: `Air gap volume is below pipette minimum (${min}} uL)`, + body: <>{'Pipettes cannot accurately handle volumes below their minimum.'}, dependentFields: ['disposalVolume_volume', 'pipette'], }) const belowPipetteMinVolumeWarning = (min: number): FormWarning => ({ type: 'BELOW_PIPETTE_MINIMUM_VOLUME', - title: i18n.t(`alert.form.warning.BELOW_PIPETTE_MINIMUM_VOLUME.title`, { - min, - }), + title: `Disposal volume is below recommended minimum (${min}} uL)`, body: ( - - {i18n.t(`alert.form.warning.BELOW_PIPETTE_MINIMUM_VOLUME.body`)} - + <> + { + 'For accuracy in multi-dispense Transfers we recommend you use a disposal volume of at least the pipette`s minimum. Read more ' + } + ), dependentFields: ['pipette', 'volume'], }) const overMaxWellVolumeWarning = (): FormWarning => ({ type: 'OVER_MAX_WELL_VOLUME', - title: i18n.t(`alert.form.warning.OVER_MAX_WELL_VOLUME.title`), + title: 'Dispense volume will overflow a destination well', dependentFields: ['dispense_labware', 'dispense_wells', 'volume'], }) const belowMinDisposalVolumeWarning = (min: number): FormWarning => ({ type: 'BELOW_MIN_DISPOSAL_VOLUME', - title: i18n.t(`alert.form.warning.BELOW_MIN_DISPOSAL_VOLUME.title`, { - min, - }), + title: `Disposal volume is below recommended minimum (${min}} uL)`, body: ( - - {i18n.t(`alert.form.warning.BELOW_MIN_DISPOSAL_VOLUME.body`)} - - {i18n.t(`alert.form.warning.BELOW_MIN_DISPOSAL_VOLUME.link`)} - - . - + <> + { + 'For accuracy in multi-dispense Transfers we recommend you use a disposal volume of at least the pipette`s minimum. Read more ' + } + {'here'}. + ), dependentFields: ['disposalVolume_volume', 'pipette'], }) diff --git a/protocol-designer/src/ui/labware/selectors.ts b/protocol-designer/src/ui/labware/selectors.ts index 3919547b419..91f290d9d5d 100644 --- a/protocol-designer/src/ui/labware/selectors.ts +++ b/protocol-designer/src/ui/labware/selectors.ts @@ -3,10 +3,9 @@ import mapValues from 'lodash/mapValues' import reduce from 'lodash/reduce' import { getIsTiprack, getLabwareDisplayName } from '@opentrons/shared-data' import { AdditionalEquipmentEntity } from '@opentrons/step-generation' -import { i18n } from '../../localization' import * as stepFormSelectors from '../../step-forms/selectors' import { selectors as labwareIngredSelectors } from '../../labware-ingred/selectors' -import { getModuleUnderLabware } from '../modules/utils' +import { getModuleShortNames, getModuleUnderLabware } from '../modules/utils' import { getLabwareOffDeck, getLabwareInColumn4 } from './utils' import type { LabwareEntity } from '@opentrons/step-generation' @@ -86,11 +85,7 @@ export const getLabwareOptions: Selector = createSelector( labwareId ) const module = - moduleOnDeck != null - ? i18n.t( - `form.step_edit_form.field.moduleLabwarePrefix.${moduleOnDeck.type}` - ) - : null + moduleOnDeck != null ? getModuleShortNames(moduleOnDeck.type) : null const isLabwareInColumn4 = getLabwareInColumn4( initialDeckSetup, diff --git a/protocol-designer/src/ui/modules/utils.ts b/protocol-designer/src/ui/modules/utils.ts index e3fdd56acf4..fcd1ddb5f43 100644 --- a/protocol-designer/src/ui/modules/utils.ts +++ b/protocol-designer/src/ui/modules/utils.ts @@ -1,5 +1,4 @@ import values from 'lodash/values' -import { i18n } from '../../localization' import { MAGNETIC_MODULE_V1, getLabwareDefaultEngageHeight, @@ -61,6 +60,22 @@ export function getModuleUnderLabware( return location === moduleOnDeck.id }) } + +export const getModuleShortNames = (type: ModuleType): string => { + switch (type) { + case 'heaterShakerModuleType': + return 'Heater-Shaker' + case 'magneticBlockType': + return 'Magnetic Block' + case 'magneticModuleType': + return 'Magnetic Module' + case 'temperatureModuleType': + return 'Temperature Module' + case 'thermocyclerModuleType': + return 'Thermocycler' + } +} + export function getModuleLabwareOptions( initialDeckSetup: InitialDeckSetup, nicknamesById: Record, @@ -69,7 +84,7 @@ export function getModuleLabwareOptions( const moduleOnDeck = getModuleOnDeckByType(initialDeckSetup, type) const labware = moduleOnDeck && getLabwareOnModule(initialDeckSetup, moduleOnDeck.id) - const module = i18n.t(`form.step_edit_form.field.moduleLabwarePrefix.${type}`) + const module = getModuleShortNames(type) let options: Options = [] if (moduleOnDeck) { diff --git a/protocol-designer/src/ui/steps/utils.ts b/protocol-designer/src/ui/steps/utils.ts index 26ce737332e..097a34ee93c 100644 --- a/protocol-designer/src/ui/steps/utils.ts +++ b/protocol-designer/src/ui/steps/utils.ts @@ -1,4 +1,3 @@ -import { i18n } from '../../localization' import forEach from 'lodash/forEach' import { StepFieldName } from '../../form-types' export const MAIN_CONTENT_FORCED_SCROLL_CLASSNAME = 'main_content_forced_scroll' @@ -85,19 +84,33 @@ const batchEditMoveLiquidPipetteDifferentAndMultiDispensePathDisabledFieldNames: 'dispense_mix_times', ] +// TODO(Jr, 1/16/24): refactor to translate these strings in i18n const fieldsWithDisabledTooltipText = ( fieldNames: StepFieldName[], disabledReason: string -): DisabledFields => - fieldNames.reduce( +): DisabledFields => { + let disabledReasonString = 'Incompatible with current path' + if ( + disabledReason === 'aspirate_touchTip_checkbox' || + disabledReason === 'dispense_touchTip_checkbox' + ) { + disabledReasonString = 'Touch tip is not supported' + } else if (disabledReason === 'blowout_checkbox') { + disabledReasonString = 'Redundant with disposal volume' + } else if (disabledReason === 'dispense_mix_checkbox') { + disabledReasonString = 'Unable to mix in a waste chute or trash bin' + } else if (disabledReason === 'dispense_mmFromBottom') { + disabledReasonString = 'Tip position adjustment is not supported' + } + + return fieldNames.reduce( (acc, fieldName: string) => ({ ...acc, - [fieldName]: i18n.t( - `tooltip.step_fields.batch_edit.disabled.${disabledReason}` - ), + [fieldName]: disabledReasonString, }), {} ) +} type BatchEditFormType = 'moveLiquid' | 'mix' export const getPipetteDifferentDisabledFields = ( diff --git a/protocol-designer/src/utils/index.ts b/protocol-designer/src/utils/index.ts index 676def993ef..307961abe5c 100644 --- a/protocol-designer/src/utils/index.ts +++ b/protocol-designer/src/utils/index.ts @@ -11,7 +11,6 @@ import { CutoutFixtureId, RobotType, } from '@opentrons/shared-data' -import { i18n } from '../localization' import { WellGroup } from '@opentrons/components' import { BoundingRect, GenericRect } from '../collision-types' import type { @@ -95,30 +94,35 @@ export { getWellSetForMultichannel, } export const makeTemperatureText = ( - temperature: number | string | null + temperature: number | string | null, + t: any ): string => temperature === null - ? i18n.t('modules.status.deactivated') - : `${temperature} ${i18n.t('application.units.degrees')}` -export const makeLidLabelText = (lidOpen: boolean): string => - i18n.t(`modules.lid_label`, { - lidStatus: i18n.t(lidOpen ? 'modules.lid_open' : 'modules.lid_closed'), + ? t('modules:status.deactivated') + : `${temperature} ${t('application:units.degrees')}` +export const makeLidLabelText = (lidOpen: boolean, t: any): string => + t(`modules:lid_label`, { + lidStatus: t(lidOpen ? 'modules:lid_open' : 'modules:lid_closed'), }) -export const makeSpeedText = (targetSpeed: number | string | null): string => +export const makeSpeedText = ( + targetSpeed: number | string | null, + t: any +): string => targetSpeed === null - ? i18n.t('modules.status.deactivated') - : `${targetSpeed} ${i18n.t('application.units.rpm')}` + ? t('modules:status.deactivated') + : `${targetSpeed} ${t('application:units.rpm')}` export const makeTimerText = ( targetMinutes: number | string | null, - targetSeconds: number | string | null + targetSeconds: number | string | null, + t: any ): string | null => targetMinutes === null && targetSeconds === null ? null - : `${targetMinutes} ${i18n.t( - 'application.units.minutes' - )} ${targetSeconds} ${i18n.t('application.units.seconds')} timer` + : `${targetMinutes} ${t( + 'application:units.minutes' + )} ${targetSeconds} ${t('application:units.seconds')} timer` export const getIsAdapter = ( labwareId: string,