"use client" import Link from 'next/link' import { usePathname } from 'next/navigation' import { useState } from 'react' const locales = ['fa', 'en'] function getLocalizedPath(pathname, nextLocale) { const parts = pathname.split('/').filter(Boolean) if (locales.includes(parts[0])) { parts[0] = nextLocale return `/${parts.join('/')}` } return `/${nextLocale}${pathname === '/' ? '' : pathname}` } function MenuIcon({ open }) { return ( ) } function Logo() { return ( ) } export default function Header({ lang = 'fa' }){ const pathname = usePathname() const [isOpen, setIsOpen] = useState(false) const isFa = lang === 'fa' const basePath = `/${lang}` const items = [ { href: `${basePath}#about`, label: isFa ? 'درباره ما' : 'About' }, { href: `${basePath}#products`, label: isFa ? 'محصولات' : 'Products' }, { href: `${basePath}#production`, label: isFa ? 'تجهیزات' : 'Equipment' }, { href: `${basePath}/management`, label: isFa ? 'مدیریت' : 'Management' }, ] return (
setIsOpen(false)}>
English / فارسی
{isOpen && (
)}
) }