From 1ad14aa5c90ccabcbf1166a5397572975fc044c2 Mon Sep 17 00:00:00 2001 From: ncdiehl11 Date: Tue, 30 Apr 2024 17:31:40 -0400 Subject: [PATCH] enforce idle temperature status --- .../ModuleCard/ModuleOverflowMenu.tsx | 25 ++++++++++++++++--- .../__tests__/ModuleOverflowMenu.test.tsx | 4 +-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/src/organisms/ModuleCard/ModuleOverflowMenu.tsx b/app/src/organisms/ModuleCard/ModuleOverflowMenu.tsx index 7e91e869a8d7..28744a218cf7 100644 --- a/app/src/organisms/ModuleCard/ModuleOverflowMenu.tsx +++ b/app/src/organisms/ModuleCard/ModuleOverflowMenu.tsx @@ -3,7 +3,12 @@ import { useTranslation } from 'react-i18next' import { Flex, POSITION_RELATIVE, useHoverTooltip } from '@opentrons/components' -import { MODULE_MODELS_OT2_ONLY } from '@opentrons/shared-data' +import { + HEATERSHAKER_MODULE_TYPE, + MODULE_MODELS_OT2_ONLY, + TEMPERATURE_MODULE_TYPE, + THERMOCYCLER_MODULE_TYPE, +} from '@opentrons/shared-data' import { MenuList } from '../../atoms/MenuList' import { Tooltip } from '../../atoms/Tooltip' import { MenuItem } from '../../atoms/MenuList/MenuItem' @@ -69,8 +74,22 @@ export const ModuleOverflowMenu = ( isDisabled = true } - const isHeatingOrCooling = - module.data.status === 'heating' || module.data.status === 'cooling' + let isHeatingOrCooling + switch (module.moduleType) { + case TEMPERATURE_MODULE_TYPE: + isHeatingOrCooling = module.data.status !== 'idle' + break + case HEATERSHAKER_MODULE_TYPE: + isHeatingOrCooling = module.data.temperatureStatus !== 'idle' + break + case THERMOCYCLER_MODULE_TYPE: + isHeatingOrCooling = + module.data.lidTemperatureStatus !== 'idle' || + module.data.status !== 'idle' + break + default: + isHeatingOrCooling = false + } const { menuOverflowItemsByModuleType } = useModuleOverflowMenu( module, diff --git a/app/src/organisms/ModuleCard/__tests__/ModuleOverflowMenu.test.tsx b/app/src/organisms/ModuleCard/__tests__/ModuleOverflowMenu.test.tsx index 317b30b7f19e..1542227e0c30 100644 --- a/app/src/organisms/ModuleCard/__tests__/ModuleOverflowMenu.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/ModuleOverflowMenu.test.tsx @@ -19,7 +19,7 @@ import { import { useCurrentRunId } from '../../ProtocolUpload/hooks' import { ModuleOverflowMenu } from '../ModuleOverflowMenu' -import type { HeaterShakerStatus } from '@opentrons/api-client' +import type { TemperatureStatus } from '@opentrons/api-client' vi.mock('../../Devices/hooks') vi.mock('../../RunTimeControl/hooks') @@ -543,7 +543,7 @@ describe('ModuleOverflowMenu', () => { ...mockHeaterShaker, data: { ...mockHeaterShaker.data, - status: 'heating' as HeaterShakerStatus, + temperatureStatus: 'heating' as TemperatureStatus, }, } props = {