import React, { useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { Trophy, RefreshCw } from "lucide-react"; import { TaskId } from "../types"; import { fetchLeaderboard } from "../api"; import LeaderboardTable from "./LeaderboardTable"; import { clsx } from "clsx"; const Leaderboard: React.FC = () => { const [activeTab, setActiveTab] = useState("bug_detection"); const { data: entries, isLoading, refetch, isRefetching } = useQuery({ queryKey: ["leaderboard", activeTab], queryFn: () => fetchLeaderboard(activeTab), }); const tabs: { id: TaskId; label: string }[] = [ { id: "bug_detection", label: "Bug Detection" }, { id: "security_audit", label: "Security Audit" }, { id: "architectural_review", label: "Arch. Review" }, ]; return (
{/* Header */}

Leaderboard

{/* Tabs */}
{tabs.map((tab) => ( ))}
{/* Content */}
{isLoading ? (
Loading entries...
) : entries && entries.length > 0 ? ( ) : (

No rankings yet

)}
); }; export default Leaderboard;