22541 extract grouped breadcrumb pair helpers for myportal and dns routes

This commit is contained in:
2026-04-09 09:52:42 +01:00
parent e24ab89e83
commit a8ef55c65a
2 changed files with 63 additions and 46 deletions
+35 -46
View File
@@ -121,6 +121,13 @@ const Breadcrumbs = (props) => {
</li>
);
const renderMyPortalSectionCrumbs = (sectionLabel) => (
<>
{renderMyPortalCrumb()}
{renderTextCrumb(sectionLabel)}
</>
);
const renderCaseReferenceCrumb = (referenceValue) => (
<li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-case-reference")}: {referenceValue}
@@ -165,6 +172,18 @@ const Breadcrumbs = (props) => {
listItemClass = "govuk-breadcrumbs__link-item backChevron"
) => renderAnchorCrumb("#", t("common:back-link"), onClick, listItemClass);
const renderDnsCaseReferenceCrumbs = (referenceValue) => (
<>
{renderLinkCrumb(
isWelsh
? router.locale + "/dnsapplications"
: "/dnsapplications",
t("dnsCommon:service-name")
)}
{renderCaseReferenceCrumb(referenceValue)}
</>
);
const { breadcrumbHref, caseResultsHref, breadcrumbLabel } =
resolveCaseBreadcrumbState({
query: router.query,
@@ -226,30 +245,18 @@ const Breadcrumbs = (props) => {
)}
</>
)}
{isPath("/myportal/addresssearch") && (
<>
{renderMyPortalCrumb()}
{renderTextCrumb(
t("common:breadcrumb-address-search")
)}
</>
)}
{isPath("/myportal/advancedsearch") && (
<>
{renderMyPortalCrumb()}
{renderTextCrumb(
t("common:breadcrumb-advanced-search")
)}
</>
)}
{isPath("/myportal/contactus") && (
<>
{renderMyPortalCrumb()}
{renderTextCrumb(
t("common:footer-contact-us-link-label")
)}
</>
)}
{isPath("/myportal/addresssearch") &&
renderMyPortalSectionCrumbs(
t("common:breadcrumb-address-search")
)}
{isPath("/myportal/advancedsearch") &&
renderMyPortalSectionCrumbs(
t("common:breadcrumb-advanced-search")
)}
{isPath("/myportal/contactus") &&
renderMyPortalSectionCrumbs(
t("common:footer-contact-us-link-label")
)}
{isPath("/contactus") && (
<>
{renderTextCrumb(
@@ -586,28 +593,10 @@ const Breadcrumbs = (props) => {
</li>
</>
)}
{isPath("/dnsdetails") && (
<>
{renderLinkCrumb(
isWelsh
? router.locale + "/dnsapplications"
: "/dnsapplications",
t("dnsCommon:service-name")
)}
{renderCaseReferenceCrumb(currentReference)}
</>
)}
{isPath("/dns/[developmentName]") && (
<>
{renderLinkCrumb(
isWelsh
? router.locale + "/dnsapplications"
: "/dnsapplications",
t("dnsCommon:service-name")
)}
{renderCaseReferenceCrumb(caseReferenceDisplay)}
</>
)}
{isPath("/dnsdetails") &&
renderDnsCaseReferenceCrumbs(currentReference)}
{isPath("/dns/[developmentName]") &&
renderDnsCaseReferenceCrumbs(caseReferenceDisplay)}
{isPath("/dns/application-view") && (
<>
{renderLinkCrumb(