Skip to content

Commit

Permalink
fix test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
koji committed Dec 17, 2024
1 parent 9629289 commit 740f35f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ vi.mock('react-router-dom', async importOriginal => {
return {
...reactRouterDom,
useNavigate: () => mockNavigate,
useLocation: () => ({
location: {
pathname: '/designer',
},
}),
}
})

Expand Down
12 changes: 6 additions & 6 deletions protocol-designer/src/organisms/EditNavigation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useDispatch, useSelector } from 'react-redux'
import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router-dom'
import { useLocation, useNavigate } from 'react-router-dom'
import styled from 'styled-components'

import {
Expand Down Expand Up @@ -29,26 +29,26 @@ interface EditNavigationProps {
tabs?: TabProps[]
hasTrashEntity?: boolean
showLiquidOverflowMenu?: (liquidOverflowMenu: boolean) => void
liquidPage?: boolean
}

export function EditNavigation({
hasZoomInSlot,
tabs = [],
hasTrashEntity,
showLiquidOverflowMenu,
liquidPage = false,
}: EditNavigationProps): JSX.Element {
const { t } = useTranslation('starting_deck_state')
const location = useLocation()
const metadata = useSelector(getFileMetadata)
const { makeSnackbar } = useKitchen()
const navigate = useNavigate()
const dispatch = useDispatch()
const isLiquidsPage = location.pathname === '/liquids'

const showProtocolEditButtons = !(hasZoomInSlot || liquidPage)
const showProtocolEditButtons = !(hasZoomInSlot || isLiquidsPage)

let metadataText = t('edit_protocol')
if (liquidPage) {
if (isLiquidsPage) {
metadataText = t('add_liquid')
} else if (hasZoomInSlot) {
metadataText = t('add_hardware_labware')
Expand Down Expand Up @@ -76,7 +76,7 @@ export function EditNavigation({
<LiquidButton showLiquidOverflowMenu={showLiquidOverflowMenu} />
) : null}

{liquidPage ? null : (
{isLiquidsPage ? null : (
<SecondaryButton
onClick={() => {
if (hasTrashEntity) {
Expand Down
5 changes: 1 addition & 4 deletions protocol-designer/src/pages/Liquids/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ export function Liquids(): JSX.Element {
) : null}

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

0 comments on commit 740f35f

Please sign in to comment.