22541 expand breadcrumb route-state helpers for label and dns path reuse
This commit is contained in:
@@ -13,8 +13,8 @@ import {
|
||||
setRepresentationSubmit
|
||||
} from "../store/currentView/action";
|
||||
import {
|
||||
normalizeRouteStateQuery,
|
||||
resolveSearchResultsHref
|
||||
resolveSearchResultsHref,
|
||||
resolveSearchBreadcrumbLabel
|
||||
} from "../lib/routing/routeState";
|
||||
const Breadcrumbs = (props) => {
|
||||
const {
|
||||
@@ -73,9 +73,6 @@ const Breadcrumbs = (props) => {
|
||||
? 9
|
||||
: "";
|
||||
|
||||
const routeState = normalizeRouteStateQuery(router.query);
|
||||
const { viewAll, advanced, address, key } = routeState;
|
||||
|
||||
const hideServiceNamePaths = [
|
||||
"/myportal/[appealtypes]",
|
||||
"/newappeal",
|
||||
@@ -112,24 +109,13 @@ const Breadcrumbs = (props) => {
|
||||
fallbackToMyPortalWhenNoFlags: false
|
||||
});
|
||||
|
||||
const breadcrumbLabel = (() => {
|
||||
if (viewAll) {
|
||||
return getViewAllLabel(key);
|
||||
}
|
||||
|
||||
const keyedLabel = getViewAllLabel(key);
|
||||
if (keyedLabel) return keyedLabel;
|
||||
|
||||
if (advanced) {
|
||||
return t("common:breadcrumb-advanced-search-results");
|
||||
}
|
||||
|
||||
if (address) {
|
||||
return t("common:breadcrumb-address-search-results");
|
||||
}
|
||||
|
||||
return t("common:breadcrumb-search-results");
|
||||
})();
|
||||
const breadcrumbLabel = resolveSearchBreadcrumbLabel({
|
||||
query: router.query,
|
||||
getViewAllLabel,
|
||||
advancedLabel: t("common:breadcrumb-advanced-search-results"),
|
||||
addressLabel: t("common:breadcrumb-address-search-results"),
|
||||
defaultLabel: t("common:breadcrumb-search-results")
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<nav
|
||||
|
||||
@@ -45,7 +45,10 @@ import {
|
||||
showRepsEnded,
|
||||
getBilingualText
|
||||
} from "./summary/utils/helpers";
|
||||
import { resolveSearchResultsHref } from "../../lib/routing/routeState";
|
||||
import {
|
||||
resolveSearchResultsHref,
|
||||
isDnsRoutePath
|
||||
} from "../../lib/routing/routeState";
|
||||
|
||||
import CaseNoticeBanner from "./caseNoticeBanner";
|
||||
import WatchModal from "./watchmodal";
|
||||
@@ -325,11 +328,7 @@ const CaseSummary = (props) => {
|
||||
|
||||
const zoom = isNaN(parseFloat(siteCoords.latitude)) ? 7 : 12;
|
||||
|
||||
const isDnsRoute =
|
||||
router.pathname === "/dns" ||
|
||||
router.pathname.startsWith("/dns/") ||
|
||||
router.pathname === "/myportal/dns" ||
|
||||
router.pathname.startsWith("/myportal/dns/");
|
||||
const isDnsRoute = isDnsRoutePath(router.pathname);
|
||||
|
||||
const searchHref = resolveSearchResultsHref({
|
||||
query: router.query,
|
||||
|
||||
Reference in New Issue
Block a user