fabro/apps/fabro-web/app/components/runs-list/toggleable-column.ts
Bryan Helmkamp 71c06c1bc4
feat(web): add "Created by" avatar column to runs list view
Visible by default to the right of Status; toggleable via the column
picker. Extracts the principal avatar/label helper out of the run
summary panel so both surfaces share one renderer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 09:28:20 -04:00

44 lines
1.1 KiB
TypeScript

export const TOGGLEABLE_COLUMNS = [
"created_by",
"repo",
"workflow",
"created",
"updated",
"elapsed",
"size",
"changes",
"pr",
] as const;
const TOGGLEABLE_COLUMN_SET = new Set<string>(TOGGLEABLE_COLUMNS);
export type ToggleableColumn = (typeof TOGGLEABLE_COLUMNS)[number];
export const toggleableColumnLabels: Record<ToggleableColumn, string> = {
repo: "Repo",
workflow: "Workflow",
created_by: "Created by",
created: "Created",
updated: "Updated",
elapsed: "Elapsed",
size: "Size",
changes: "Changes",
pr: "PR",
};
export function parseHiddenColumns(raw: string | null): Set<ToggleableColumn> {
const hidden = new Set<ToggleableColumn>();
if (!raw) return hidden;
for (const value of raw.split(",")) {
const trimmed = value.trim();
if (TOGGLEABLE_COLUMN_SET.has(trimmed)) {
hidden.add(trimmed as ToggleableColumn);
}
}
return hidden;
}
export function serializeHiddenColumns(hidden: Set<ToggleableColumn>): string | null {
if (hidden.size === 0) return null;
return TOGGLEABLE_COLUMNS.filter((col) => hidden.has(col)).join(",");
}