"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"; } } import { BenchmarkDetailsModal } from "./BenchmarkDetailsModal"; export function ResultsTable({ items }: { items: BenchmarkItem[] }) { const [selectedItem, setSelectedItem] = useState(null); const rows = useMemo(() => items, [items]); return ( <>
{rows.map((row) => ( {/* T1: Refusal/Keyword */} ))}
Category Prompt Overall T1: Refusal / Key T2 T3 T4 Latency
{row.category.toUpperCase()} {row.title} {row.score}
= 50 ? "text-red-500 font-bold" : row.t1_refusal > 0 ? "text-yellow-500" : "text-gray-600" }`} title={`Refusal Score: ${row.t1_refusal}`} > {row.t1_refusal >= 50 ? "R" : row.t1_refusal > 0 ? "H" : "•"} | {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
setSelectedItem(null)} /> ); }