import Head from "next/head"; import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/router"; import { ReactNode } from "react"; import { useAuth } from "../lib/auth-context"; const NAV_ITEMS = [ { href: "/", label: "Jobs" }, { href: "/settings/devices", label: "Devices" }, { href: "/settings/members", label: "Members" }, { href: "/settings/api-keys", label: "API keys" }, { href: "/settings/mqtt-certs", label: "MQTT certs" }, ]; export default function Layout({ children, title, }: { children: ReactNode; title?: string; }) { const { user, memberships, activeOrg, setActiveOrgId, logout } = useAuth(); const router = useRouter(); const isActive = (href: string) => href === "/" ? router.pathname === "/" || router.pathname.startsWith("/jobs") : router.pathname.startsWith(href); const handleLogout = async () => { await logout(); router.push("/login"); }; const navLinks = NAV_ITEMS.map((item) => ( {item.label} )); return ( <>