expand, collapse all

This commit is contained in:
2026-05-27 10:34:52 -04:00
parent d560b2e0b4
commit 8da5957024
2 changed files with 25 additions and 0 deletions
+25
View File
@@ -63,6 +63,15 @@ export default function TestTable({ tests = [], isLoading }) {
if (typeof av === 'number' || typeof bv === 'number') return (av - bv) * sort.dir
return String(av).localeCompare(String(bv)) * sort.dir
})
const allExpanded = sorted.length > 0 && sorted.every(test => expanded.has(test.id))
function expandAll() {
setExpanded(new Set(sorted.map(test => test.id)))
}
function collapseAll() {
setExpanded(new Set())
}
if (isLoading) {
return (
@@ -82,6 +91,22 @@ export default function TestTable({ tests = [], isLoading }) {
return (
<div className="rounded-xl border border-slate-800 overflow-hidden">
<div className="px-3 py-2 border-b border-slate-800 bg-slate-900/80 flex items-center justify-end gap-2">
<button
onClick={expandAll}
disabled={allExpanded}
className="px-2.5 py-1 text-xs rounded-md border border-slate-700 text-slate-300 hover:bg-slate-800 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
>
Expand All
</button>
<button
onClick={collapseAll}
disabled={expanded.size === 0}
className="px-2.5 py-1 text-xs rounded-md border border-slate-700 text-slate-300 hover:bg-slate-800 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
>
Collapse All
</button>
</div>
<table className="w-full text-sm text-left text-slate-300 border-collapse">
<thead className="bg-slate-800 text-slate-400 text-xs uppercase tracking-wider">
<tr>
Binary file not shown.