From 9860447e424cccfe7d6f45afcb072d8ec405d76b Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 22 Aug 2025 11:03:34 -0400 Subject: [PATCH] feature/IO-3255-simplified-parts-management - Fix Breadcrumbs --- .../breadcrumbs/breadcrumbs.component.jsx | 6 ++--- .../parts-settings.page.component.jsx | 2 +- ...simplified-parts-jobs-detail.container.jsx | 8 +++--- .../simplified-parts-jobs.page.jsx | 2 +- .../simplified-parts.page.component.jsx | 15 ++++++++++- .../vehicles-detail.page.container.jsx | 26 +++++++++---------- .../vehicles/vehicles.page.container.jsx | 2 +- 7 files changed, 36 insertions(+), 25 deletions(-) diff --git a/client/src/components/breadcrumbs/breadcrumbs.component.jsx b/client/src/components/breadcrumbs/breadcrumbs.component.jsx index eac85832c..b9fa57fd4 100644 --- a/client/src/components/breadcrumbs/breadcrumbs.component.jsx +++ b/client/src/components/breadcrumbs/breadcrumbs.component.jsx @@ -22,9 +22,9 @@ export function BreadCrumbs({ breadcrumbs, bodyshop, isPartsEntry }) { } = useSplitTreatments({ attributes: {}, names: ["OpenSearch"], - splitKey: bodyshop && bodyshop.imexshopid + splitKey: bodyshop?.imexshopid }); - // TODO - Client Update - Technically key is not doing anything here + return ( @@ -35,7 +35,7 @@ export function BreadCrumbs({ breadcrumbs, bodyshop, isPartsEntry }) { key: "home", title: ( - {(bodyshop && bodyshop.shopname && `(${bodyshop.shopname})`) || ""} + {(bodyshop?.shopname && `(${bodyshop.shopname})`) || ""} ) }, diff --git a/client/src/pages/parts-settings/parts-settings.page.component.jsx b/client/src/pages/parts-settings/parts-settings.page.component.jsx index ce300727d..2f9bc6e1a 100644 --- a/client/src/pages/parts-settings/parts-settings.page.component.jsx +++ b/client/src/pages/parts-settings/parts-settings.page.component.jsx @@ -34,7 +34,7 @@ export function PartsSettingsPage({ setSelectedHeader, setBreadcrumbs }) { setBreadcrumbs([ { link: "/parts", - label: t("titles.bc.parts") + label: "Parts" }, { link: "/parts/settings", diff --git a/client/src/pages/simplified-parts-jobs-detail/simplified-parts-jobs-detail.container.jsx b/client/src/pages/simplified-parts-jobs-detail/simplified-parts-jobs-detail.container.jsx index 12bb15473..645805bd3 100644 --- a/client/src/pages/simplified-parts-jobs-detail/simplified-parts-jobs-detail.container.jsx +++ b/client/src/pages/simplified-parts-jobs-detail/simplified-parts-jobs-detail.container.jsx @@ -60,19 +60,19 @@ function SimplifiedPartsJobsDetailContainer({ setBreadcrumbs, addRecentItem, set imex: "$t(titles.imexonline)", rome: "$t(titles.romeonline)" }), - ro_number: (data.jobs_by_pk && data.jobs_by_pk.ro_number) || t("general.labels.na") + ro_number: data.jobs_by_pk?.ro_number || t("general.labels.na") }); setBreadcrumbs([ - { link: "/parts/", label: t("titles.bc.jobs") }, + { link: "/parts", label: "Parts" }, { link: `/parts/jobs/${jobId}`, label: t("titles.bc.jobs-detail", { - number: (data && data.jobs_by_pk && data.jobs_by_pk.ro_number) || t("general.labels.na") + number: (data?.jobs_by_pk && data.jobs_by_pk.ro_number) || t("general.labels.na") }) } ]); - if (data && data.jobs_by_pk) { + if (data?.jobs_by_pk) { setJobReadOnly(IsJobReadOnly(data.jobs_by_pk)); addRecentItem( diff --git a/client/src/pages/simplified-parts-jobs/simplified-parts-jobs.page.jsx b/client/src/pages/simplified-parts-jobs/simplified-parts-jobs.page.jsx index ed7215e69..11b206122 100644 --- a/client/src/pages/simplified-parts-jobs/simplified-parts-jobs.page.jsx +++ b/client/src/pages/simplified-parts-jobs/simplified-parts-jobs.page.jsx @@ -22,7 +22,7 @@ export function SimplifiedPartsJobsPage({ setBreadcrumbs, setSelectedHeader }) { }) }); setSelectedHeader("parts-queue"); - setBreadcrumbs([{ link: "/parts", label: t("titles.bc.simplified-parts-jobs") }]); + setBreadcrumbs([{ link: "/parts", label: "Parts" }]); }, [setBreadcrumbs, t, setSelectedHeader]); return ( diff --git a/client/src/pages/simplified-parts/simplified-parts.page.component.jsx b/client/src/pages/simplified-parts/simplified-parts.page.component.jsx index a181dacde..3ff43ae50 100644 --- a/client/src/pages/simplified-parts/simplified-parts.page.component.jsx +++ b/client/src/pages/simplified-parts/simplified-parts.page.component.jsx @@ -3,7 +3,7 @@ import { FloatButton, Layout, Spin } from "antd"; import { lazy, Suspense, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Route, Routes } from "react-router-dom"; +import { Navigate, Route, Routes, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import BreadCrumbs from "../../components/breadcrumbs/breadcrumbs.component.jsx"; import ConflictComponent from "../../components/conflict/conflict.component.jsx"; @@ -39,6 +39,15 @@ const mapStateToProps = createStructuredSelector({ export function SimplifiedPartsPage({ conflict, bodyshop }) { const { t } = useTranslation(); + // Redirector to strip '/parts/jobs' from path for non-detail routes + function JobsStripRedirect() { + // lazy import to avoid top-level import churn + const location = useLocation(); + const { pathname, search, hash } = location; + const target = pathname.replace("/parts/jobs", "/parts") + (search || "") + (hash || ""); + return ; + } + // Centralized alerts handling (fetch + dedupe + notifications) useAlertsNotifications(); @@ -67,6 +76,10 @@ export function SimplifiedPartsPage({ conflict, bodyshop }) { + {/* Redirect legacy or relative routes that include '/jobs' segment */} + } /> + } /> +