import { Link, useRouterState } from "@tanstack/react-router" import { SidebarProvider, Sidebar, SidebarContent, SidebarHeader, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarInset, SidebarTrigger, } from "@/components/ui/sidebar" import { Separator } from "@/components/ui/separator" import { Toaster } from "@/components/ui/sonner" import { LayoutDashboard, Database, Box, Layers, Save, } from "lucide-react" const NAV = [ { to: "/", label: "Dashboard", icon: LayoutDashboard }, { to: "/data-sources", label: "Data Sources", icon: Database }, { to: "/widgets", label: "Widgets", icon: Box }, { to: "/layout", label: "Layout", icon: Layers }, { to: "/presets", label: "Presets", icon: Save }, ] as const export function AppShell({ children }: { children: React.ReactNode }) { const { location } = useRouterState() return ( K-Frame {NAV.map((item) => { const active = item.to === "/" ? location.pathname === "/" : location.pathname.startsWith(item.to) return ( {item.label} ) })}
{NAV.find((n) => n.to === "/" ? location.pathname === "/" : location.pathname.startsWith(n.to), )?.label ?? ""}
{children}
) }