'use client'; import { useRouter, usePathname } from 'next/navigation'; import { Home, Search, Disc, Users, Music, Heart, List, Settings } from 'lucide-react'; import { cn } from '@/lib/utils'; import { motion, AnimatePresence } from 'framer-motion'; import { useGlobalSearch } from './GlobalSearchProvider'; interface NavItem { href: string; label: string; icon: React.ComponentType<{ className?: string }>; } const navigationItems: NavItem[] = [ { href: '/', label: 'Home', icon: Home }, { href: '/search', label: 'Search', icon: Search }, { href: '/library', label: 'Library', icon: Music }, { href: '/queue', label: 'Queue', icon: List }, ]; export function BottomNavigation() { const router = useRouter(); const pathname = usePathname(); const { openSpotlight } = useGlobalSearch(); const handleNavigation = (href: string) => { if (href === '/search') { // Use spotlight search instead of navigating to search page openSpotlight(); } else { router.push(href); } }; const isActive = (href: string) => { if (href === '/') { return pathname === '/'; } return pathname.startsWith(href); }; return (
{navigationItems.map((item) => { const isItemActive = isActive(item.href); const Icon = item.icon; return ( handleNavigation(item.href)} className={cn( "flex flex-col items-center justify-center p-2 rounded-lg transition-all duration-200 min-w-[60px] touch-manipulation", "active:scale-95 active:bg-primary/20", isItemActive ? "text-primary bg-primary/10" : "text-muted-foreground hover:text-foreground hover:bg-muted/50" )} whileTap={{ scale: 0.95 }} whileHover={{ y: -1 }} > {item.label} {isItemActive && ( )} ); })}
); }