"use client";

import { usePathname } from "next/navigation";

const LINKS: { href: string; label: string }[] = [
  { href: "/", label: "The Floor" },
  { href: "/library", label: "Library" },
  { href: "/artists", label: "Artists" },
  { href: "/discover", label: "Discover" },
  { href: "/lastfm", label: "Last.fm" },
  { href: "/wanted", label: "Wanted" },
];

export function ContentsNav() {
  const pathname = usePathname();
  if (pathname === "/login") return null; // no section nav on the login screen
  const active = (href: string) => (href === "/" ? pathname === "/" : pathname.startsWith(href));
  return (
    <nav className="contents">
      {LINKS.map((l) => (
        <a key={l.href} href={l.href} className={active(l.href) ? "here" : ""}>
          {l.label}
        </a>
      ))}
      <span className="sep" />
      <a href="/settings" className={active("/settings") ? "here" : ""}>
        Settings
      </a>
    </nav>
  );
}
