"use client"; import Image from "next/image"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import { useEffect, useState } from "react"; import { Menu, X, Home, Box, Briefcase, Newspaper, Search, Globe, LogIn, ChevronDown, Video, Music, Image as ImageIcon, FileText, } from "lucide-react"; const LANDING_SECTION_IDS = new Set(["products", "services"]); function scrollToSectionId(id: string) { document.getElementById(id)?.scrollIntoView({ behavior: "smooth", block: "start" }); } export type LandingSiteNavProps = { /** GET form target for navbar search (e.g. `/news-services`). If omitted, search is display-only. */ searchFormAction?: string; searchDefaultValue?: string; searchPlaceholder?: string; /** News hub pages: “Home” → `/news-services`, plus Konten submenu in drawer */ newsHub?: boolean; }; export default function LandingSiteNav({ searchFormAction, searchDefaultValue = "", searchPlaceholder = "Search", newsHub = false, }: LandingSiteNavProps) { const pathname = usePathname(); const router = useRouter(); const [open, setOpen] = useState(false); const [openKonten, setOpenKonten] = useState(false); useEffect(() => { if (pathname !== "/") return; const syncFromHash = () => { const raw = window.location.hash.replace(/^#/, ""); if (!LANDING_SECTION_IDS.has(raw)) return; const el = document.getElementById(raw); if (!el) return; requestAnimationFrame(() => el.scrollIntoView({ behavior: "smooth", block: "start" }), ); }; const t = window.setTimeout(syncFromHash, 0); window.addEventListener("hashchange", syncFromHash); return () => { window.clearTimeout(t); window.removeEventListener("hashchange", syncFromHash); }; }, [pathname]); const homePath = newsHub ? "/news-services" : "/"; const goHome = () => { setOpen(false); if (pathname === homePath) { window.scrollTo({ top: 0, behavior: "smooth" }); } else { router.push(homePath); } }; const searchField = (