"use client";

import { useTranslations } from "next-intl";

import { Link, usePathname } from "@/i18n/navigation";
import { cn } from "@/lib/utils";

export function AdminNav() {
  const pathname = usePathname();
  const t = useTranslations("Admin.nav");

  const tabs = [
    { href: "/admin/users", label: t("users") },
    { href: "/admin/orgs", label: t("orgs") },
    { href: "/admin/sites", label: t("sites") },
    { href: "/admin/tests", label: t("tests") },
    { href: "/admin/leads", label: t("leads") },
  ];

  return (
    <nav className="flex gap-4">
      {tabs.map((tab) => {
        const isActive = pathname.startsWith(tab.href);
        return (
          <Link
            key={tab.href}
            href={tab.href}
            className={cn(
              "text-sm transition-colors",
              isActive
                ? "font-medium text-foreground"
                : "text-muted-foreground hover:text-foreground",
            )}
          >
            {tab.label}
          </Link>
        );
      })}
    </nav>
  );
}
