feat: better navigation in backoffice

This commit is contained in:
Nathnael
2026-08-07 12:24:30 +00:00
parent d5d7c91e24
commit 1e9149ce00
12 changed files with 861 additions and 676 deletions

View File

@@ -30,6 +30,7 @@ import {
} from "lucide-react";
import { useAuth } from "@/auth/useAuth";
import { resolveLandingPath } from "@/lib/landing";
import { canAccessRuleEngineResource } from "@/lib/permissions";
import RuleEngineFormDialog from "@/components/ruleEngine/RuleEngineFormDialog";
import {
@@ -239,8 +240,8 @@ const CargoTypesPage = () => {
[levelNodes, term],
);
if (!config) return <Navigate to="/dashboard/overview" replace />;
if (!canView) return <Navigate to="/dashboard/overview" replace />;
if (!config) return <Navigate to={resolveLandingPath(user)} replace />;
if (!canView) return <Navigate to={resolveLandingPath(user)} replace />;
// A bad/stale :id (after data loads) → fall back to the root list.
if (!isLoading && currentId && !current) return <Navigate to={BASE_PATH} replace />;

View File

@@ -1,4 +1,5 @@
import { useAuth } from "@/auth/useAuth";
import { resolveLandingPath } from "@/lib/landing";
import {
canAccessRuleEngineResource,
canApproveRuleEngineChange,
@@ -584,7 +585,7 @@ const RuleEngineResourcePage = () => {
}
if (!canView) {
return <Navigate to="/dashboard/overview" replace />;
return <Navigate to={resolveLandingPath(user)} replace />;
}
const openCreate = () => {