Spaces:
Running
Running
Fix sort toggle direction and remove categories as sortable column
Browse files- app/evals/page.tsx +6 -14
- components/family-table.tsx +2 -2
app/evals/page.tsx
CHANGED
|
@@ -51,15 +51,13 @@ function EvalsPageInner() {
|
|
| 51 |
const deferredSearchQuery = useDeferredValue(searchQuery)
|
| 52 |
|
| 53 |
const handleSort = useCallback((col: FamilySortCol) => {
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
}
|
| 59 |
setSortDir("asc")
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
}, [])
|
| 63 |
|
| 64 |
useEffect(() => {
|
| 65 |
Promise.all([fetchEvalHierarchy(), fetchEvalList(), fetchBenchmarkMetadata()])
|
|
@@ -166,12 +164,6 @@ function EvalsPageInner() {
|
|
| 166 |
case "name":
|
| 167 |
cmp = a.display_name.localeCompare(b.display_name)
|
| 168 |
break
|
| 169 |
-
case "categories": {
|
| 170 |
-
const aTag = (a.derivedTags ?? [])[0] ?? ""
|
| 171 |
-
const bTag = (b.derivedTags ?? [])[0] ?? ""
|
| 172 |
-
cmp = aTag.localeCompare(bTag)
|
| 173 |
-
break
|
| 174 |
-
}
|
| 175 |
case "benchmarks":
|
| 176 |
cmp = getFamilyBenchmarkCount(a) - getFamilyBenchmarkCount(b)
|
| 177 |
break
|
|
|
|
| 51 |
const deferredSearchQuery = useDeferredValue(searchQuery)
|
| 52 |
|
| 53 |
const handleSort = useCallback((col: FamilySortCol) => {
|
| 54 |
+
if (sortCol === col) {
|
| 55 |
+
setSortDir((d) => (d === "asc" ? "desc" : "asc"))
|
| 56 |
+
} else {
|
| 57 |
+
setSortCol(col)
|
|
|
|
| 58 |
setSortDir("asc")
|
| 59 |
+
}
|
| 60 |
+
}, [sortCol])
|
|
|
|
| 61 |
|
| 62 |
useEffect(() => {
|
| 63 |
Promise.all([fetchEvalHierarchy(), fetchEvalList(), fetchBenchmarkMetadata()])
|
|
|
|
| 164 |
case "name":
|
| 165 |
cmp = a.display_name.localeCompare(b.display_name)
|
| 166 |
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
case "benchmarks":
|
| 168 |
cmp = getFamilyBenchmarkCount(a) - getFamilyBenchmarkCount(b)
|
| 169 |
break
|
components/family-table.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import { humanizeEvaluationId } from "@/lib/utils"
|
|
| 12 |
|
| 13 |
const LEAVES_INLINE_MAX = 50
|
| 14 |
|
| 15 |
-
export type FamilySortCol = "name" | "
|
| 16 |
|
| 17 |
interface FamilyTableProps {
|
| 18 |
families: HierarchyFamily[]
|
|
@@ -348,7 +348,7 @@ export function FamilyTable({
|
|
| 348 |
<thead>
|
| 349 |
<tr>
|
| 350 |
<SortTh col="name" style={{ width: "55%" }}>Family</SortTh>
|
| 351 |
-
<
|
| 352 |
<SortTh col="benchmarks" className="num">Benchmarks</SortTh>
|
| 353 |
<SortTh col="results" className="num">Reported results</SortTh>
|
| 354 |
<th style={{ width: 90 }} />
|
|
|
|
| 12 |
|
| 13 |
const LEAVES_INLINE_MAX = 50
|
| 14 |
|
| 15 |
+
export type FamilySortCol = "name" | "benchmarks" | "results"
|
| 16 |
|
| 17 |
interface FamilyTableProps {
|
| 18 |
families: HierarchyFamily[]
|
|
|
|
| 348 |
<thead>
|
| 349 |
<tr>
|
| 350 |
<SortTh col="name" style={{ width: "55%" }}>Family</SortTh>
|
| 351 |
+
<th>Categories</th>
|
| 352 |
<SortTh col="benchmarks" className="num">Benchmarks</SortTh>
|
| 353 |
<SortTh col="results" className="num">Reported results</SortTh>
|
| 354 |
<th style={{ width: 90 }} />
|