"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; export default function RepoNav({ repo, defaultBranch, }: { repo: string; defaultBranch: string; }) { const pathname = usePathname(); const base = `/${repo}`; const tabs = [ { label: "overview", href: base, active: pathname === base }, { label: "files", href: `${base}/tree/${encodeURIComponent(defaultBranch)}`, active: pathname.startsWith(`${base}/tree/`) || pathname.startsWith(`${base}/blob/`), }, { label: "commits", href: `${base}/commits`, active: pathname.startsWith(`${base}/commit`), }, { label: "refs", href: `${base}/refs`, active: pathname === `${base}/refs` }, ]; return ( ); }