Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update frontend/src/components/Layout.jsx
Browse files
frontend/src/components/Layout.jsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
-
|
| 2 |
-
import {
|
|
|
|
| 3 |
import { useAuth } from './AuthContext';
|
| 4 |
|
| 5 |
export const getInitials = (userData) => {
|
|
@@ -178,30 +179,27 @@ export const Layout = ({ children }) => {
|
|
| 178 |
navigate(isSuperAdmin ? '/' : '/login');
|
| 179 |
};
|
| 180 |
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
} else if (user?.role === 'support_engineer') {
|
| 203 |
-
navItems.push({ to: '/support', label: 'Global Management', icon: 'support_agent' });
|
| 204 |
-
}
|
| 205 |
|
| 206 |
return (
|
| 207 |
<div className="bg-background text-on-background font-body-md text-body-md antialiased min-h-screen flex flex-col md:flex-row w-full transition-colors duration-300">
|
|
|
|
| 1 |
+
/* eslint-disable react-hooks/exhaustive-deps, react-hooks/set-state-in-effect, react-hooks/immutability, react-refresh/only-export-components */
|
| 2 |
+
import { useState, useEffect, useRef } from 'react';
|
| 3 |
+
import { NavLink, useNavigate, useLocation } from 'react-router-dom';
|
| 4 |
import { useAuth } from './AuthContext';
|
| 5 |
|
| 6 |
export const getInitials = (userData) => {
|
|
|
|
| 179 |
navigate(isSuperAdmin ? '/' : '/login');
|
| 180 |
};
|
| 181 |
|
| 182 |
+
const navItems = [
|
| 183 |
+
...(user?.role === 'executive_user'
|
| 184 |
+
? [
|
| 185 |
+
{ to: '/scans/history', label: 'Organization Reports', icon: 'analytics' },
|
| 186 |
+
{ to: '/settings', label: 'Settings', icon: 'settings' },
|
| 187 |
+
]
|
| 188 |
+
: [
|
| 189 |
+
{ to: '/dashboard', label: 'Dashboard', icon: 'dashboard' },
|
| 190 |
+
{ to: '/scans/new', label: 'New Scan', icon: 'security' },
|
| 191 |
+
{ to: '/scans/history', label: 'Reports', icon: 'analytics' },
|
| 192 |
+
{ to: '/scans/results', label: 'Vulnerabilities', icon: 'bug_report' },
|
| 193 |
+
{ to: '/settings', label: 'Settings', icon: 'settings' },
|
| 194 |
+
]),
|
| 195 |
+
...(user?.role === 'super_admin'
|
| 196 |
+
? [{ to: '/super-admin', label: 'Global Management', icon: 'admin_panel_settings' }]
|
| 197 |
+
: user?.role === 'admin'
|
| 198 |
+
? [{ to: '/admin', label: 'Global Management', icon: 'admin_panel_settings' }]
|
| 199 |
+
: user?.role === 'support_engineer'
|
| 200 |
+
? [{ to: '/support', label: 'Global Management', icon: 'support_agent' }]
|
| 201 |
+
: []),
|
| 202 |
+
];
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
return (
|
| 205 |
<div className="bg-background text-on-background font-body-md text-body-md antialiased min-h-screen flex flex-col md:flex-row w-full transition-colors duration-300">
|