import { useState } from 'react' import { Link, Outlet, useLocation } from 'react-router-dom' import { useTheme } from '../hooks/useTheme' import { useAuth } from '../contexts/AuthContext' const navLinks = [ { to: '/runs/new', label: 'New Run' }, { to: '/runs', label: 'My Runs' }, { to: '/genlockes', label: 'Genlockes' }, { to: '/stats', label: 'Stats' }, { to: '/admin', label: 'Admin' }, ] function NavLink({ to, active, children, onClick, className = '', }: { to: string active: boolean children: React.ReactNode onClick?: () => void className?: string }) { return ( {children} ) } function ThemeToggle() { const { theme, toggle } = useTheme() return ( ) } function UserMenu({ onAction }: { onAction?: () => void }) { const { user, loading, signOut } = useAuth() const [open, setOpen] = useState(false) if (loading) { return
} if (!user) { return ( Sign in ) } const email = user.email ?? '' const initials = email.charAt(0).toUpperCase() return (
{open && ( <>
setOpen(false)} />

{email}

)}
) } export function Layout() { const [menuOpen, setMenuOpen] = useState(false) const location = useLocation() function isActive(to: string) { if (to === '/runs/new') return location.pathname === '/runs/new' return location.pathname.startsWith(to) } return (
) }