From 966fe39bf53607bb4becb0d05936415e77f556a3 Mon Sep 17 00:00:00 2001 From: koji Date: Wed, 18 Dec 2024 11:12:37 -0500 Subject: [PATCH] address feedback renaming the component --- .../__tests__/DesignerNavigation.test.tsx} | 10 +++++----- .../{EditNavigation => DesignerNavigation}/index.tsx | 8 ++++---- protocol-designer/src/organisms/index.ts | 2 +- protocol-designer/src/pages/Designer/index.tsx | 4 ++-- .../src/pages/Liquids/__tests__/Liquids.test.tsx | 8 +++++--- protocol-designer/src/pages/Liquids/index.tsx | 4 ++-- 6 files changed, 19 insertions(+), 17 deletions(-) rename protocol-designer/src/organisms/{EditNavigation/__tests__/EditNavigation.test.tsx => DesignerNavigation/__tests__/DesignerNavigation.test.tsx} (90%) rename protocol-designer/src/organisms/{EditNavigation => DesignerNavigation}/index.tsx (95%) diff --git a/protocol-designer/src/organisms/EditNavigation/__tests__/EditNavigation.test.tsx b/protocol-designer/src/organisms/DesignerNavigation/__tests__/DesignerNavigation.test.tsx similarity index 90% rename from protocol-designer/src/organisms/EditNavigation/__tests__/EditNavigation.test.tsx rename to protocol-designer/src/organisms/DesignerNavigation/__tests__/DesignerNavigation.test.tsx index e04410757bc..fba009e71bd 100644 --- a/protocol-designer/src/organisms/EditNavigation/__tests__/EditNavigation.test.tsx +++ b/protocol-designer/src/organisms/DesignerNavigation/__tests__/DesignerNavigation.test.tsx @@ -6,7 +6,7 @@ import { i18n } from '../../../assets/localization' import { getFileMetadata } from '../../../file-data/selectors' import { LiquidButton } from '../../../molecules' -import { EditNavigation } from '..' +import { DesignerNavigation } from '..' import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' @@ -29,14 +29,14 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = (props: ComponentProps) => { - return renderWithProviders(, { +const render = (props: ComponentProps) => { + return renderWithProviders(, { i18nInstance: i18n, }) } -describe('EditNavigation', () => { - let props: ComponentProps +describe('DesignerNavigation', () => { + let props: ComponentProps beforeEach(() => { props = { hasZoomInSlot: false, diff --git a/protocol-designer/src/organisms/EditNavigation/index.tsx b/protocol-designer/src/organisms/DesignerNavigation/index.tsx similarity index 95% rename from protocol-designer/src/organisms/EditNavigation/index.tsx rename to protocol-designer/src/organisms/DesignerNavigation/index.tsx index f47ae886d6e..ce0e7a9b3ff 100644 --- a/protocol-designer/src/organisms/EditNavigation/index.tsx +++ b/protocol-designer/src/organisms/DesignerNavigation/index.tsx @@ -24,19 +24,19 @@ import { LiquidButton } from '../../molecules/LiquidButton' import type { StyleProps, TabProps } from '@opentrons/components' -interface EditNavigationProps { +interface DesignerNavigationProps { hasZoomInSlot?: boolean tabs?: TabProps[] hasTrashEntity?: boolean showLiquidOverflowMenu?: (liquidOverflowMenu: boolean) => void } - -export function EditNavigation({ +// Note: this navigation is used in design page and liquids page +export function DesignerNavigation({ hasZoomInSlot, tabs = [], hasTrashEntity, showLiquidOverflowMenu, -}: EditNavigationProps): JSX.Element { +}: DesignerNavigationProps): JSX.Element { const { t } = useTranslation('starting_deck_state') const location = useLocation() const metadata = useSelector(getFileMetadata) diff --git a/protocol-designer/src/organisms/index.ts b/protocol-designer/src/organisms/index.ts index 127b29581eb..cbab9d62f8e 100644 --- a/protocol-designer/src/organisms/index.ts +++ b/protocol-designer/src/organisms/index.ts @@ -6,9 +6,9 @@ export * from './BlockingHintModal' export * from './ConfirmDeleteModal' export * from './ConfirmDeleteStagingAreaModal' export * from './DefineLiquidsModal' +export * from './DesignerNavigation' export * from './DisabledScreen' export * from './EditInstrumentsModal' -export * from './EditNavigation' export * from './EditNickNameModal' export * from './EditProtocolMetadataModal' export * from './FileUploadMessagesModal/' diff --git a/protocol-designer/src/pages/Designer/index.tsx b/protocol-designer/src/pages/Designer/index.tsx index 76e299d9709..410faa44739 100644 --- a/protocol-designer/src/pages/Designer/index.tsx +++ b/protocol-designer/src/pages/Designer/index.tsx @@ -17,7 +17,7 @@ import { selectTerminalItem } from '../../ui/steps/actions/actions' import { useKitchen } from '../../organisms/Kitchen/hooks' import { getDeckSetupForActiveItem } from '../../top-selectors/labware-locations' import { generateNewProtocol } from '../../labware-ingred/actions' -import { DefineLiquidsModal, EditNavigation } from '../../organisms' +import { DefineLiquidsModal, DesignerNavigation } from '../../organisms' import { selectDesignerTab } from '../../file-data/actions' import { getDesignerTab, getFileMetadata } from '../../file-data/selectors' import { DeckSetupContainer } from './DeckSetup' @@ -151,7 +151,7 @@ export function Designer(): JSX.Element { /> ) : null} - { vi.mocked(AssignLiquidsModal).mockReturnValue(
mock AssignLiquidsModal
) - vi.mocked(EditNavigation).mockReturnValue(
mock EditNavigation
) + vi.mocked(DesignerNavigation).mockReturnValue( +
mock DesignerNavigation
+ ) vi.mocked(LiquidsOverflowMenu).mockReturnValue(
mock LiquidsOverflowMenu
) @@ -55,7 +57,7 @@ describe('Liquids', () => { it('renders nav and assign liquids modal', () => { render() - screen.getByText('mock EditNavigation') + screen.getByText('mock DesignerNavigation') screen.getByText('mock AssignLiquidsModal') }) }) diff --git a/protocol-designer/src/pages/Liquids/index.tsx b/protocol-designer/src/pages/Liquids/index.tsx index c84052a5c6a..3604f9e3d24 100644 --- a/protocol-designer/src/pages/Liquids/index.tsx +++ b/protocol-designer/src/pages/Liquids/index.tsx @@ -9,7 +9,7 @@ import { import { AssignLiquidsModal, DefineLiquidsModal, - EditNavigation, + DesignerNavigation, } from '../../organisms' import { selectors as labwareIngredSelectors } from '../../labware-ingred/selectors' import { LiquidsOverflowMenu } from '../Designer/LiquidsOverflowMenu' @@ -59,7 +59,7 @@ export function Liquids(): JSX.Element { ) : null} - +