* fix(dataTable): resizing a column no longer squashes the others mantine-datatable's built-in column resize keeps the table's total width fixed by shrinking every other column to compensate, which collapses columns toward zero in a narrow widget (open upstream issue, no fix: icflorescu/mantine-datatable#discussions-757). Replaced it with our own resize handle that only ever changes the width of the column being dragged - the table grows and scrolls horizontally instead. Shared via usePersistedTableLayout, so docker, downloads, and beszel-system-table all get it. * feat(docker): enable hold-Shift advanced focus preview The widget already renders differently for displayMode="advanced", but was missing supportsAdvancedFocus: true, so the board never offered the hold-Shift preview for it - matching downloads and media-server, which both set this flag. * style(docker): tighten row density, decouple icon size from row height Circular avatar, denser row/footer padding, and action icons rendered larger than their button via absolute positioning so they don't inflate row height (the button stays small and fixed - it repeats once per row, so any growth there multiplies across every visible container). * fix(data-table): harden shared column resizing * fix(data-table): account for board scaling * fix(data-table): compact shared headers * fix(data-table): fit columns to widget * fix(downloads): simplify advanced details * test(widgets): align Docker advanced focus * fix(downloads): widen expanded details --------- Co-authored-by: ajnart <thomas@ajnart.dev>
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
import type { ExtendedDownloadClientItem } from "@homarr/integrations";
|
|
|
|
type DownloadState = ExtendedDownloadClientItem["state"];
|
|
|
|
export const DOWNLOAD_COLUMN_ACCESSORS = [
|
|
"name",
|
|
"progress",
|
|
"size",
|
|
"downSpeed",
|
|
"upSpeed",
|
|
"time",
|
|
"state",
|
|
"added",
|
|
"ratio",
|
|
"received",
|
|
"sent",
|
|
"category",
|
|
"integration",
|
|
"index",
|
|
"type",
|
|
] as const satisfies readonly (keyof ExtendedDownloadClientItem)[];
|
|
|
|
export const ADVANCED_DOWNLOAD_COLUMN_ACCESSORS = [
|
|
"name",
|
|
"progress",
|
|
"size",
|
|
"downSpeed",
|
|
"upSpeed",
|
|
"time",
|
|
"state",
|
|
"integration",
|
|
] as const satisfies readonly (typeof DOWNLOAD_COLUMN_ACCESSORS)[number][];
|
|
|
|
type DownloadColumnAccessor = (typeof DOWNLOAD_COLUMN_ACCESSORS)[number];
|
|
|
|
export function getDownloadsStatsDisplay(showCompactStats: boolean, isAdvanced: boolean) {
|
|
return {
|
|
visible: showCompactStats || isAdvanced,
|
|
canToggle: !isAdvanced,
|
|
};
|
|
}
|
|
|
|
export function getDownloadColumnAccessors(
|
|
configuredColumns: readonly DownloadColumnAccessor[],
|
|
isAdvanced: boolean,
|
|
): readonly DownloadColumnAccessor[] {
|
|
return isAdvanced ? ADVANCED_DOWNLOAD_COLUMN_ACCESSORS : configuredColumns;
|
|
}
|
|
|
|
export function filterDownloadItemsByStatus<T extends { state: DownloadState }>(
|
|
items: readonly T[],
|
|
statusFilter: readonly string[],
|
|
): T[] {
|
|
if (statusFilter.length === 0) return [...items];
|
|
return items.filter(({ state }) => statusFilter.includes(state));
|
|
}
|
|
|
|
export function getAvailableDownloadStates(items: readonly { state: DownloadState }[]): DownloadState[] {
|
|
return [...new Set(items.map(({ state }) => state))];
|
|
}
|