"use client" import Link from "next/link" import { useEffect, useMemo, useState } from "react" import { useAudienceMode } from "@/components/audience-mode-provider" import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { ArrowRight, BadgeCheck, BarChart3, Database, Info, LayoutGrid, Clock3, Scale } from "lucide-react" import type { BenchmarkEvaluationCardData } from "@/components/benchmark-evaluation-card" import { Navigation } from "@/components/navigation" import { PageHeader } from "@/components/page-header" import type { BenchmarkEvalListItem } from "@/lib/eval-processing" import { fetchEvalList, fetchModelCards } from "@/lib/dashboard-data-client" export default function HomePage() { const { mode } = useAudienceMode() const [models, setModels] = useState([]) const [evalSummaries, setEvalSummaries] = useState([]) const [modelsLoading, setModelsLoading] = useState(true) const [evalsLoading, setEvalsLoading] = useState(true) useEffect(() => { fetchModelCards() .then(setModels) .catch(console.error) .finally(() => setModelsLoading(false)) fetchEvalList() .then((data) => setEvalSummaries(data.evals)) .catch(console.error) .finally(() => setEvalsLoading(false)) }, []) const loading = modelsLoading || evalsLoading const reportingOrgCount = useMemo( () => new Set(models.flatMap((entry) => entry.evaluator_names)).size, [models] ) const avgBenchmarksPerModel = useMemo(() => { if (models.length === 0) return 0 return models.reduce((sum, entry) => sum + entry.benchmarks_count, 0) / models.length }, [models]) const totalReportedResults = useMemo( () => models.reduce((sum, entry) => sum + entry.evaluations_count, 0), [models] ) const broadestModels = useMemo(() => { return [...models] .sort((a, b) => { if (b.benchmarks_count !== a.benchmarks_count) { return b.benchmarks_count - a.benchmarks_count } return new Date(b.latest_timestamp).getTime() - new Date(a.latest_timestamp).getTime() }) .slice(0, 6) }, [models]) const widestEvaluations = useMemo(() => { return [...evalSummaries] .sort((a, b) => { if (b.models_count !== a.models_count) { return b.models_count - a.models_count } return b.avg_score_norm - a.avg_score_norm }) .slice(0, 6) }, [evalSummaries]) const latestModels = useMemo(() => { return [...models] .sort((a, b) => new Date(b.latest_timestamp).getTime() - new Date(a.latest_timestamp).getTime()) .slice(0, 6) }, [models]) const mostReportedModels = useMemo(() => { return [...models] .sort((a, b) => { if (b.evaluator_count !== a.evaluator_count) { return b.evaluator_count - a.evaluator_count } return b.benchmarks_count - a.benchmarks_count }) .slice(0, 6) }, [models]) if (loading) { return (
Loading overview...
) } return (
Demo Environment This is a research preview with sample data for demonstration purposes.
State Of The Corpus

Eval Cards brings together reported evaluation evidence from many sources into one benchmark-first reading surface.

On average, each model currently has {avgBenchmarksPerModel.toFixed(1)} benchmark views and the corpus spans {reportingOrgCount} distinct reporting organizations.

{mode === "research" ? "Research mode is best for reading methodological spread, coverage breadth, and source comparability before drilling into the dedicated model or evaluation pages." : "Policy mode is best for reading accountability, evidence coverage, and the breadth of public reporting before drilling into dedicated model or evaluation pages."}

Quick Actions
{broadestModels.map((model, index) => ( ))}
{widestEvaluations.map((evaluation, index) => ( ))}
{mostReportedModels.map((model, index) => ( 1} /> ))}
{latestModels.map((model, index) => ( ))}
) } function formatCompactDate(value: string) { const numeric = Number(value) const parsed = !Number.isNaN(numeric) && !value.includes("-") ? new Date(numeric * 1000) : new Date(value) try { return parsed.toLocaleDateString("en-US", { month: "short", day: "numeric", }) } catch { return value } } function OverviewStat({ icon: Icon, label, value, description, tone, }: { icon: React.ComponentType<{ className?: string }> label: string value: string description: string tone: string }) { return (
{label}
{value}
{description}
) } function OverviewPanel({ eyebrow, title, description, href, cta, children, }: { eyebrow: string title: string description: string href: string cta: string children: React.ReactNode }) { return (
{eyebrow}

{title}

{description}

{children}
) } function ModelOverviewRow({ rank, model, metricLabel, metricValue, secondaryLabel, highlight = false, }: { rank: number model: BenchmarkEvaluationCardData metricLabel: string metricValue: string secondaryLabel: string highlight?: boolean }) { return (
{rank}
{model.model_name}
{model.developer} · {secondaryLabel}
{metricLabel}
{highlight && ( Strong )} {metricValue}
) } function EvalOverviewRow({ rank, evaluation, metricLabel, metricValue, secondaryLabel, }: { rank: number evaluation: BenchmarkEvalListItem metricLabel: string metricValue: string secondaryLabel: string }) { return (
{rank}
{evaluation.evaluation_name}
{evaluation.latest_source_name ?? "Reported benchmark"} · {secondaryLabel}
{metricLabel}
{metricValue}
) }