File size: 5,728 Bytes
dbdd6d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
"use client"

import { ArrowUpRight } from "lucide-react"
import { cn } from "@/lib/utils"
import type { CategoryType } from "@/lib/benchmark-schema"

export interface EvalNodeTableRow {
  id: string
  title: string
  kind: string
  kindLabel: string
  category: CategoryType
  familyLabel?: string
  suiteLabel?: string
  description: string
  modelsCount: number
  metricCount: number
  childCount: number
  isNavigable: boolean
  actionLabel: string
  domains: string[]
  completenessScore?: number
}

interface EvalNodeTableProps {
  rows: EvalNodeTableRow[]
  onOpen: (id: string) => void
}

const CATEGORY_DOT: Record<string, string> = {
  General: "bg-sky-400",
  Reasoning: "bg-violet-400",
  Agentic: "bg-amber-400",
  Safety: "bg-rose-400",
  Code: "bg-emerald-400",
  Math: "bg-indigo-400",
  Multilingual: "bg-teal-400",
}

export function EvalNodeTable({ rows, onOpen }: EvalNodeTableProps) {
  return (
    <div className="overflow-x-auto">
      <table className="ec-htable">
        <thead>
          <tr>
            <th style={{ width: "32%" }}>Node</th>
            <th>Lineage</th>
            <th>Kind</th>
            <th className="num">Children</th>
            <th className="num">Models</th>
            <th className="num">Metrics</th>
            <th style={{ width: "16%" }}>Completeness</th>
            <th style={{ width: 90 }} />
          </tr>
        </thead>
        <tbody>
          {rows.map((row) => {
            const completenessPct =
              row.completenessScore != null
                ? Math.round(row.completenessScore * 100)
                : null
            const dotClass = CATEGORY_DOT[row.category] ?? "bg-stone-400"

            return (
              <tr
                key={row.id}
                onClick={() => row.isNavigable && onOpen(row.id)}
                style={{ cursor: row.isNavigable ? "pointer" : "default" }}
                aria-disabled={!row.isNavigable}
              >
                <td>
                  <div className="flex items-start gap-2.5 min-w-0">
                    <span
                      className={cn(
                        "shrink-0 mt-1.5 h-2 w-2 rounded-full",
                        dotClass
                      )}
                      aria-hidden
                    />
                    <div className="min-w-0">
                      <div className="font-semibold text-[14px] text-[color:var(--fg)] truncate">
                        {row.title}
                      </div>
                      {row.description && (
                        <div className="mt-1 text-[12px] leading-[1.5] text-[color:var(--fg-muted)] line-clamp-2">
                          {row.description}
                        </div>
                      )}
                    </div>
                  </div>
                </td>
                <td className="text-[12px] text-[color:var(--fg-muted)]">
                  {row.familyLabel && (
                    <div className="font-mono uppercase tracking-[0.06em] text-[10px] text-[color:var(--fg-subtle)] truncate">
                      {row.familyLabel}
                    </div>
                  )}
                  {row.suiteLabel && (
                    <div className="text-[12px] text-[color:var(--fg-muted)] truncate">
                      {row.suiteLabel}
                    </div>
                  )}
                  {!row.familyLabel && !row.suiteLabel && (
                    <span className="text-[color:var(--fg-subtle)]"></span>
                  )}
                </td>
                <td>
                  <span className="inline-flex items-center font-mono text-[10px] uppercase tracking-[0.12em] text-[color:var(--fg)] border border-[color:var(--border-soft)] bg-[color:var(--bg)] px-2 py-0.5">
                    {row.kindLabel}
                  </span>
                </td>
                <td className="num font-mono text-[13px]">
                  {row.childCount > 0 ? row.childCount.toLocaleString() : "—"}
                </td>
                <td className="num font-mono text-[13px]">
                  {row.modelsCount.toLocaleString()}
                </td>
                <td className="num font-mono text-[13px]">
                  {row.metricCount.toLocaleString()}
                </td>
                <td>
                  {completenessPct != null ? (
                    <div className="flex items-center gap-2">
                      <div className="relative h-1.5 flex-1 bg-[color:var(--bg-surface)]">
                        <div
                          className="absolute left-0 top-0 bottom-0 bg-[color:var(--fg)] motion-academic-progress"
                          style={{ width: `${completenessPct}%` }}
                        />
                      </div>
                      <span className="font-mono text-[11px] text-[color:var(--fg)] tabular-nums w-9 text-right">
                        {completenessPct}%
                      </span>
                    </div>
                  ) : (
                    <span className="font-mono text-[11px] text-[color:var(--fg-subtle)]">

                    </span>
                  )}
                </td>
                <td>
                  {row.isNavigable && (
                    <span
                      className="font-mono text-[10px] tracking-[0.12em] uppercase text-[color:var(--accent)] inline-flex items-center gap-1"
                    >
                      Open
                      <ArrowUpRight className="h-3 w-3" aria-hidden />
                    </span>
                  )}
                </td>
              </tr>
            )
          })}
        </tbody>
      </table>
    </div>
  )
}