"use client"; import { useState, useEffect } from "react"; import Link from "next/link"; import { useCart } from "./CartContext"; import { ShoppingBag, ArrowRight } from "lucide-react"; import LanguageSwitcher from "./LanguageSwitcher"; import { useLanguage } from "@/lib/language-context"; import { getTranslation } from "@/lib/translations"; import { motion } from "framer-motion"; import { usePathname } from "next/navigation"; /** * ============================================================================= * GLOBAL NAVIGATION BAR — Shahi Kitchen (Luxury Edition) * ============================================================================= */ interface NavbarProps { variant?: "default" | "menu"; } export default function Navbar({ variant = "default" }: NavbarProps) { const [isOpen, setIsOpen] = useState(false); const [scrolled, setScrolled] = useState(false); const { totalItems, openCart } = useCart(); const { language } = useLanguage(); const t = getTranslation(language); const pathname = usePathname(); // Scroll effect - only for subtle visual polish, NOT height (height must stay consistent) useEffect(() => { const handleScroll = () => setScrolled(window.scrollY > 20); window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, []); const navLinks = [ { href: "/", label: t.nav.home }, { href: "/menu", label: t.nav.menu }, { href: "/locations", label: t.nav.locations }, { href: "/#experience", label: t.nav.experience }, { href: "/#contact", label: t.nav.contact }, ]; // Determine active link (supports hash links) const isActive = (href: string) => { if (href === "/") return pathname === "/"; if (href.includes("#")) return false; // hash links handled separately return pathname === href; }; const closeMenu = () => setIsOpen(false); return ( ); }