import { Link, Outlet, useNavigate } from '@tanstack/react-router' import { Toaster } from '@/components/ui/toast' import { useLogout, useMe } from '@/lib/auth' const navLinks = [ { to: '/gardens', label: 'Gardens' }, { to: '/plants', label: 'Plants' }, ] as const // TanStack Router concatenates the base className with activeProps/inactiveProps, // so state-specific and conflicting utilities (text-muted vs text-fg) live in the // state props — never in the base — to avoid ambiguous overrides. const navLinkBase = 'rounded-md px-3 py-1.5 text-sm font-medium transition-colors' const navLinkActive = 'bg-border/60 text-fg' const navLinkInactive = 'text-muted hover:bg-border/60 hover:text-fg' /** Top-level chrome: a sticky nav bar plus the routed page in an . */ export function AppShell() { const me = useMe() const logout = useLogout() const navigate = useNavigate() const user = me.data async function onLogout() { try { await logout.mutateAsync() await navigate({ to: '/login' }) } catch { // The logout request failed, so the session is still valid server-side: // leave the user where they are (the button re-enables for a retry) rather // than pretending they're signed out. logout.isError drives the title below. } } return (
) }