110 lines
4.7 KiB
TypeScript
110 lines
4.7 KiB
TypeScript
import "./globals.css";
|
|
import type { Metadata } from "next";
|
|
import Link from "next/link";
|
|
import {
|
|
LayoutDashboard,
|
|
Truck,
|
|
TrendingUp,
|
|
Wrench,
|
|
Wallet,
|
|
LineChart as LineChartIcon,
|
|
Receipt,
|
|
} 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";
|
|
|
|
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/icon-192.png", sizes: "192x192" },
|
|
{ url: "/icons/icon-512.png", sizes: "512x512" },
|
|
],
|
|
apple: [{ url: "/icons/icon-192.png", sizes: "192x192" }],
|
|
},
|
|
};
|
|
|
|
const navItems: NavItem[] = [
|
|
{ kind: "link", href: "/", label: "Dashboard", icon: <LayoutDashboard className="w-4 h-4" /> },
|
|
{ kind: "link", href: "/plant", label: "Plant Register", icon: <Truck className="w-4 h-4" /> },
|
|
{ kind: "link", href: "/income", label: "Income", icon: <TrendingUp className="w-4 h-4" /> },
|
|
{ kind: "link", href: "/running", label: "Running Costs", icon: <Wrench className="w-4 h-4" /> },
|
|
{
|
|
kind: "group",
|
|
label: "Expenses",
|
|
icon: <Wallet className="w-4 h-4" />,
|
|
children: [
|
|
{ href: "/expenses", label: "Overview" },
|
|
{ href: "/expenses/plant-overheads", label: "Plant Overheads" },
|
|
{ href: "/expenses/insurance", label: "Insurance" },
|
|
{ href: "/expenses/finance", label: "Finance (Bastion)" },
|
|
{ href: "/expenses/tracking", label: "Tracking" },
|
|
{ href: "/expenses/personnel", label: "Personnel" },
|
|
{ href: "/expenses/subscriptions", label: "Subscriptions" },
|
|
{ href: "/expenses/rent", label: "Rent & Utilities" },
|
|
],
|
|
},
|
|
{ kind: "link", href: "/overheads", label: "Overheads Roll-up", icon: <Receipt className="w-4 h-4" /> },
|
|
{ kind: "link", href: "/charts", label: "Machine Charts", icon: <LineChartIcon className="w-4 h-4" /> },
|
|
];
|
|
|
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
const assets = await getAssets();
|
|
return (
|
|
<html lang="en" suppressHydrationWarning>
|
|
<head>
|
|
{/* 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. */}
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
<meta name="apple-mobile-web-app-title" content="Mega Plant" />
|
|
<link rel="apple-touch-icon" href="/icons/icon-192.png" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
</head>
|
|
<body className="min-h-screen">
|
|
<ThemeProvider>
|
|
<header className="sticky top-0 z-30 h-16 bg-white/80 dark:bg-[#0b1014]/80 backdrop-blur border-b border-gray-200 dark:border-white/5">
|
|
<div className="flex items-center gap-3 sm:gap-6 px-4 sm:px-6 h-full">
|
|
<Link href="/" className="flex items-center gap-2 shrink-0">
|
|
<div className="w-9 h-9 rounded-xl bg-gradient-to-br from-[#EDAE49] to-[#D1495B] flex items-center justify-center shadow-lg shadow-orange-500/20">
|
|
<span className="font-black text-white text-sm">M</span>
|
|
</div>
|
|
<div className="leading-tight hidden sm:block">
|
|
<div className="text-sm font-semibold text-[#003D5B] dark:text-white">Mega Plant</div>
|
|
<div className="text-[10px] text-gray-500 dark:text-gray-400 uppercase tracking-wider">Overheads 2026</div>
|
|
</div>
|
|
</Link>
|
|
|
|
<GlobalSearch assets={assets.map((a) => ({
|
|
id: a.id, code: a.code, name: a.name, category: a.category, supplier: a.supplier,
|
|
}))} />
|
|
|
|
<div className="flex items-center gap-3 shrink-0">
|
|
<div className="hidden md:flex items-center gap-2 px-3 py-1.5 rounded-xl bg-gradient-to-br from-[#30638E] to-[#003D5B] text-white shadow-lg shadow-blue-900/20">
|
|
<span className="text-[10px] uppercase tracking-wider text-white/70">FY</span>
|
|
<span className="text-sm font-semibold">2026</span>
|
|
</div>
|
|
<ThemeToggle />
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<div className="flex">
|
|
<Sidebar items={navItems} />
|
|
<main className="flex-1 min-w-0">{children}</main>
|
|
</div>
|
|
</ThemeProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|