mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 11:55:42 +00:00
Merge pull request #1204 from Tria-plc/freight/nati-2
fix: rm the exception
This commit is contained in:
@@ -46,12 +46,7 @@ import PaymentsPage from "./pages/payments/PaymentsPage";
|
|||||||
import AuditLogsPage from "./pages/audit/AuditLogsPage";
|
import AuditLogsPage from "./pages/audit/AuditLogsPage";
|
||||||
//import EmployeesPage from "./pages/dashboard/user-management/EmployeesPage";
|
//import EmployeesPage from "./pages/dashboard/user-management/EmployeesPage";
|
||||||
import { RequirePermission } from "./components/auth/RequirePermission";
|
import { RequirePermission } from "./components/auth/RequirePermission";
|
||||||
import {
|
import { FREIGHT_PERMS } from "./lib/permissions";
|
||||||
FREIGHT_PERMS,
|
|
||||||
isDjiboutiGl,
|
|
||||||
isEthiopianGl,
|
|
||||||
isSuperAdmin,
|
|
||||||
} from "./lib/permissions";
|
|
||||||
import { NO_ACCESS_PATH, resolveLandingPath } from "./lib/landing";
|
import { NO_ACCESS_PATH, resolveLandingPath } from "./lib/landing";
|
||||||
import NoAccessPage from "./pages/NoAccessPage";
|
import NoAccessPage from "./pages/NoAccessPage";
|
||||||
import FileUploadSettingsPage from "./pages/documents/FileUploadSettingsPage";
|
import FileUploadSettingsPage from "./pages/documents/FileUploadSettingsPage";
|
||||||
@@ -118,11 +113,8 @@ import SupportInboxPage from "./pages/support/SupportInboxPage";
|
|||||||
import {
|
import {
|
||||||
APP_TITLE,
|
APP_TITLE,
|
||||||
buildSidebarSections,
|
buildSidebarSections,
|
||||||
DJ_CLEARANCE_HREF,
|
|
||||||
ET_CLEARANCE_HREF,
|
|
||||||
filterSidebarByPermission,
|
filterSidebarByPermission,
|
||||||
findActiveSidebarLabel,
|
findActiveSidebarLabel,
|
||||||
GL_WORKFLOW_PATH_PATTERNS,
|
|
||||||
} from "@/components/layout/sidebar-sections";
|
} from "@/components/layout/sidebar-sections";
|
||||||
|
|
||||||
const DashboardShell = () => {
|
const DashboardShell = () => {
|
||||||
@@ -138,18 +130,6 @@ const DashboardShell = () => {
|
|||||||
);
|
);
|
||||||
const displayName = user?.name?.en || user?.username || user?.email || "User";
|
const displayName = user?.name?.en || user?.username || user?.email || "User";
|
||||||
|
|
||||||
// GL positions are locked to their single clearance page: if they navigate
|
|
||||||
// (or deep-link) anywhere else, send them back to their clearance hub.
|
|
||||||
// Super admin is exempt. Allow the clearance path + its detail sub-routes.
|
|
||||||
const superAdmin = isSuperAdmin(user);
|
|
||||||
const glClearanceHome = !superAdmin
|
|
||||||
? isEthiopianGl(user)
|
|
||||||
? ET_CLEARANCE_HREF
|
|
||||||
: isDjiboutiGl(user)
|
|
||||||
? DJ_CLEARANCE_HREF
|
|
||||||
: null
|
|
||||||
: null;
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const activeLabel = findActiveSidebarLabel(
|
const activeLabel = findActiveSidebarLabel(
|
||||||
location.pathname,
|
location.pathname,
|
||||||
@@ -158,20 +138,9 @@ const DashboardShell = () => {
|
|||||||
document.title = activeLabel ? `${activeLabel} | ${APP_TITLE}` : APP_TITLE;
|
document.title = activeLabel ? `${activeLabel} | ${APP_TITLE}` : APP_TITLE;
|
||||||
}, [location.pathname, sidebarSections]);
|
}, [location.pathname, sidebarSections]);
|
||||||
|
|
||||||
if (
|
|
||||||
glClearanceHome &&
|
|
||||||
!location.pathname.startsWith(glClearanceHome) &&
|
|
||||||
!GL_WORKFLOW_PATH_PATTERNS.some((re) => re.test(location.pathname))
|
|
||||||
) {
|
|
||||||
return <Navigate to={glClearanceHome} replace />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FreightDashboardLayout
|
<FreightDashboardLayout
|
||||||
sidebarSections={sidebarSections}
|
sidebarSections={sidebarSections}
|
||||||
// GL Ethiopia / GL Djibouti are locked to a single clearance page — no
|
|
||||||
// sidebar (or mobile burger) at all; the page renders full width.
|
|
||||||
hideSidebar={Boolean(glClearanceHome)}
|
|
||||||
activeHref={location.pathname}
|
activeHref={location.pathname}
|
||||||
onNavigate={navigate}
|
onNavigate={navigate}
|
||||||
enableThemeToggle
|
enableThemeToggle
|
||||||
|
|||||||
Reference in New Issue
Block a user