import "./globals.css"; import type { Metadata } from "next"; import Link from "next/link"; import { LayoutDashboard, TrendingUp, Wrench, Wallet, LineChart as LineChartIcon, Receipt, MapPin, Boxes, } from "lucide-react"; import { Sidebar, type NavItem } from "@/components/Sidebar"; import { ThemeProvider } from "@/components/ThemeProvider"; import { ThemeToggle } from "@/components/ThemeToggle"; import { GlobalSearch } from "@/components/GlobalSearch"; import { getAssets } from "@/lib/data"; // The layout itself reads PocketBase (GlobalSearch needs the asset list), so it // must be dynamic too — otherwise Next prerenders the built-in /_not-found page, // which inherits this layout, and the build fails without a reachable database. export const dynamic = "force-dynamic"; export const metadata: Metadata = { title: "Mega Plant Dashboard", description: "Mega Plant cost & P&L dashboard", manifest: "/manifest.json", themeColor: "#30638E", appleWebApp: { title: "Mega Plant", capable: true, statusBarStyle: "default", }, icons: { icon: [ { url: "/icons/favicon-32.png", sizes: "32x32" }, { url: "/icons/icon-192.png", sizes: "192x192" }, { url: "/icons/icon-512.png", sizes: "512x512" }, ], apple: [ { url: "/icons/icon-192.png", sizes: "192x192" }, { url: "/icons/icon-512.png", sizes: "512x512" }, ], }, }; 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" }, { href: "/income/invoices", label: "Invoices" }, ], }, { kind: "link", href: "/running", label: "Running Costs", icon: }, { 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 RootLayout({ children }: { children: React.ReactNode }) { const assets = await getAssets(); return ( {/* Part 4: Next 16 emits apple-mobile-web-app-status-bar-style but NOT apple-mobile-web-app-capable. Without this tag, iOS Add-to-Home-Screen opens in Safari instead of standalone. */} {/* Umami analytics — website id 86d0bd41-e705-4677-af2d-a4228e7c4b95 */}