22541 extract breadcrumb route-state helper and align phase22 auth locale test

This commit is contained in:
2026-04-09 09:23:22 +01:00
parent 3cea83b7e1
commit 1c06ef1639
7 changed files with 279 additions and 105 deletions
+14 -49
View File
@@ -45,6 +45,7 @@ import {
showRepsEnded,
getBilingualText
} from "./summary/utils/helpers";
import { resolveSearchResultsHref } from "../../lib/routing/routeState";
import CaseNoticeBanner from "./caseNoticeBanner";
import WatchModal from "./watchmodal";
@@ -324,52 +325,19 @@ const CaseSummary = (props) => {
const zoom = isNaN(parseFloat(siteCoords.latitude)) ? 7 : 12;
const buildSearchHref = (router, session) => {
const { va, adv, ads, key } = router.query;
const isDnsRoute =
router.pathname === "/dns" ||
router.pathname.startsWith("/dns/") ||
router.pathname === "/myportal/dns" ||
router.pathname.startsWith("/myportal/dns/");
const isDnsRoute =
router.pathname === "/dns" ||
router.pathname.startsWith("/dns/") ||
router.pathname === "/myportal/dns" ||
router.pathname.startsWith("/myportal/dns/");
const base = session ? "/myportal" : "";
if (!va && !adv && !ads) {
return {
pathname: "/myportal"
};
}
if (isDnsRoute) {
return {
pathname: `${base}/dnsapplications`
};
}
if (va === "true") {
return {
pathname: "/myportal/viewall",
query: { key }
};
}
if (adv === "true") {
return {
pathname: `${base}/advancedsearchresults`,
query: router.query
};
}
if (ads === "true") {
return {
pathname: `${base}/addresssearchresults`,
query: router.query
};
}
return { pathname: `${base}/searchresults`, query: router.query };
};
const searchHref = resolveSearchResultsHref({
query: router.query,
hasSession: Boolean(session),
includeViewAll: true,
fallbackToMyPortalWhenNoFlags: true,
isDnsRoute
});
let showDetailsBlock =
showDetails == true ? (
@@ -1043,10 +1011,7 @@ const CaseSummary = (props) => {
<Link
className="govuk-button govuk-button--secondary"
href={buildSearchHref(
router,
session
)}
href={searchHref}
>
{" "}
{t(