diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 6763bd83..47ccd1e4 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -92,6 +92,27 @@ const Breadcrumbs = (props) => { return labelsByKey[viewKey] || null; }; + const getStaticTextCrumbLabel = (path) => { + const staticTextCrumbByPath = { + "/account/register": t("account:register-new-account-heading"), + "/dns": t("dnsCommon:service-name"), + "/dnsapplications": t("dnsCommon:service-name"), + "/dns/application-process": "Guidance", + "/dns/help": "Help", + "/dns/contact-us": t("common:footer-contact-us-link-label"), + "/dns/applications": t("dnsApplications:page-title"), + "/help/cookies": t("cookies:cookie-breadcrumb"), + "/privacy": t("common:footer-privacy-link-label"), + "/accessibility": t("common:footer-accessibility-link-label"), + "/details-about-cookies": t("cookies:cookie-policy-title-heading"), + "/auth/signin": t("auth:auth-page-title"), + "/auth/verify-request": t("auth:auth-check-email-page-title"), + "/auth/error": t("auth:auth-error-signin-error-title") + }; + + return staticTextCrumbByPath[path] || null; + }; + const renderMyPortalCrumb = () => (
  • @@ -554,13 +575,6 @@ const Breadcrumbs = (props) => {
  • )} - {isPath("/account/register") && ( - <> -
  • - {t("account:register-new-account-heading")} -
  • - - )} {isPath("/account/changepassword") && ( <> {renderLinkCrumb( @@ -572,21 +586,6 @@ const Breadcrumbs = (props) => { )} - {isPath("/dns") && ( - <> -
  • - {t("dnsCommon:service-name")} -
  • - - )} - - {isPath("/dnsapplications") && ( - <> -
  • - {t("dnsCommon:service-name")} -
  • - - )} {isPath("/dnsdetails") && ( <> {renderLinkCrumb( @@ -609,34 +608,6 @@ const Breadcrumbs = (props) => { {renderCaseReferenceCrumb(caseReferenceDisplay)} )} - {isPath("/dns/application-process") && ( - <> -
  • - Guidance -
  • - - )} - {isPath("/dns/help") && ( - <> -
  • - Help -
  • - - )} - {isPath("/dns/contact-us") && ( - <> -
  • - {t("common:footer-contact-us-link-label")} -
  • - - )} - {isPath("/dns/applications") && ( - <> -
  • - {t("dnsApplications:page-title")} -
  • - - )} {isPath("/dns/application-view") && ( <> {renderLinkCrumb( @@ -650,57 +621,8 @@ const Breadcrumbs = (props) => { )} - {isPath("/help/cookies") && ( - <> -
  • - {t("cookies:cookie-breadcrumb")} -
  • - - )} - {isPath("/privacy") && ( - <> -
  • - {t("common:footer-privacy-link-label")} -
  • - - )} - {isPath("/accessibility") && ( - <> -
  • - {t( - "common:footer-accessibility-link-label" - )} -
  • - - )} - {isPath("/details-about-cookies") && ( - <> -
  • - {t("cookies:cookie-policy-title-heading")} -
  • - - )} - {isPath("/auth/signin") && ( - <> -
  • - {t("auth:auth-page-title")} -
  • - - )} - {isPath("/auth/verify-request") && ( - <> -
  • - {t("auth:auth-check-email-page-title")} -
  • - - )} - {isPath("/auth/error") && ( - <> -
  • - {t("auth:auth-error-signin-error-title")} -
  • - - )} + {getStaticTextCrumbLabel(pathname) && + renderTextCrumb(getStaticTextCrumbLabel(pathname))} diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index 393cffac..61b80235 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -275,6 +275,36 @@ Follow-ups: - Next slice recommendation: consider extracting a small, route-keyed breadcrumb branch map/helper grouping in `components/breadcrumbs.js` (purely structural) to reduce the long inline conditional chain while keeping one-slice behavior parity. +### CL-22541-J: breadcrumbs static text-only route crumb consolidation + +date: 2026-04-09 +author: Cline +scope: `components/breadcrumbs.js` +type: change +rationale: Continue the same bounded refactor cadence by consolidating repeated static text-only breadcrumb route branches into one route-label resolver. +impact: Refactor-only structural deduplication/readability improvement; no intended route/auth/session/API/EN-CY/a11y behavior change. +status: completed + +Summary: + +- Added `getStaticTextCrumbLabel(path)` in `components/breadcrumbs.js` to centralize static text-only crumb labels by pathname. +- Replaced repeated single-line static crumb branches with one generic render path: + - `renderTextCrumb(getStaticTextCrumbLabel(pathname))` when mapping returns a label. +- Consolidated static branch handling for routes including: + - account register + - DNS index/help/contact/applications process pages + - cookies/privacy/accessibility/static auth routes. +- Preserved route labels (including translation keys and legacy hardcoded labels where already present). + +Validation: + +- `npx eslint components/breadcrumbs.js` -> pass. +- `node tests/phase22/index.test.cjs` -> pass (combined suite). + +Follow-ups: + +- Next slice recommendation: extract a small grouped helper for recurring two-crumb route pairs (e.g., my-portal + section label, dns list + case reference) to reduce the remaining conditional chain while preserving explicit route behavior. + ### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction date: 2026-04-07