Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: the agents page is one column of cards that open in place

The roster loses its second column and its table view. Selecting a card opens
its details under it as four folded sections: overview, settings, accounts and
the terminal. The status, message and wanted rows, which the card header
already shows, are gone from the details. The terminal page's details dialog
keeps the flat list.
This commit is contained in:
iris 2026-11-01 01:21:43 +01:00
commit 2eaa02e892

View file

@ -27,6 +27,12 @@ import { clampLeft } from "./popover-position.js";
import { forExistingColumns } from "./table-filters.js";
import "./Table.css";
/**
* What filtering and sorting read from a column, without how its cell draws:
* for a list that has no table to draw them in (`FilterableView` as cards).
*/
export type FilterColumn<T> = Omit<TableColumn<T>, "render">;
export interface TableColumn<T> {
key: string;
// `ComponentChildren`, not `string` — a plain string still satisfies
@ -130,7 +136,7 @@ function isFilterActive(f: ColumnFilterState | undefined): boolean {
return f !== undefined && (f.value !== "" || f.values.length > 0);
}
function isFilterable<T>(c: TableColumn<T>): boolean {
function isFilterable<T>(c: FilterColumn<T>): boolean {
return c.filterValue !== undefined || c.filterValues !== undefined;
}
@ -154,7 +160,7 @@ function compareValues(a: string | number, b: string | number): number {
// layout renders its own trigger against the same `getFilter`/
// `updateFilter`/`toggleFilterValue`/`multiselectOptionsFor` this returns.
export function useTableFilters<T>(
columns: TableColumn<T>[],
columns: FilterColumn<T>[],
rows: T[],
storageKey: string,
) {
@ -203,7 +209,7 @@ export function useTableFilters<T>(
// `visibleRows`, matching how a spreadsheet's column filters don't
// hide each other's choices. A row contributes every one of its own
// values, not just one.
function multiselectOptionsFor(c: TableColumn<T>): string[] {
function multiselectOptionsFor(c: FilterColumn<T>): string[] {
if (!c.filterValues) return [];
const values = new Set<string>();
for (const row of rows) for (const v of c.filterValues(row)) values.add(v);