diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 577a8ec7..21e36402 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -92,6 +92,14 @@ const Breadcrumbs = (props) => { return labelsByKey[viewKey] || null; }; + const renderMyPortalCrumb = () => ( +
  • + + {t("common:breadcrumb-my-portal")} + +
  • + ); + const { breadcrumbHref, caseResultsHref, breadcrumbLabel } = resolveCaseBreadcrumbState({ query: router.query, @@ -164,14 +172,7 @@ const Breadcrumbs = (props) => { )} {isPath("/myportal/addresssearch") && ( <> -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • {t("common:breadcrumb-address-search")}
  • @@ -179,14 +180,7 @@ const Breadcrumbs = (props) => { )} {isPath("/myportal/advancedsearch") && ( <> -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • {t("common:breadcrumb-advanced-search")}
  • @@ -194,14 +188,7 @@ const Breadcrumbs = (props) => { )} {isPath("/myportal/contactus") && ( <> -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • {t("common:footer-contact-us-link-label")}
  • @@ -262,14 +249,7 @@ const Breadcrumbs = (props) => { )} {isPath("/myportal/advancedsearchresults") && ( <> -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • { )} {isPath("/myportal/addresssearchresults") && ( <> -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • { )} {isPath("/viewall") && ( <> -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • {t("common:breadcrumb-your-cases")}
  • @@ -428,14 +394,7 @@ const Breadcrumbs = (props) => { )} {isPath("/myportal/viewall") && ( <> -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • {getViewAllLabel( currentViewState.viewKey || @@ -525,14 +484,7 @@ const Breadcrumbs = (props) => { {isPath("/myportal/case/id/[incident]") && ( <> {" "} -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • { )} {isPath("/myportal/case/[ticketnumber]") && ( <> -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • { {isPath("/myportal/dnsapplications") && ( <> {" "} -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • {t("dnsCommon:service-name")}
  • @@ -617,14 +555,7 @@ const Breadcrumbs = (props) => { )} {isPath("/myportal/dnsdetails") && ( <> -
  • - - {t("common:breadcrumb-my-portal")} - -
  • + {renderMyPortalCrumb()}
  • ` markup into one local render helper to reduce duplication and keep follow-on slices safer. +impact: Refactor-only JSX deduplication in breadcrumb rendering; no intended route, auth/session, API, EN/CY, or accessibility behavior change. +status: completed + +Summary: + +- Added local `renderMyPortalCrumb()` helper in `components/breadcrumbs.js`. +- Replaced repeated identical my-portal crumb JSX in multiple `/myportal/*` route branches with helper calls. +- Kept special-case crumbs untouched where label/href differs (e.g. `newappeal` parent-title crumb, `cyMyPortalHref` account branches). + +Validation: + +- `npx eslint components/breadcrumbs.js` -> pass. +- `node tests/phase22/index.test.cjs` -> pass (combined suite). + +Follow-ups: + +- Next bounded slice can target additional repeated breadcrumb list-item patterns (e.g., repeated case-reference tail item blocks) with same behavior parity approach. + ### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction date: 2026-04-07