"use client"; import { useState } from "react"; import { useTranslations, useLocale } from "next-intl"; import { useRouter, usePathname } from "next/navigation"; import { Search, Menu, X, Globe, MapPin } from "lucide-react"; import { cn } from "@/lib/utils"; export function Navbar() { const t = useTranslations("nav"); const locale = useLocale(); const router = useRouter(); const pathname = usePathname(); const [open, setOpen] = useState(false); const otherLocale = locale === "fa" ? "en" : "fa"; const otherPath = pathname.replace(`/${locale}`, `/${otherLocale}`); const links = [ { href: `/${locale}`, label: t("home") }, { href: `/${locale}/search`, label: t("search") }, ]; return (
{/* Logo */}
{locale === "fa" ? "میزی‌یاب" : "Meezi Finder"}
{/* Desktop nav */}
{/* Search shortcut */} {locale === "fa" ? "جستجوی کافه..." : "Search cafes..."} {/* Language toggle */} {otherLocale === "fa" ? "FA" : "EN"} {/* Mobile menu toggle */}
{/* Mobile menu */} {open && (
{links.map((l) => ( setOpen(false)} className="block rounded-lg px-3 py-2.5 text-sm font-medium text-gray-700 hover:bg-gray-50" > {l.label} ))}
)}
); }