'use client'; import { cn } from '@/lib/cn'; import { LayoutGrid, Package, PlusCircle, Server, Settings } from 'lucide-react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; interface Tab { href: string; label: string; icon: React.ComponentType<{ size?: number }>; prominent?: boolean; matchExact?: boolean; } /** * Mobile bottom navigation — replaces the top nav on small screens with a * native-app-style tab bar. Five destinations, "Create" as a prominent * FAB-style centre button. The top header drops to just Logo + UserMenu on * mobile (see (dashboard)/layout.tsx) so there's no duplicated nav. * * Desktop is unchanged: top nav for destinations, "+ New server" pill in * the header. The whole component is `sm:hidden`. * * Audit is intentionally demoted on mobile (low-frequency); still reachable * via the direct /audit URL or via the Account section. */ const TABS: Tab[] = [ { href: '/dashboard', label: 'Overview', icon: LayoutGrid, matchExact: true }, { href: '/servers', label: 'Servers', icon: Server }, { href: '/servers/new', label: 'Create', icon: PlusCircle, prominent: true, matchExact: true }, { href: '/templates', label: 'Market', icon: Package }, { href: '/settings', label: 'Settings', icon: Settings }, ]; function useIsActive(pathname: string) { return (tab: Tab): boolean => { if (tab.matchExact) return pathname === tab.href; // /servers matches /servers and /servers/ but NOT /servers/new // (that's the dedicated Create tab). if (tab.href === '/servers') { return ( pathname === '/servers' || (pathname.startsWith('/servers/') && pathname !== '/servers/new') ); } return pathname.startsWith(tab.href); }; } export function MobileActionBar() { const pathname = usePathname(); const isActive = useIsActive(pathname); return ( ); }