Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/WorkloadsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactNode } from 'react';
import type { CSSProperties, ReactNode } from 'react';
import type { InfiniteData, UseInfiniteQueryResult } from '@tanstack/react-query';
import { NavLink, useLocation, useNavigate } from 'react-router-dom';
import { SortableHeader } from '@/components/SortableHeader';
Expand Down Expand Up @@ -155,7 +155,8 @@ export function WorkloadsTable({
const actionWidth = actionLabelText.length > 6 ? '160px' : '120px';
gridColumns.push(actionWidth);
}
const gridClass = `md:grid-cols-[${gridColumns.join('_')}]`;
const gridStyle = { '--workloads-cols': gridColumns.join(' ') } as CSSProperties;
const gridClass = 'md:[grid-template-columns:var(--workloads-cols)]';

const emptyMessage = showRunnerColumn ? 'No workloads found.' : 'No workloads on this runner.';

Expand All @@ -180,6 +181,7 @@ export function WorkloadsTable({
<CardContent className="px-0">
<div
className={`grid gap-2 px-6 py-4 text-xs font-semibold uppercase tracking-wide text-muted-foreground ${gridClass}`}
style={gridStyle}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] CSS vars are inherited — you could set --workloads-cols once on a common wrapper (e.g. <CardContent style={gridStyle}>) and drop the repeated style={gridStyle} on the header + each row. Keeps the markup a bit cleaner / less repetitive.

data-testid={`${testIdPrefix}-header`}
>
<SortableHeader
Expand Down Expand Up @@ -335,6 +337,7 @@ export function WorkloadsTable({
role="link"
tabIndex={0}
className={`grid items-center gap-2 px-6 py-4 text-sm text-foreground ${gridClass} cursor-pointer hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`}
style={gridStyle}
data-testid={`${testIdPrefix}-row`}
onClick={(event) => {
const target = event.target;
Expand All @@ -358,6 +361,7 @@ export function WorkloadsTable({
<div
key={rowKey}
className={`grid items-center gap-2 px-6 py-4 text-sm text-foreground ${gridClass}`}
style={gridStyle}
data-testid={`${testIdPrefix}-row`}
>
{rowContent}
Expand Down
Loading