import { Link, useLocation, useNavigate } from "react-router-dom";
import { LayoutDashboard } from "lucide-react";
import { cn } from "../utils/cn";
import { useTheme } from "../context/ThemeContext";
import AnimatedLogo from "./../components/AnimatedLogo";
import Logo from "./../components/Logo";
import { useLaunch } from "./LaunchContext";
import { MODULES, ModuleId, moduleHref } from "./registry";
/**
* Platform sidebar — wires the BRIDGE MODULES direct-launch section plus the
* active module's navigation registry. Launching a module plays its
* random-reassembly animation (re-seeded every launch).
*/
export default function PlatformSidebar({ module, onClose }: { module: ModuleId; onClose?: () => void }) {
const location = useLocation();
const navigate = useNavigate();
const { config } = useTheme();
const { startLaunch } = useLaunch();
const def = MODULES[module];
const launch = (target: ModuleId | "hub") => {
onClose?.();
startLaunch(target);
};
const isActiveModule = (id: ModuleId) => location.pathname.startsWith(MODULES[id].basePath);
const isActivePath = (path: string) => {
const full = moduleHref(module, path);
return path === "" ? location.pathname === full : location.pathname.startsWith(full);
};
return (
);
}