Skip to content

Commit

Permalink
move navigate out of props
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed Oct 21, 2024
1 parent 53d8f40 commit bb306f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router-dom'

import {
Box,
Expand Down Expand Up @@ -34,24 +35,24 @@ export type RunHeaderBannerContainerProps = ProtocolRunHeaderProps & {
runErrors: UseRunErrorsResult
runHeaderModalContainerUtils: UseRunHeaderModalContainerResult
hasDownloadableFiles: boolean
deviceDetailsLink: () => void
}

// Holds all the various banners that render in ProtocolRunHeader.
export function RunHeaderBannerContainer(
props: RunHeaderBannerContainerProps
): JSX.Element | null {
const navigate = useNavigate()
const {
runStatus,
enteredER,
runHeaderModalContainerUtils,
hasDownloadableFiles,
deviceDetailsLink,
robotName,
} = props
const { analysisErrorModalUtils } = runHeaderModalContainerUtils

const { t } = useTranslation(['run_details', 'shared'])
const isDoorOpen = useIsDoorOpen(props.robotName)
const isDoorOpen = useIsDoorOpen(robotName)

const {
showRunCanceledBanner,
Expand Down Expand Up @@ -114,7 +115,9 @@ export function RunHeaderBannerContainer(
</Flex>
<Link
textDecoration={TEXT_DECORATION_UNDERLINE}
onClick={deviceDetailsLink}
onClick={() => {
navigate(`/devices/${robotName}`)
}}
>
{t('device_details')}
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ export function ProtocolRunHeader(
'outputFileIds' in runRecord.data &&
runRecord.data.outputFileIds.length > 0
}
deviceDetailsLink={() => {
navigate(`/devices/${robotName}`)
}}
{...props}
/>
<RunHeaderContent
Expand Down

0 comments on commit bb306f3

Please sign in to comment.