diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index 240c35d..98f135b 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -18,31 +18,76 @@ import { SquareStack, Sun, Users, + type LucideIcon, } from "lucide-react"; import { useEffect } from "react"; import { token } from "../api/client"; import { useTheme } from "../stores/theme"; -const nav = [ - { to: "/", label: "Dashboard", icon: LayoutDashboard }, - { to: "/clusters", label: "Clusters", icon: Server }, - { to: "/nodes", label: "Nodes", icon: Activity }, - { to: "/workloads", label: "VMs/LXCs", icon: Blocks }, - { to: "/networks", label: "Networks", icon: Network }, - { to: "/ipam", label: "IPAM", icon: Database }, - { to: "/tenants", label: "Tenants", icon: BriefcaseBusiness }, - { to: "/security-groups", label: "Security Groups", icon: Shield }, - { to: "/policies", label: "Policies", icon: GitBranch }, - { to: "/services", label: "Service Catalog", icon: SquareStack }, - { to: "/designer", label: "Policy Designer", icon: LockKeyhole }, - { to: "/firewall", label: "Firewall Preview", icon: Flame }, +const navGroups = [ + { + label: "Operate", + items: [ + { to: "/", label: "Dashboard", icon: LayoutDashboard }, + { to: "/clusters", label: "Clusters", icon: Server }, + { to: "/nodes", label: "Nodes", icon: Activity }, + { to: "/workloads", label: "VMs/LXCs", icon: Blocks }, + ], + }, + { + label: "Network", + items: [ + { to: "/networks", label: "Networks", icon: Network }, + { to: "/ipam", label: "IPAM", icon: Database }, + { to: "/services", label: "Service Catalog", icon: SquareStack }, + { to: "/tenants", label: "Tenants", icon: BriefcaseBusiness }, + ], + }, + { + label: "Security", + items: [ + { to: "/security-groups", label: "Security Groups", icon: Shield }, + { to: "/policies", label: "Policies", icon: GitBranch }, + { to: "/designer", label: "Policy Designer", icon: LockKeyhole }, + { to: "/firewall", label: "Firewall Preview", icon: Flame }, + ], + }, +]; + +const systemNav = [ { to: "/jobs", label: "Jobs", icon: ClipboardList }, { to: "/audit", label: "Audit Logs", icon: BookOpen }, { to: "/users", label: "Users", icon: Users }, { to: "/settings", label: "Settings", icon: Settings }, ]; +function SidebarLink({ item }: { item: { to: string; label: string; icon: LucideIcon } }) { + const Icon = item.icon; + return ( + + `group relative flex h-9 items-center gap-3 rounded-md px-3 text-sm transition-colors ${ + isActive + ? "bg-accent/10 text-accent dark:bg-accent/15" + : "text-slate-600 hover:bg-slate-100 hover:text-slate-950 dark:text-slate-300 dark:hover:bg-slate-800/80 dark:hover:text-white" + }` + } + > + {({ isActive }) => ( + <> + + + {item.label} + + )} + + ); +} + export function Layout() { const navigate = useNavigate(); const { dark, toggle } = useTheme(); @@ -60,29 +105,31 @@ export function Layout() {