diff --git a/src/components/layout/mobile/mobile-bottom-tabs.tsx b/src/components/layout/mobile/mobile-bottom-tabs.tsx new file mode 100644 index 0000000..3084763 --- /dev/null +++ b/src/components/layout/mobile/mobile-bottom-tabs.tsx @@ -0,0 +1,72 @@ +'use client'; + +import Link from 'next/link'; +import { usePathname } from 'next/navigation'; +import { LayoutDashboard, Users, Ship, Anchor, Menu } from 'lucide-react'; + +import { cn } from '@/lib/utils'; + +type TabSpec = { + label: string; + icon: typeof LayoutDashboard; + segment: string; // route segment after /[portSlug]/ +}; + +const TABS: TabSpec[] = [ + { label: 'Dashboard', icon: LayoutDashboard, segment: 'dashboard' }, + { label: 'Clients', icon: Users, segment: 'clients' }, + { label: 'Yachts', icon: Ship, segment: 'yachts' }, + { label: 'Berths', icon: Anchor, segment: 'berths' }, +]; + +export function MobileBottomTabs({ onMoreClick }: { onMoreClick: () => void }) { + const pathname = usePathname(); + + // Derive the active port slug from the URL so tab links always target the + // current port, even after a port-switch. The dashboard route shape is + // /[portSlug]/, so the slug is the first non-empty path segment. + const portSlug = pathname.split('/').filter(Boolean)[0] ?? 'port-nimara'; + + function isActive(segment: string): boolean { + return pathname.startsWith(`/${portSlug}/${segment}`); + } + + return ( + + ); +}