Skip to content

Commit

Permalink
rename ProtocolNavBar to EditNavigation
Browse files Browse the repository at this point in the history
  • Loading branch information
koji committed Dec 17, 2024
1 parent 48104c0 commit a7989c0
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fireEvent, screen } from '@testing-library/react'

import { i18n } from '../../../assets/localization'
import { renderWithProviders } from '../../../__testing-utils__'
import { LiquidButton } from '../LiquidButton'
import { LiquidButton } from '../../../molecules/LiquidButton'

import type { ComponentProps } from 'react'

Expand Down
1 change: 1 addition & 0 deletions protocol-designer/src/molecules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export * from './CheckboxExpandStepFormField'
export * from './CheckboxStepFormField'
export * from './DropdownStepFormField'
export * from './InputStepFormField'
export * from './LiquidButton'
export * from './ToggleExpandStepFormField'
export * from './ToggleStepFormField'
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { describe, it, beforeEach, vi } from 'vitest'
import { renderWithProviders } from '../../../__testing-utils__'
import { i18n } from '../../../assets/localization'
import { getFileMetadata } from '../../../file-data/selectors'
import { LiquidButton } from '../LiquidButton'
import { LiquidButton } from '../../../molecules/LiquidButton'

import { ProtocolNavBar } from '..'
import { EditNavigation } from '..'

import type { ComponentProps } from 'react'
import type { NavigateFunction } from 'react-router-dom'
Expand All @@ -24,14 +24,14 @@ vi.mock('react-router-dom', async importOriginal => {
}
})

const render = (props: ComponentProps<typeof ProtocolNavBar>) => {
return renderWithProviders(<ProtocolNavBar {...props} />, {
const render = (props: ComponentProps<typeof EditNavigation>) => {
return renderWithProviders(<EditNavigation {...props} />, {
i18nInstance: i18n,
})
}

describe('ProtocolNavBar', () => {
let props: ComponentProps<typeof ProtocolNavBar>
describe('EditNavigation', () => {
let props: ComponentProps<typeof EditNavigation>
beforeEach(() => {
props = {
hasZoomInSlot: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ import { getFileMetadata } from '../../file-data/selectors'
import { selectTerminalItem } from '../../ui/steps/actions/actions'
import { LINE_CLAMP_TEXT_STYLE, NAV_BAR_HEIGHT_REM } from '../../atoms'
import { useKitchen } from '../Kitchen/hooks'
import { LiquidButton } from './LiquidButton'
import { LiquidButton } from '../../molecules/LiquidButton'

import type { StyleProps, TabProps } from '@opentrons/components'

interface ProtocolNavBarProps {
interface EditNavigationProps {
hasZoomInSlot?: boolean
tabs?: TabProps[]
hasTrashEntity?: boolean
showLiquidOverflowMenu?: (liquidOverflowMenu: boolean) => void
liquidPage?: boolean
}

export function ProtocolNavBar({
export function EditNavigation({
hasZoomInSlot,
tabs = [],
hasTrashEntity,
showLiquidOverflowMenu,
liquidPage = false,
}: ProtocolNavBarProps): JSX.Element {
}: EditNavigationProps): JSX.Element {
const { t } = useTranslation('starting_deck_state')
const metadata = useSelector(getFileMetadata)
const { makeSnackbar } = useKitchen()
Expand Down
4 changes: 2 additions & 2 deletions protocol-designer/src/organisms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from './ConfirmDeleteStagingAreaModal'
export * from './DefineLiquidsModal'
export * from './DisabledScreen'
export * from './EditInstrumentsModal'
export * from './EditNavigation'
export * from './EditNickNameModal'
export * from './EditProtocolMetadataModal'
export * from './FileUploadMessagesModal/'
Expand All @@ -17,10 +18,9 @@ export * from './Kitchen'
export * from './KnowledgeLink'
export * from './LabwareOnDeck'
export * from './LabwareUploadModal'
export * from './NavigationBar'
export * from './Navigation'
export * from './PipetteInfoItem'
export * from './Portal'
export * from './ProtocolNavBar'
export * from './SelectWellsModal'
export * from './SettingsIcon'
export * from './SlotDetailsContainer'
Expand Down
4 changes: 2 additions & 2 deletions protocol-designer/src/pages/Designer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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, ProtocolNavBar } from '../../organisms'
import { DefineLiquidsModal, EditNavigation } from '../../organisms'
import { selectDesignerTab } from '../../file-data/actions'
import { getDesignerTab, getFileMetadata } from '../../file-data/selectors'
import { DeckSetupContainer } from './DeckSetup'
Expand Down Expand Up @@ -151,7 +151,7 @@ export function Designer(): JSX.Element {
/>
) : null}
<Flex flexDirection={DIRECTION_COLUMN} minHeight={FLEX_MAX_CONTENT}>
<ProtocolNavBar
<EditNavigation
hasZoomInSlot={zoomIn.slot != null || zoomIn.cutout != null}
hasTrashEntity={hasTrashEntity}
showLiquidOverflowMenu={showLiquidOverflowMenu}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { screen } from '@testing-library/react'
import { i18n } from '../../../assets/localization'
import { renderWithProviders } from '../../../__testing-utils__'
import { selectors as labwareIngredSelectors } from '../../../labware-ingred/selectors'
import { AssignLiquidsModal, ProtocolNavBar } from '../../../organisms'
import { AssignLiquidsModal, EditNavigation } from '../../../organisms'
import { LiquidsOverflowMenu } from '../../Designer/LiquidsOverflowMenu'
import { Liquids } from '..'

Expand Down Expand Up @@ -42,7 +42,7 @@ describe('Liquids', () => {
vi.mocked(AssignLiquidsModal).mockReturnValue(
<div>mock AssignLiquidsModal</div>
)
vi.mocked(ProtocolNavBar).mockReturnValue(<div>mock ProtocolNavBar</div>)
vi.mocked(EditNavigation).mockReturnValue(<div>mock EditNavigation</div>)
vi.mocked(LiquidsOverflowMenu).mockReturnValue(
<div>mock LiquidsOverflowMenu</div>
)
Expand All @@ -55,7 +55,7 @@ describe('Liquids', () => {

it('renders nav and assign liquids modal', () => {
render()
screen.getByText('mock ProtocolNavBar')
screen.getByText('mock EditNavigation')
screen.getByText('mock AssignLiquidsModal')
})
})
4 changes: 2 additions & 2 deletions protocol-designer/src/pages/Liquids/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import {
AssignLiquidsModal,
DefineLiquidsModal,
ProtocolNavBar,
EditNavigation,
} from '../../organisms'
import { selectors as labwareIngredSelectors } from '../../labware-ingred/selectors'
import { LiquidsOverflowMenu } from '../Designer/LiquidsOverflowMenu'
Expand Down Expand Up @@ -59,7 +59,7 @@ export function Liquids(): JSX.Element {
) : null}

<Flex flexDirection={DIRECTION_COLUMN}>
<ProtocolNavBar
<EditNavigation
liquidPage
showLiquidOverflowMenu={showLiquidOverflowMenu}
/>
Expand Down

0 comments on commit a7989c0

Please sign in to comment.