"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useAuth } from "@/hooks/useAuth"; import { Home, Calendar, Phone, LogIn, UserPlus, LayoutDashboard, LogOut } from "lucide-react"; import { useBrandColorVar } from "@/lib/theme"; export const BottomNav = () => { const { user, loading: authLoading, logout } = useAuth(); const pathname = usePathname(); // Raw SVG needs a literal hex value — reads the live admin-configurable // primary color off the CSS custom property (see lib/theme.ts). const accentColor = useBrandColorVar("--brand-600"); const handleLogout = () => { logout(); window.location.href = "/"; }; const isActive = (href: string) => { if (href.includes("#")) return false; if (href === "/") return pathname === "/"; return pathname.startsWith(href); }; type NavItem = { href: string; label: string; icon: React.ElementType; onClick?: () => void }; // Auth items are only known once the token has been validated — omitting // them entirely while loading avoids a Login/Register -> Dashboard/Logout // flash on every load (see Navbar for the same pattern). const items: NavItem[] = [ { href: "/", label: "Home", icon: Home }, { href: "/events", label: "Events", icon: Calendar }, { href: "/contact", label: "Contact", icon: Phone }, ...(authLoading ? [] : user ? [ { href: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, { href: "#", label: "Logout", icon: LogOut, onClick: handleLogout }, ] : [ { href: "/login", label: "Login", icon: LogIn }, { href: "/register", label: "Register", icon: UserPlus }, ]), ]; return ( ); };