import { redirect } from "next/navigation"; import Link from "next/link"; import { Truck } from "lucide-react"; import { getCurrentSession } from "@/lib/auth/session"; import { LogoutButton } from "./logout-button"; import { NavShell } from "./nav-shell"; import { ThemeToggle } from "./theme-toggle"; import { NotificationToggle } from "./notification-toggle"; import { EventToasts } from "./event-toasts"; import { PresenceHeartbeat } from "./presence-heartbeat"; import { Avatar } from "./avatar"; export default async function AdminLayout({ children }: { children: React.ReactNode }) { const session = await getCurrentSession(); if (!session) { redirect("/login"); } const role = session.user.role as "admin" | "manager" | "accountant"; return ( // Fixed to the real visible viewport height (ViewportHeightFix keeps // --app-vh in sync with window.visualViewport, which — unlike 100vh — // actually shrinks under the on-screen keyboard) so header/nav stay // pinned and only
scrolls, the standard "app shell" layout // instead of the whole page scrolling under a header that reflows.
Thunderbird Portal
{session.user.name}
{/* pb: clears the fixed mobile bottom-tab bar (~52px + safe-area) so it never covers the last bit of scrolled content */}
{children}
); }