import { useState } from "react"; import { NavLink, Outlet, Navigate, useLocation } from "react-router-dom"; import { useAuth } from "../hooks/useAuth"; import { UpgradeProvider } from "../hooks/useUpgrade"; import Logo from "./Logo"; import { FuelGauge, NudgeDock } from "./Nudges"; import SkyCanvas from "./SkyCanvas"; import UpgradeModal from "./UpgradeModal"; import { LaunchpadIcon, LibraryIcon, MicIcon, OrbitIcon, PlanetIcon, SatelliteDishIcon, } from "./icons/Icons"; // Keep the primary navigation focused; related pages remain reachable through these destinations. const NAV: { to: string; label: string; icon: typeof PlanetIcon; end?: boolean; also?: string[] }[] = [ { to: "/app/notebooks", label: "Notebooks", icon: PlanetIcon }, { to: "/app/sources", label: "Sources", icon: SatelliteDishIcon, also: ["/app/map"] }, { to: "/app/archive", label: "Library", icon: LibraryIcon, also: ["/app/videos"] }, { to: "/app/launchpad", label: "Launchpad", icon: LaunchpadIcon, also: ["/app/resurface", "/app/launch-kit"] }, { to: "/app/voices", label: "Manage voices", icon: MicIcon }, ]; 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, signingOut, logout } = useAuth(); const location = useLocation(); const notebookFocus = /^\/app\/notebooks\/[^/]+$/.test(location.pathname); 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