import { NavLink, Outlet } from "react-router-dom"; import { api, isAdmin } from "../api"; import { useApp } from "../store"; import { useStatus } from "../queries"; const NAV = [ { to: "/", label: "Control", exact: true }, { to: "/history", label: "History" }, ]; const ADMIN_NAV = [ { to: "/cards", label: "Cards" }, { to: "/users", label: "Users" }, ]; export default function Layout() { const { me, setMe, toasts } = useApp(); const { data: status } = useStatus(); const admin = me ? isAdmin(me.scopes) : false; const pending = status?.pending_cards ?? 0; async function logout() { await api.post("/logout").catch(() => undefined); setMe(null); } return (