"use client"; import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useLocale, useTranslations } from "next-intl"; import { FloatingControls } from "@/components/layout/floating-controls"; import { Dock, DockIcon } from "@/components/ui/dock"; import { getLocalizedPath, stripLocalePrefix, type AppLocale } from "@/lib/locale"; import { cn } from "@/lib/utils"; type SiteDockProps = { defaultLocale: AppLocale; /** * Server-computed via `isSuperAdmin()` in the parent layout. This client * component only decides whether to *render* the Admin shortcut — it performs * no auth check and grants no access; the real guard lives server-side on * each admin page/action. */ isSuperAdmin?: boolean; }; type NavKey = "about" | "portfolio" | "products" | "contact"; type NavItem = { key: NavKey; path: string; disabled?: boolean; }; // "Home" is intentionally omitted — the logo (first dock icon) is the home link. const navItems: NavItem[] = [ { key: "about", path: "/about" }, { key: "portfolio", path: "/portfolio" }, { key: "products", path: "/products", disabled: true }, { key: "contact", path: "/contact" }, ]; function isNavItemActive(currentPath: string, itemPath: string) { if (itemPath === "/") { return currentPath === "/"; } return currentPath === itemPath || currentPath.startsWith(`${itemPath}/`); } export function SiteDock({ defaultLocale, isSuperAdmin = false }: SiteDockProps) { const locale = useLocale(); const pathname = usePathname(); const t = useTranslations("navigation"); const currentPath = stripLocalePrefix(pathname); const homeHref = getLocalizedPath(locale, "/", defaultLocale); return ( <> {/* ===== Bottom dock (Magic UI) — primary navigation ===== */}
{/* ── Logo (fixed src → no refresh flash) ── */} mohfarawati
{/* ── Pages ── */} {navItems.map(({ key, path, disabled }) => { const itemPath = path || "/"; const isActive = isNavItemActive(currentPath, itemPath); const label = t(key); const src = `/dock/${key}${isActive ? "-active" : ""}.svg`; const icon = ( {label} ); return ( {disabled ? ( {icon} ) : ( {icon} )} ); })}
{/* ===== Corner controls — theme / language / sound / admin (fan out) ===== */} ); } function DockTip({ label, soon }: { label: string; soon?: string }) { return ( {label} {soon ? {soon} : null} ); }