From 30bc729c7057d9ceac8b8d3d64261e26f229d05a Mon Sep 17 00:00:00 2001 From: robbond Date: Thu, 9 Apr 2026 09:41:33 +0100 Subject: [PATCH] 22541 consolidate remaining inline Link breadcrumb patterns --- components/breadcrumbs.js | 236 +++++++++++++------------------------- memory-bank/change-log.md | 29 +++++ 2 files changed, 108 insertions(+), 157 deletions(-) diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 4ba0a75f..e0b50d4e 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -140,16 +140,11 @@ const Breadcrumbs = (props) => { >
    - {shouldShowServiceName && ( -
  1. - - {t("common:service-name-breadcrumb")} - -
  2. - )} + {shouldShowServiceName && + renderLinkCrumb( + "/", + t("common:service-name-breadcrumb") + )} {isPath("/myportal") && (
  3. @@ -359,22 +354,14 @@ const Breadcrumbs = (props) => { )} {isPath("/newappeal/selectappeal") && ( <> -
  4. - - {t("newappeal:parent-page-title")} - -
  5. -
  6. - - {t("newappeal:page-title")} - -
  7. + {renderLinkCrumb( + myPortalHref, + t("newappeal:parent-page-title") + )} + {renderLinkCrumb( + myPortalHref, + t("newappeal:page-title") + )}
  8. Select Appeal
  9. @@ -401,70 +388,46 @@ const Breadcrumbs = (props) => { )} {isPath("/myportal/case") && ( <> -
  10. - - {t("common:breadcrumb-my-portal")} - -
  11. + {renderLinkCrumb( + isWelsh + ? "/" + router.locale + "/fymhorth" + : "/myportal", + t("common:breadcrumb-my-portal") + )} {renderCaseReferenceCrumb(currentReference)} )} {isPath("/case/[ticketnumber]") && ( <> -
  12. - - {breadcrumbLabel} - -
  13. + {renderLinkCrumb( + caseResultsHref, + breadcrumbLabel + )} {renderCaseReferenceCrumb(fallbackSearchTitle)} )} {isPath("/case/id/[incident]") && ( <> -
  14. - - {t("common:breadcrumb-address-search")} - -
  15. -
  16. - - {t( - "common:breadcrumb-address-search-results" - )} - -
  17. + {renderLinkCrumb( + isWelsh + ? "/" + + router.locale + + "/chwiliadcyfeiriadau" + : "/addresssearch", + t("common:breadcrumb-address-search") + )} + {renderLinkCrumb( + isWelsh + ? "/" + + router.locale + + "/canlyniadaucyfeiriadau?" + + nestedSearchString + : "/addresssearchresults?" + + nestedSearchString, + t( + "common:breadcrumb-address-search-results" + ) + )} {renderCaseReferenceCrumb(currentReference)} )} @@ -502,14 +465,10 @@ const Breadcrumbs = (props) => { {isPath("/myportal/case/[ticketnumber]") && ( <> {renderMyPortalCrumb()} -
  18. - - {breadcrumbLabel} - -
  19. + {renderLinkCrumb( + breadcrumbHref, + breadcrumbLabel + )} {renderCaseReferenceCrumb(caseReferenceDisplay)} )} @@ -532,18 +491,12 @@ const Breadcrumbs = (props) => { )} {isPath("/myportal/dns/[developmentName]") && ( <> -
  20. - - {t("common:breadcrumb-my-portal")} - -
  21. + {renderLinkCrumb( + isWelsh + ? router.locale + "/fymhorth" + : "/myportal", + t("common:breadcrumb-my-portal") + )} {renderLinkCrumb( "/myportal/dnsapplications", t("dnsCommon:service-name") @@ -643,14 +596,10 @@ const Breadcrumbs = (props) => { )} {isPath("/account/personaldetails") && ( <> -
  22. - - {t("common:breadcrumb-my-portal")} - -
  23. + {renderLinkCrumb( + cyMyPortalHref, + t("common:breadcrumb-my-portal") + )}
  24. {t("account:account-title")}
  25. @@ -665,14 +614,10 @@ const Breadcrumbs = (props) => { )} {isPath("/account/changepassword") && ( <> -
  26. - - {t("common:breadcrumb-my-portal")} - -
  27. + {renderLinkCrumb( + cyMyPortalHref, + t("common:breadcrumb-my-portal") + )}
  28. Update your password
  29. @@ -695,37 +640,23 @@ const Breadcrumbs = (props) => { )} {isPath("/dnsdetails") && ( <> -
  30. - - {t("dnsCommon:service-name")} - -
  31. + {renderLinkCrumb( + isWelsh + ? router.locale + "/dnsapplications" + : "/dnsapplications", + t("dnsCommon:service-name") + )} {renderCaseReferenceCrumb(currentReference)} )} {isPath("/dns/[developmentName]") && ( <> -
  32. - - {t("dnsCommon:service-name")} - -
  33. + {renderLinkCrumb( + isWelsh + ? router.locale + "/dnsapplications" + : "/dnsapplications", + t("dnsCommon:service-name") + )} {renderCaseReferenceCrumb(caseReferenceDisplay)} )} @@ -759,21 +690,12 @@ const Breadcrumbs = (props) => { )} {isPath("/dns/application-view") && ( <> -
  34. - - {t( - "dnsApplicationView:page-parent-title" - )} - -
  35. + {renderLinkCrumb( + isWelsh + ? router.locale + "/dns/applications" + : "/dns/applications", + t("dnsApplicationView:page-parent-title") + )}
  36. TWA - Morlais Demonstration Zone
  37. diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index 879906df..0e69d8bc 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -190,6 +190,35 @@ Follow-ups: - Next slice recommendation: extract remaining repeated inline link crumbs for case/DNS branches that still hardcode `
  38. ` (e.g., `/myportal/case`, `/myportal/case/[ticketnumber]`, `/dnsdetails`, `/dns/[developmentName]`) to complete link-pattern consolidation. +### CL-22541-G: breadcrumbs inline Link-crumb consolidation bundle + +date: 2026-04-09 +author: Cline +scope: `components/breadcrumbs.js` +type: change +rationale: Continue the larger bounded breadcrumb refactor cadence by replacing the next batch of repeated inline `
  39. ` crumbs with the shared link helper. +impact: Refactor-only JSX deduplication and consistency improvement in breadcrumb rendering; no intended route/auth/session/API/EN-CY/a11y behavior change. +status: completed + +Summary: + +- Reused `renderLinkCrumb(href, label, onClick)` for another broad set of previously inline Link crumbs, including: + - service-name crumb in the shared shell + - new appeal select-appeal parent/title crumbs + - case and ticketnumber branches (`/myportal/case`, `/case/[ticketnumber]`, `/case/id/[incident]`, `/myportal/case/[ticketnumber]`) + - additional myportal/dns/account branches (`/myportal/dns/[developmentName]`, `/dnsdetails`, `/dns/[developmentName]`, `/dns/application-view`, account crumbs) +- Kept special behavior intact where needed (e.g., existing callback-based crumbs that already use helper `onClick`). +- Increased consistency of crumb rendering style by routing most link crumbs through one helper. + +Validation: + +- `npx eslint components/breadcrumbs.js` -> pass. +- `node tests/phase22/index.test.cjs` -> pass (combined suite). + +Follow-ups: + +- Next slice recommendation: target remaining anchor/back-link duplication (`` and occasional ``) by introducing a bounded helper for action/back crumbs while preserving existing non-Link semantics. + ### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction date: 2026-04-07