diff --git a/app/src/pages/InstrumentDetail/InstrumentDetailOverflowMenu.tsx b/app/src/pages/InstrumentDetail/InstrumentDetailOverflowMenu.tsx index 8d0541e041f..4f663d0405c 100644 --- a/app/src/pages/InstrumentDetail/InstrumentDetailOverflowMenu.tsx +++ b/app/src/pages/InstrumentDetail/InstrumentDetailOverflowMenu.tsx @@ -13,8 +13,6 @@ import { import { SINGLE_MOUNT_PIPETTES, NINETY_SIX_CHANNEL, - FLEX_ROBOT_TYPE, - getPipetteModelSpecs, } from '@opentrons/shared-data' import { ApiHostProvider } from '@opentrons/react-api-client' @@ -22,10 +20,6 @@ import { MenuList } from '../../atoms/MenuList' import { MenuItem } from '../../atoms/MenuList/MenuItem' import { PipetteWizardFlows } from '../../organisms/PipetteWizardFlows' import { GripperWizardFlows } from '../../organisms/GripperWizardFlows' -import { - DropTipWizardFlows, - useDropTipWizardFlows, -} from '../../organisms/DropTipWizardFlows' import { FLOWS } from '../../organisms/PipetteWizardFlows/constants' import { GRIPPER_FLOW_TYPES } from '../../organisms/GripperWizardFlows/constants' @@ -38,18 +32,24 @@ import type { interface InstrumentDetailsOverflowMenuProps { instrument: PipetteData | GripperData host: HostConfig | null + toggleDTWiz: () => void } export const handleInstrumentDetailOverflowMenu = ( instrument: InstrumentDetailsOverflowMenuProps['instrument'], - host: InstrumentDetailsOverflowMenuProps['host'] + host: InstrumentDetailsOverflowMenuProps['host'], + toggleDTWiz: () => void ): void => { - NiceModal.show(InstrumentDetailsOverflowMenu, { instrument, host }) + NiceModal.show(InstrumentDetailsOverflowMenu, { + instrument, + host, + toggleDTWiz, + }) } const InstrumentDetailsOverflowMenu = NiceModal.create( (props: InstrumentDetailsOverflowMenuProps): JSX.Element => { - const { instrument, host } = props + const { instrument, host, toggleDTWiz } = props const { t } = useTranslation('robot_controls') const modal = useModal() const [wizardProps, setWizardProps] = React.useState< @@ -66,9 +66,6 @@ const InstrumentDetailsOverflowMenu = NiceModal.create( modal.remove() }, } - const { showDTWiz, toggleDTWiz } = useDropTipWizardFlows() - const pipetteModelSpecs = - getPipetteModelSpecs((instrument as PipetteData).instrumentModel) ?? null const is96Channel = instrument?.ok && @@ -97,6 +94,11 @@ const InstrumentDetailsOverflowMenu = NiceModal.create( } } + const handleDropTip = (): void => { + toggleDTWiz() + modal.remove() + } + return ( @@ -120,7 +122,7 @@ const InstrumentDetailsOverflowMenu = NiceModal.create( ) : null} {instrument.mount !== 'extension' ? ( - + ) : null} - {showDTWiz && - instrument.mount !== 'extension' && - pipetteModelSpecs != null ? ( - - ) : null} ) } diff --git a/app/src/pages/InstrumentDetail/__tests__/InstrumentDetail.test.tsx b/app/src/pages/InstrumentDetail/__tests__/InstrumentDetail.test.tsx index 6b92a5ab9be..d92fd819043 100644 --- a/app/src/pages/InstrumentDetail/__tests__/InstrumentDetail.test.tsx +++ b/app/src/pages/InstrumentDetail/__tests__/InstrumentDetail.test.tsx @@ -13,9 +13,21 @@ import { usePipetteModelSpecs, } from '../../../resources/instruments/hooks' import { useIsOEMMode } from '../../../resources/robot-settings/hooks' +import { + DropTipWizardFlows, + useDropTipWizardFlows, +} from '../../../organisms/DropTipWizardFlows' import type { Instruments } from '@opentrons/api-client' - +import type * as SharedData from '@opentrons/shared-data' + +vi.mock('@opentrons/shared-data', async importOriginal => { + const actual = await importOriginal() + return { + ...actual, + getPipetteModelSpecs: vi.fn(), + } +}) vi.mock('@opentrons/react-api-client') vi.mock('react-router-dom', () => ({ useParams: vi.fn(), @@ -23,6 +35,7 @@ vi.mock('react-router-dom', () => ({ })) vi.mock('../../../resources/instruments/hooks') vi.mock('../../../resources/robot-settings/hooks') +vi.mock('../../../organisms/DropTipWizardFlows') const render = () => { return renderWithProviders(, { @@ -98,6 +111,11 @@ describe('InstrumentDetail', () => { vi.mocked(useGripperDisplayName).mockReturnValue('mockGripper') vi.mocked(useParams).mockReturnValue({ mount: 'left' }) vi.mocked(useIsOEMMode).mockReturnValue(false) + vi.mocked(useDropTipWizardFlows).mockReturnValue({ + toggleDTWiz: () => null, + showDTWiz: false, + }) + vi.mocked(DropTipWizardFlows).mockReturnValue(
MOCK_DROP_TIP_WIZ
) }) afterEach(() => { diff --git a/app/src/pages/InstrumentDetail/__tests__/InstrumentDetailOverflowMenu.test.tsx b/app/src/pages/InstrumentDetail/__tests__/InstrumentDetailOverflowMenu.test.tsx index 2c2c534ada3..555eb84ad82 100644 --- a/app/src/pages/InstrumentDetail/__tests__/InstrumentDetailOverflowMenu.test.tsx +++ b/app/src/pages/InstrumentDetail/__tests__/InstrumentDetailOverflowMenu.test.tsx @@ -11,9 +11,7 @@ import { handleInstrumentDetailOverflowMenu } from '../InstrumentDetailOverflowM import { useNotifyCurrentMaintenanceRun } from '../../../resources/maintenance_runs' import { PipetteWizardFlows } from '../../../organisms/PipetteWizardFlows' import { GripperWizardFlows } from '../../../organisms/GripperWizardFlows' -import { useDropTipWizardFlows } from '../../../organisms/DropTipWizardFlows' -import type { Mock } from 'vitest' import type { PipetteData, GripperData, @@ -31,7 +29,6 @@ vi.mock('@opentrons/shared-data', async importOriginal => { vi.mock('../../../resources/maintenance_runs') vi.mock('../../../organisms/PipetteWizardFlows') vi.mock('../../../organisms/GripperWizardFlows') -vi.mock('../../../organisms/DropTipWizardFlows') const MOCK_PIPETTE = { mount: 'left', @@ -103,13 +100,18 @@ const MOCK_GRIPPER = { } as GripperData const MOCK_HOST: HostConfig = { hostname: 'TEST_HOST' } +const mockToggleDTWiz = vi.fn() const render = (pipetteOrGripper: PipetteData | GripperData) => { return renderWithProviders(