"use client"; import { useMemo, useState } from "react"; import type { BenchmarkItem, PromptCategory } from "@/lib/types"; function categoryColor(category: PromptCategory) { switch (category) { case "red": return "text-red-300"; case "blue": return "text-blue-300"; case "purple": return "text-purple-300"; } } export function ResultsTable({ items }: { items: BenchmarkItem[] }) { const [expandedPromptId, setExpandedPromptId] = useState(null); const rows = useMemo(() => items, [items]); return (
{rows.map((row) => { const expanded = expandedPromptId === row.promptId; return ( {/* T1: Refusal/Keyword */} {/* T2: Quality */} {/* T3: AI Judge */} {/* T4: Semantic */} ); })}
Category Prompt Overall T1 T2 T3 T4 Latency
{row.category.toUpperCase()} {row.title} {row.score} 0 ? "text-red-400" : "text-gray-500"}> {row.t1_refusal > 0 ? "R" : "•"} / {Math.round(row.t1_keyword)} {Math.round(row.t2_quality)} {row.t3_judge !== undefined ? Math.round(row.t3_judge) : "-"} {row.t4_semantic !== undefined ? Math.round(row.t4_semantic) : "-"} {row.latencyMs}ms
{expandedPromptId ? (
            {rows.find((r) => r.promptId === expandedPromptId)?.responseText ?? ""}
          
) : null}
); }