import { useEffect, useState } from 'react' import { Link, NavLink, Outlet, useNavigate } from 'react-router-dom' import { Activity, Bell, Cast, Clock, CloudDownload, Compass, Copy, Film, FolderTree, GalleryHorizontalEnd, Globe, HardDrive, Heart, Home, KeyRound, KeySquare, Link2, ListChecks, ListMusic, LogOut, MessageSquare, Rss, Search, Server, Settings, Sliders, Sparkles, Cloud, Trash2, UserCog, Wrench, Library as LibraryIcon, User as UserIcon, } from 'lucide-react' import clsx from 'clsx' import { libraryAPI } from '../api/library' import { useAuthStore } from '../stores/auth' import type { Library } from '../types' // Top-level chrome: a fixed left rail + scrollable content area. export function Layout() { const navigate = useNavigate() const user = useAuthStore((s) => s.user) const logout = useAuthStore((s) => s.logout) const [libraries, setLibraries] = useState([]) useEffect(() => { libraryAPI.list().then(setLibraries).catch(() => undefined) }, []) const handleLogout = () => { logout() navigate('/login') } return (
) } function SidebarLink({ to, icon, label, end, }: { to: string icon: React.ReactNode label: string end?: boolean }) { return ( clsx( 'flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition', isActive ? 'bg-primary-400/10 text-primary-400' : 'text-slate-300 hover:bg-white/5 hover:text-white', ) } > {icon} {label} ) }