"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 ( ); })}
Category Prompt Score Refused Latency Keywords Response
{row.category.toUpperCase()} {row.title} {row.score} {row.refused ? "yes" : "no"} {row.latencyMs}ms {row.matchedKeywords.length}/{row.expectedKeywords.length}
{expandedPromptId ? (
            {rows.find((r) => r.promptId === expandedPromptId)?.responseText ?? ""}
          
) : null}
); }