"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: AI Judge */} {/* T2: Refusal/Keyword */} {/* T3: Quality */} {/* T4: Semantic */} ))}
Category Prompt Overall T1: Judge T2: Refusal T3: Quality T4: Semantic Latency
{row.category.toUpperCase()}
{row.title}
{row.strategyId && row.strategyId !== "direct" && (
{row.strategyId} {row.adversarialPrompt && ( [payload] )}
)}
{row.score} {row.t3_judge !== undefined ? Math.round(row.t3_judge) : "-"}
= 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.t4_semantic !== undefined ? Math.round(row.t4_semantic) : "-"} {row.latencyMs}ms
setSelectedItem(null)} /> ); }