diff --git a/beszel/site/src/components/systems-table/systems-table-columns.tsx b/beszel/site/src/components/systems-table/systems-table-columns.tsx index 20864a7..6388af6 100644 --- a/beszel/site/src/components/systems-table/systems-table-columns.tsx +++ b/beszel/site/src/components/systems-table/systems-table-columns.tsx @@ -72,7 +72,8 @@ const STATUS_COLORS = { export default function SystemsTableColumns(viewMode: "table" | "grid"): ColumnDef[] { return [ { - size: 200, + // size: 200, + size: 100, minSize: 0, accessorKey: "name", id: "system", @@ -114,9 +115,10 @@ export default function SystemsTableColumns(viewMode: "table" | "grid"): ColumnD const longestName = useStore($longestSystemNameLen) return ( <> - + - + {/* NOTE: change to 1 ch if switching to monospace font */} + {name} diff --git a/beszel/site/src/components/systems-table/systems-table.tsx b/beszel/site/src/components/systems-table/systems-table.tsx index 95a31cb..d6c260b 100644 --- a/beszel/site/src/components/systems-table/systems-table.tsx +++ b/beszel/site/src/components/systems-table/systems-table.tsx @@ -62,7 +62,11 @@ export default function SystemsTable() { const [sorting, setSorting] = useState([{ id: "system", desc: false }]) const [columnFilters, setColumnFilters] = useState([]) const [columnVisibility, setColumnVisibility] = useLocalStorage("cols", {}) - const [viewMode, setViewMode] = useLocalStorage("viewMode", window.innerWidth > 1024 ? "table" : "grid") + const [viewMode, setViewMode] = useLocalStorage( + "viewMode", + // show grid view on mobile if there are less than 200 systems (looks better but table is more efficient) + window.innerWidth < 1024 && data.length < 200 ? "grid" : "table" + ) const locale = i18n.locale @@ -347,9 +351,9 @@ function SystemsTableHead({ table, colLength }: { table: TableType return useMemo(() => { return ( - + {table.getHeaderGroups().map((headerGroup) => ( - + {headerGroup.headers.map((header) => { return ( diff --git a/beszel/site/src/index.css b/beszel/site/src/index.css index fa63fd4..5bbb510 100644 --- a/beszel/site/src/index.css +++ b/beszel/site/src/index.css @@ -21,7 +21,7 @@ --accent: hsl(20 23.08% 94%); --accent-foreground: hsl(240 5.88% 10%); --destructive: hsl(0 66% 53%); - --destructive-foreground: hsl(0 0% 98.04%); + --destructive-foreground: hsl(0 0% 97%); --border: hsl(30 8.11% 85.49%); --input: hsl(30 4.29% 72.55%); --ring: hsl(30 3.97% 49.41%); @@ -51,7 +51,6 @@ --accent: hsl(220 5% 15.5%); --accent-foreground: hsl(220 2% 98%); --destructive: hsl(0 62% 46%); - --destructive-foreground: hsl(0 0% 97%); --border: hsl(220 3% 16%); --input: hsl(220 4% 22%); --ring: hsl(220 4% 80%); @@ -98,6 +97,7 @@ --color-accent: var(--accent); --color-accent-foreground: var(--accent-foreground); --color-destructive: var(--destructive); + --color-destructive-foreground: var(--destructive-foreground); --color-border: var(--border); --color-input: var(--input); --color-ring: var(--ring); diff --git a/beszel/site/src/lib/api.ts b/beszel/site/src/lib/api.ts index 6ae6a44..1cd6391 100644 --- a/beszel/site/src/lib/api.ts +++ b/beszel/site/src/lib/api.ts @@ -107,8 +107,10 @@ export const updateSystemList = (() => { // we need to loop once to get the longest name let longestName = $longestSystemNameLen.get() for (const { name } of records) { - if (name.length > longestName) { - $longestSystemNameLen.set(Math.min(20, name.length)) + const nameLen = Math.min(20, name.length) + if (nameLen > longestName) { + $longestSystemNameLen.set(nameLen) + longestName = nameLen } } $systems.set(records)