Refine sortable leaderboard columns

#12
Files changed (1) hide show
  1. index.html +11 -5
index.html CHANGED
@@ -154,10 +154,11 @@
154
  cursor: pointer;
155
  }
156
  th:nth-child(2) .sort-button { justify-content: flex-start; }
157
- .sort-button:hover, .sort-button[aria-sort] { color: var(--accent); }
 
158
  .sort-mark { width: 9px; color: #a2aab7; font-size: 10px; }
159
  .sort-button[aria-sort="ascending"] .sort-mark,
160
- .sort-button[aria-sort="descending"] .sort-mark { color: var(--accent); }
161
  .rank-value { color: #536074; font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 650; }
162
  .model-cell { display: flex; align-items: center; gap: 10px; }
163
  .provider-logo, .provider-fallback {
@@ -179,6 +180,7 @@
179
  .model-provider { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; }
180
  .score { color: #3b4658; font-variant-numeric: tabular-nums; }
181
  .score-overall { color: var(--accent); font-size: 15px; font-weight: 750; }
 
182
  .empty-cell, .error-cell { padding: 24px; color: var(--muted); text-align: center !important; }
183
  .error-cell { color: #9a3535; }
184
  footer { margin-top: 32px; border-top: 1px solid var(--line); background: var(--surface); }
@@ -356,8 +358,6 @@
356
  }
357
 
358
  function sortValue(entry, column) {
359
- if (column.kind === "rank") return entry.scores.overall;
360
- if (column.kind === "model") return entry.model_name;
361
  return readPath(entry, column.path);
362
  }
363
 
@@ -437,6 +437,11 @@
437
  table.columns.forEach(function (column) {
438
  var cell = document.createElement("th");
439
  cell.scope = "col";
 
 
 
 
 
440
  var button = document.createElement("button");
441
  button.className = "sort-button";
442
  button.type = "button";
@@ -454,7 +459,7 @@
454
  if (table.state.activeKey === column.key) {
455
  table.state.direction *= -1;
456
  } else {
457
- table.state.direction = column.kind === "score" || column.kind === "rank" ? -1 : 1;
458
  }
459
  table.state.sortColumn = column;
460
  table.state.activeKey = column.key;
@@ -492,6 +497,7 @@
492
  } else {
493
  var value = readPath(entry, column.path);
494
  var classes = column.key === "overall" ? "score score-overall" : "score";
 
495
  row.appendChild(makeCell(formatScore(value), classes));
496
  }
497
  });
 
154
  cursor: pointer;
155
  }
156
  th:nth-child(2) .sort-button { justify-content: flex-start; }
157
+ .sort-button:hover { color: var(--ink); }
158
+ .sort-button[aria-sort] { color: #c73530; font-weight: 800; }
159
  .sort-mark { width: 9px; color: #a2aab7; font-size: 10px; }
160
  .sort-button[aria-sort="ascending"] .sort-mark,
161
+ .sort-button[aria-sort="descending"] .sort-mark { color: #c73530; }
162
  .rank-value { color: #536074; font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 650; }
163
  .model-cell { display: flex; align-items: center; gap: 10px; }
164
  .provider-logo, .provider-fallback {
 
180
  .model-provider { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; }
181
  .score { color: #3b4658; font-variant-numeric: tabular-nums; }
182
  .score-overall { color: var(--accent); font-size: 15px; font-weight: 750; }
183
+ .score.score-selected { color: #111; font-weight: 750; }
184
  .empty-cell, .error-cell { padding: 24px; color: var(--muted); text-align: center !important; }
185
  .error-cell { color: #9a3535; }
186
  footer { margin-top: 32px; border-top: 1px solid var(--line); background: var(--surface); }
 
358
  }
359
 
360
  function sortValue(entry, column) {
 
 
361
  return readPath(entry, column.path);
362
  }
363
 
 
437
  table.columns.forEach(function (column) {
438
  var cell = document.createElement("th");
439
  cell.scope = "col";
440
+ if (column.kind !== "score") {
441
+ cell.textContent = column.label;
442
+ header.appendChild(cell);
443
+ return;
444
+ }
445
  var button = document.createElement("button");
446
  button.className = "sort-button";
447
  button.type = "button";
 
459
  if (table.state.activeKey === column.key) {
460
  table.state.direction *= -1;
461
  } else {
462
+ table.state.direction = -1;
463
  }
464
  table.state.sortColumn = column;
465
  table.state.activeKey = column.key;
 
497
  } else {
498
  var value = readPath(entry, column.path);
499
  var classes = column.key === "overall" ? "score score-overall" : "score";
500
+ if (column.key === table.state.activeKey) classes += " score-selected";
501
  row.appendChild(makeCell(formatScore(value), classes));
502
  }
503
  });