diff --git a/src/applications/mhv-medical-records/components/MrBreadcrumbs.jsx b/src/applications/mhv-medical-records/components/MrBreadcrumbs.jsx index e74b44d94acc..a93a00502da7 100644 --- a/src/applications/mhv-medical-records/components/MrBreadcrumbs.jsx +++ b/src/applications/mhv-medical-records/components/MrBreadcrumbs.jsx @@ -1,7 +1,7 @@ import { VaBreadcrumbs } from '@department-of-veterans-affairs/component-library/dist/react-bindings'; import React, { useEffect, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { Link, useHistory, useLocation } from 'react-router-dom'; +import { Link, useHistory, useLocation, useParams } from 'react-router-dom'; import { Breadcrumbs, Paths } from '../util/constants'; import { setBreadcrumbs } from '../actions/breadcrumbs'; import { clearPageNumber, setPageNumber } from '../actions/pageTracker'; @@ -28,6 +28,7 @@ const MrBreadcrumbs = () => { const textContent = document.querySelector('h1')?.textContent; const searchIndex = new URLSearchParams(window.location.search); const page = searchIndex.get('page'); + const { labId } = useParams(); useEffect( () => { @@ -75,6 +76,10 @@ const MrBreadcrumbs = () => { history.push(href); }; + const backToImagesBreadcrumb = location.pathname.includes('/images') + ? crumbsList[crumbsList.length - 1].href + : `/${locationBasePath}`; + if (!phase0p5Flag) { if (location.pathname === '/' || !crumbsList) { return
; @@ -94,17 +99,36 @@ const MrBreadcrumbs = () => {
); } + if ( + phase0p5Flag && + location.pathname.includes(`/${locationBasePath}/${labId}`) + ) { + return ( +
+ + + + Back +
+ ); + } return ( - + <> + + ); };