import Link from "next/link"; import { LayoutDashboard, TrendingUp, Wrench, Wallet, LineChart as LineChartIcon, Receipt, Boxes } from "lucide-react"; import { Sidebar, MobileNav, type NavItem } from "@/components/Sidebar"; import { ThemeToggle } from "@/components/ThemeToggle"; import { GlobalSearch } from "@/components/GlobalSearch"; import { AccountMenu } from "@/components/AccountMenu"; import { getAssets } from "@/lib/server-data"; import { requireUser } from "@/lib/auth"; export const dynamic = "force-dynamic"; const navItems: NavItem[] = [ { kind: "group", label: "Dashboard", icon: , children: [ { href: "/", label: "Overview" }, { href: "/sites", label: "Sites" }, ], }, { kind: "group", label: "Plant Register", icon: , children: [ { href: "/plant", label: "Register" }, { href: "/plant/map", label: "Plant Map" }, ], }, { kind: "group", label: "Income", icon: , children: [ { href: "/income", label: "Overview" }, // The invoice register is split in two by the debtor on the invoice — see // lib/invoice-party-policy.json. The two are SIBLING routes on purpose: a nested // path would satisfy isGroupActive's prefix test for both leaves at once and // highlight both at the same time. { href: "/income/invoices", label: "Internal Invoices" }, { href: "/income/external-invoices", label: "External Invoices" }, ], }, // Running Costs became a group so Insurance could sit under it. The Overview // leaf stays at the EXISTING /running path — the current page becomes the // overview, it does not move, so no bookmark or GlobalSearch target breaks. { kind: "group", label: "Running Costs", icon: , children: [ { href: "/running", label: "Overview" }, { href: "/running/insurance", label: "Insurance" }, ], }, { kind: "group", label: "Expenses", icon: , children: [ { href: "/expenses", label: "Overview" }, { href: "/expenses/vehicles", label: "Vehicle Costs" }, { href: "/expenses/finance", label: "Finance (Bastion)" }, { href: "/expenses/personnel", label: "Personnel" }, { href: "/expenses/subscriptions", label: "Subscriptions" }, { href: "/expenses/rent", label: "Rent & Utilities" }, { href: "/expenses/petty-cash", label: "Cash Floats" }, ], }, { kind: "link", href: "/overheads", label: "Overheads Roll-up", icon: }, { kind: "link", href: "/charts", label: "Machine Charts", icon: }, ]; export default async function DashboardLayout({ children }: { children: React.ReactNode }) { const { user } = await requireUser(); const assets = await getAssets(); return <> {/* z-[1100], not z-30: Leaflet's control panes are z-index 1000 and live in the root stacking context, so the old z-30 header lost and the Plant Map scrolled straight over it. Must stay above 1000, and below the mobile nav drawer (z-[1200]) in Sidebar.tsx. */}
{/* The hamburger must live HERE, in the full-bleed header — not in the content flex row below, where it indented every page on mobile. See MobileNav for the portal detail. */} Mega Plant
Mega Plant
Plant management
({ id: a.id, code: a.code, name: a.name, category: a.category, supplier: a.supplier, }))} />
FY 2026
{children}
; }