/** * Data list “view type” — shared by Properties drawer, ListPageTemplate tabs, and client state. * * **Single source of truth** for view labels/icons: use `DATA_LIST_VIEW_TILES` and * `dataListViewLabel` / `dataListViewIcon` on every page so Table / List / Board / Dashboard * stay consistent and stay wired to the same `useTableState` dataset (see `docs/data-views-pattern.md`). */ export type DataListViewType = | "table" | "list" | "board" | "dashboard" | "calendar" | "folder" | "panel" | "tree-panel" export const DATA_LIST_VIEW_TILES: readonly { value: DataListViewType label: string icon: string }[] = [ { value: "table", icon: "fa-table", label: "Table" }, { value: "list", icon: "fa-list", label: "List" }, { value: "board", icon: "fa-table-columns", label: "Board" }, { value: "dashboard", icon: "fa-chart-mixed", label: "Dashboard" }, { value: "calendar", icon: "fa-calendar-days", label: "Calendar" }, { value: "folder", icon: "fa-grid-2", label: "Folder" }, { value: "panel", icon: "fa-sidebar", label: "List & details" }, { value: "tree-panel", icon: "fa-sitemap", label: "Tree & details" }, ] /** User-facing name for tabs, Properties summary rows, and tooltips (not entity-specific). */ export function dataListViewLabel(view: DataListViewType): string { return DATA_LIST_VIEW_TILES.find(t => t.value === view)?.label ?? view } /** Font Awesome icon class (no prefix) for tab / toolbar state when view changes. */ export function dataListViewIcon(view: DataListViewType): string { return DATA_LIST_VIEW_TILES.find(t => t.value === view)?.icon ?? "fa-table" } /** Add-view menu hint + `` keys (1–9). Skipped in inputs via `useShortcut`. */ export function dataListViewAddShortcut(index: number): string | undefined { if (index < 0 || index > 8) return undefined return String(index + 1) }