2026-03-18 23:04:28 +01:00
|
|
|
import { useNavigate, useLocation } from 'react-router-dom'
|
2026-03-18 17:50:41 +01:00
|
|
|
import { AppShell } from '../../design-system/layout/AppShell/AppShell'
|
|
|
|
|
import { Sidebar } from '../../design-system/layout/Sidebar/Sidebar'
|
|
|
|
|
import { TopBar } from '../../design-system/layout/TopBar/TopBar'
|
|
|
|
|
import { SIDEBAR_APPS } from '../../mocks/sidebar'
|
2026-03-18 23:04:28 +01:00
|
|
|
import styles from './Admin.module.css'
|
|
|
|
|
import type { ReactNode } from 'react'
|
|
|
|
|
|
|
|
|
|
const ADMIN_TABS = [
|
|
|
|
|
{ label: 'User Management', path: '/admin/rbac' },
|
|
|
|
|
{ label: 'Audit Log', path: '/admin/audit' },
|
|
|
|
|
{ label: 'OIDC', path: '/admin/oidc' },
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
interface AdminLayoutProps {
|
|
|
|
|
title: string
|
|
|
|
|
children: ReactNode
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function AdminLayout({ title, children }: AdminLayoutProps) {
|
|
|
|
|
const navigate = useNavigate()
|
|
|
|
|
const location = useLocation()
|
2026-03-18 17:50:41 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<AppShell sidebar={<Sidebar apps={SIDEBAR_APPS} />}>
|
|
|
|
|
<TopBar
|
2026-03-18 23:04:28 +01:00
|
|
|
breadcrumb={[
|
|
|
|
|
{ label: 'Admin', href: '/admin' },
|
|
|
|
|
{ label: title },
|
|
|
|
|
]}
|
2026-03-18 17:50:41 +01:00
|
|
|
environment="PRODUCTION"
|
|
|
|
|
user={{ name: 'hendrik' }}
|
|
|
|
|
/>
|
2026-03-18 23:04:28 +01:00
|
|
|
<nav className={styles.adminNav} aria-label="Admin sections">
|
|
|
|
|
{ADMIN_TABS.map((tab) => (
|
|
|
|
|
<button
|
|
|
|
|
key={tab.path}
|
|
|
|
|
className={`${styles.adminTab} ${location.pathname === tab.path ? styles.adminTabActive : ''}`}
|
|
|
|
|
onClick={() => navigate(tab.path)}
|
|
|
|
|
type="button"
|
|
|
|
|
>
|
|
|
|
|
{tab.label}
|
|
|
|
|
</button>
|
|
|
|
|
))}
|
|
|
|
|
</nav>
|
|
|
|
|
<div className={styles.adminContent}>
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
2026-03-18 17:50:41 +01:00
|
|
|
</AppShell>
|
|
|
|
|
)
|
|
|
|
|
}
|