Skip to content

Commit 598ecd3

Browse files
authored
Merge pull request #96 from nebari-dev/aktech/admin-layout-move-to-sidebar
Move admin layout to sidebar
2 parents b2737c1 + c6f69a6 commit 598ecd3

File tree

4 files changed

+177
-77
lines changed

4 files changed

+177
-77
lines changed

frontend/package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/App.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { UserManagement } from './pages/admin/UserManagement';
1515
import { AuditLogs } from './pages/admin/AuditLogs';
1616
import { RegistryManagement } from './pages/admin/RegistryManagement';
1717
import { Layout } from './components/layout/Layout';
18+
import { AdminLayout } from './components/layout/AdminLayout';
1819
import { adminApi } from './api/admin';
1920
import { Loader2 } from 'lucide-react';
2021

@@ -98,10 +99,12 @@ function App() {
9899
<Route path="settings" element={<Settings />} />
99100

100101
<Route element={<AdminRoute />}>
101-
<Route path="admin" element={<AdminDashboard />} />
102-
<Route path="admin/users" element={<UserManagement />} />
103-
<Route path="admin/audit-logs" element={<AuditLogs />} />
104-
<Route path="admin/registries" element={<RegistryManagement />} />
102+
<Route element={<AdminLayout />}>
103+
<Route path="admin" element={<AdminDashboard />} />
104+
<Route path="admin/users" element={<UserManagement />} />
105+
<Route path="admin/audit-logs" element={<AuditLogs />} />
106+
<Route path="admin/registries" element={<RegistryManagement />} />
107+
</Route>
105108
</Route>
106109
</Route>
107110
</Routes>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Outlet, NavLink } from 'react-router-dom';
2+
import { LayoutDashboard, Users, Package, Activity } from 'lucide-react';
3+
4+
const navItems = [
5+
{ to: '/admin', label: 'Overview', icon: LayoutDashboard, end: true },
6+
{ to: '/admin/users', label: 'Users', icon: Users, end: false },
7+
{ to: '/admin/registries', label: 'Registries', icon: Package, end: false },
8+
{ to: '/admin/audit-logs', label: 'Logs', icon: Activity, end: false },
9+
];
10+
11+
export const AdminLayout = () => {
12+
return (
13+
<div className="flex min-h-[calc(100vh-73px)]">
14+
<aside className="w-[253px] shrink-0 border-r bg-card px-4 py-6">
15+
<div className="mb-6">
16+
<h2 className="text-lg font-semibold">Admin Dashboard</h2>
17+
<p className="text-sm text-muted-foreground">
18+
System overview and management
19+
</p>
20+
</div>
21+
<nav className="flex flex-col gap-1">
22+
{navItems.map(({ to, label, icon: Icon, end }) => (
23+
<NavLink key={to} to={to} end={end}>
24+
{({ isActive }) => (
25+
<div
26+
className={`flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors ${
27+
isActive
28+
? 'bg-[#E8D7FB] text-[#9B3DCC]'
29+
: 'text-muted-foreground hover:bg-[var(--color-nav-hover)] hover:text-foreground'
30+
}`}
31+
>
32+
<Icon className="h-4 w-4" />
33+
{label}
34+
</div>
35+
)}
36+
</NavLink>
37+
))}
38+
</nav>
39+
</aside>
40+
<main className="flex-1 overflow-auto p-8">
41+
<Outlet />
42+
</main>
43+
</div>
44+
);
45+
};

0 commit comments

Comments
 (0)