mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
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 EmployeesPage from "./pages/dashboard/user-management/EmployeesPage";
|
||||
import { RequirePermission } from "./components/auth/RequirePermission";
|
||||
import {
|
||||
FREIGHT_PERMS,
|
||||
isDjiboutiGl,
|
||||
isEthiopianGl,
|
||||
isSuperAdmin,
|
||||
} from "./lib/permissions";
|
||||
import { FREIGHT_PERMS } from "./lib/permissions";
|
||||
import { NO_ACCESS_PATH, resolveLandingPath } from "./lib/landing";
|
||||
import NoAccessPage from "./pages/NoAccessPage";
|
||||
import FileUploadSettingsPage from "./pages/documents/FileUploadSettingsPage";
|
||||
@@ -119,11 +114,8 @@ import SupportInboxPage from "./pages/support/SupportInboxPage";
|
||||
import {
|
||||
APP_TITLE,
|
||||
buildSidebarSections,
|
||||
DJ_CLEARANCE_HREF,
|
||||
ET_CLEARANCE_HREF,
|
||||
filterSidebarByPermission,
|
||||
findActiveSidebarLabel,
|
||||
GL_WORKFLOW_PATH_PATTERNS,
|
||||
} from "@/components/layout/sidebar-sections";
|
||||
|
||||
const DashboardShell = () => {
|
||||
@@ -139,18 +131,6 @@ const DashboardShell = () => {
|
||||
);
|
||||
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(() => {
|
||||
const activeLabel = findActiveSidebarLabel(
|
||||
location.pathname,
|
||||
@@ -159,20 +139,9 @@ const DashboardShell = () => {
|
||||
document.title = activeLabel ? `${activeLabel} | ${APP_TITLE}` : APP_TITLE;
|
||||
}, [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 (
|
||||
<FreightDashboardLayout
|
||||
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}
|
||||
onNavigate={navigate}
|
||||
enableThemeToggle
|
||||
|
||||
Reference in New Issue
Block a user