22541 consolidate static text breadcrumb route branches
This commit is contained in:
+23
-101
@@ -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 = () => (
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href={myPortalHref} className="govuk-breadcrumbs__link">
|
||||
@@ -554,13 +575,6 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/account/register") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("account:register-new-account-heading")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/account/changepassword") && (
|
||||
<>
|
||||
{renderLinkCrumb(
|
||||
@@ -572,21 +586,6 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/dns") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("dnsCommon:service-name")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
|
||||
{isPath("/dnsapplications") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("dnsCommon:service-name")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/dnsdetails") && (
|
||||
<>
|
||||
{renderLinkCrumb(
|
||||
@@ -609,34 +608,6 @@ const Breadcrumbs = (props) => {
|
||||
{renderCaseReferenceCrumb(caseReferenceDisplay)}
|
||||
</>
|
||||
)}
|
||||
{isPath("/dns/application-process") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Guidance
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/dns/help") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Help
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/dns/contact-us") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:footer-contact-us-link-label")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/dns/applications") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("dnsApplications:page-title")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/dns/application-view") && (
|
||||
<>
|
||||
{renderLinkCrumb(
|
||||
@@ -650,57 +621,8 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/help/cookies") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("cookies:cookie-breadcrumb")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/privacy") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:footer-privacy-link-label")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/accessibility") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t(
|
||||
"common:footer-accessibility-link-label"
|
||||
)}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/details-about-cookies") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("cookies:cookie-policy-title-heading")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/auth/signin") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("auth:auth-page-title")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/auth/verify-request") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("auth:auth-check-email-page-title")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{isPath("/auth/error") && (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("auth:auth-error-signin-error-title")}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
{getStaticTextCrumbLabel(pathname) &&
|
||||
renderTextCrumb(getStaticTextCrumbLabel(pathname))}
|
||||
</ol>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
Reference in New Issue
Block a user