mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 12:18:11 +00:00
feat(freight:backoffice): migrated smart-office user-management
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
import { Navigate, Outlet, Route, Routes, useLocation, useNavigate } from "react-router-dom";
|
||||
import { DashboardLayout, type SidebarItem } from "@edr/ui-common";
|
||||
import { LayoutDashboard, ShieldCheck, Users, Network } from "lucide-react";
|
||||
import { LayoutDashboard, Network } from "lucide-react";
|
||||
|
||||
import { useAuth } from "./auth/useAuth";
|
||||
import LoginPage from "./pages/auth/LoginPage";
|
||||
import OverviewPage from "./pages/dashboard/OverviewPage";
|
||||
import UsersPage from "./pages/dashboard/user-management/UsersPage";
|
||||
import RolesPage from "./pages/dashboard/user-management/RolesPage";
|
||||
import DepartmentsPage from "./pages/dashboard/user-management/DepartmentsPage";
|
||||
import OrgStructurePage from "./pages/dashboard/org-structure/OrgStructurePage";
|
||||
import UserManagementPage from "./pages/dashboard/user-management/UserManagementPage";
|
||||
import LoadingScreen from "./components/LoadingScreen";
|
||||
|
||||
const sidebarItems: SidebarItem[] = [
|
||||
@@ -18,8 +15,8 @@ const sidebarItems: SidebarItem[] = [
|
||||
icon: <LayoutDashboard />,
|
||||
},
|
||||
{
|
||||
label: "Org structure",
|
||||
href: "/dashboard/org-structure",
|
||||
label: "User management",
|
||||
href: "/dashboard/user-management",
|
||||
icon: <Network />,
|
||||
},
|
||||
];
|
||||
@@ -69,9 +66,9 @@ const App = () => {
|
||||
<Route path="/dashboard" element={<Navigate to="/dashboard/overview" replace />} />
|
||||
<Route path="/dashboard" element={<DashboardShell />}>
|
||||
<Route path="overview" element={<OverviewPage />} />
|
||||
<Route path="org-structure" element={<OrgStructurePage />} />
|
||||
<Route path="org-structure/units/:unitId" element={<OrgStructurePage />} />
|
||||
<Route path="org-structure/units/:unitId/:section" element={<OrgStructurePage />} />
|
||||
<Route path="user-management" element={<UserManagementPage />} />
|
||||
<Route path="org-structure" element={<Navigate to="/dashboard/user-management" replace />} />
|
||||
<Route path="org-structure/*" element={<Navigate to="/dashboard/user-management" replace />} />
|
||||
</Route>
|
||||
<Route path="*" element={<Navigate to="/dashboard/overview" replace />} />
|
||||
</Routes>
|
||||
|
||||
@@ -125,8 +125,15 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
|
||||
mfaEmailRef.current = null;
|
||||
},
|
||||
logout: () => {
|
||||
const preservedTheme = window.localStorage.getItem("edr-theme");
|
||||
|
||||
clearSessionCookies();
|
||||
localStorage.clear();
|
||||
window.localStorage.clear();
|
||||
|
||||
if (preservedTheme === "dark" || preservedTheme === "light") {
|
||||
window.localStorage.setItem("edr-theme", preservedTheme);
|
||||
}
|
||||
|
||||
setUser(null);
|
||||
window.location.replace("/auth");
|
||||
},
|
||||
|
||||
@@ -1,11 +1,47 @@
|
||||
interface LocaleText {
|
||||
en?: string;
|
||||
am?: string;
|
||||
}
|
||||
|
||||
interface AuthRole {
|
||||
id?: string;
|
||||
key?: string;
|
||||
}
|
||||
|
||||
interface AuthPermission {
|
||||
id?: string;
|
||||
key?: string;
|
||||
}
|
||||
|
||||
interface AuthEmployeePosition {
|
||||
id?: string;
|
||||
employeePositionId?: string;
|
||||
name?: LocaleText;
|
||||
key?: string;
|
||||
isDelegate?: boolean;
|
||||
parentPositionId?: string | null;
|
||||
permissions?: AuthPermission[];
|
||||
}
|
||||
|
||||
interface AuthEmployeeRecord {
|
||||
id?: string;
|
||||
organizationId?: string;
|
||||
unitId?: string;
|
||||
name?: LocaleText;
|
||||
positions?: AuthEmployeePosition[];
|
||||
}
|
||||
|
||||
export interface AuthUser {
|
||||
id?: string;
|
||||
email?: string;
|
||||
username?: string;
|
||||
name?: {
|
||||
en?: string;
|
||||
am?: string;
|
||||
};
|
||||
phoneNumber?: string;
|
||||
name?: LocaleText;
|
||||
roles?: AuthRole[];
|
||||
permissions?: AuthPermission[];
|
||||
employee?: AuthEmployeeRecord[];
|
||||
hasSetPassword?: boolean;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export interface AuthTokens {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user