"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";
import styles from "../styles/predictions.module.css";

const MAIN_TABS = [
  { href: "/predictions", label: "Pronostics", exact: true },
  { href: "/predictions/recap", label: "Récap", exact: false },
  { href: "/predictions/indices", label: "Indices", exact: false },
];

export function MainTabBar() {
  const pathname = usePathname();
  return (
    <div className={styles.contentTabBar}>
      {MAIN_TABS.map(({ href, label, exact }) => {
        const isActive = exact ? pathname === href : pathname.startsWith(href);
        return (
          <Link
            key={href}
            href={href}
            className={`${styles.contentTabItem} ${isActive ? styles.contentTabItemActive : ""}`}
            aria-current={isActive ? "page" : undefined}
          >
            {label}
          </Link>
        );
      })}
    </div>
  );
}
