import { useState } from "react"; import { NavLink, Outlet, Navigate, useLocation } from "react-router-dom"; import { useAuth } from "../hooks/useAuth"; import Logo from "./Logo"; import SkyCanvas from "./SkyCanvas"; import { AsteroidIcon, CometIcon, ConstellationIcon, HelmetIcon, LaunchpadIcon, LaunchWindowIcon, OrbitIcon, PlanetIcon, RadarIcon, RocketIcon, SatelliteDishIcon, } from "./icons/Icons"; // Theme in the icon, clarity in the label: the plain label always shows. const NAV = [ { to: "/app", label: "Mission Control", icon: RadarIcon, end: true }, { to: "/app/notebooks", label: "Notebooks", icon: PlanetIcon }, { to: "/app/sources", label: "Sources", icon: SatelliteDishIcon }, { to: "/app/map", label: "Topic map", icon: ConstellationIcon }, { to: "/app/voice", label: "Voice profile", icon: HelmetIcon }, { to: "/app/studio", label: "Video and audio", icon: LaunchWindowIcon }, { to: "/app/launch-kit", label: "Launch Kit", icon: RocketIcon }, { to: "/app/launchpad", label: "Launchpad", icon: LaunchpadIcon }, { to: "/app/archive", label: "Archive", icon: AsteroidIcon }, { to: "/app/resurface", label: "Resurfacing", icon: CometIcon }, { to: "/app/settings", label: "Settings", icon: OrbitIcon }, ]; const COLLAPSED_KEY = "ns_sidebar_collapsed"; function readCollapsed(): boolean { try { return localStorage.getItem(COLLAPSED_KEY) === "1"; } catch { return false; } } export default function AppShell() { const { user, loading, logout } = useAuth(); const location = useLocation(); const [collapsed, setCollapsed] = useState(readCollapsed); const toggle = () => setCollapsed((c) => { try { localStorage.setItem(COLLAPSED_KEY, c ? "0" : "1"); } catch { /* private mode: remember for this visit only */ } return !c; }); if (loading) return
; if (!user) { const next = new URLSearchParams({ next: location.pathname + location.search }); return ; } return (
); }