diff --git a/src/components/ai/insights-board.tsx b/src/components/ai/insights-board.tsx index af4158c..ea3a8d0 100644 --- a/src/components/ai/insights-board.tsx +++ b/src/components/ai/insights-board.tsx @@ -85,7 +85,9 @@ export function InsightsBoard() { -
+ {/* No frame of its own: the table already draws its toolbar and + grid as cards, and a third card around them boxed them twice. */} +
( -
+
}> void refetchRuns()} /> diff --git a/src/components/insights/insight-students-table.tsx b/src/components/insights/insight-students-table.tsx index 58dbac4..2847874 100644 --- a/src/components/insights/insight-students-table.tsx +++ b/src/components/insights/insight-students-table.tsx @@ -60,12 +60,15 @@ export function InsightStudentsTable(props: { }).format(new Date(value)); }; + // Widths sum to ~1095px with the action column, so the grid fits a 1440px + // screen beside the sidebar; at the 120px default every column got, the + // last one slid under the sticky actions and the table asked to scroll. const columns = createMemo[]>(() => [ { id: "student", accessorFn: (row) => row.name, header: rt("student"), - size: 220, + size: 130, meta: { align: "center" }, cell: (cell) => ( @@ -75,6 +78,7 @@ export function InsightStudentsTable(props: { }, { id: "status", + size: 110, accessorFn: (row) => row.state, header: rt("status" as never), meta: { align: "center" }, @@ -98,6 +102,7 @@ export function InsightStudentsTable(props: { }, { id: "attention", + size: 95, accessorFn: (row) => row.attention, header: rt("attention"), meta: { align: "center" }, @@ -109,6 +114,7 @@ export function InsightStudentsTable(props: { }, { id: "cards", + size: 95, accessorFn: (row) => row.cards, header: rt("cards"), meta: { align: "center" }, @@ -116,6 +122,7 @@ export function InsightStudentsTable(props: { }, { id: "marks", + size: 135, accessorFn: (row) => row.marks.average ?? -1, header: rt("marksAverage"), meta: { align: "center" }, @@ -123,6 +130,7 @@ export function InsightStudentsTable(props: { }, { id: "attendance", + size: 125, accessorFn: (row) => (row.attendance.observed > 0 ? row.attendance.rate ?? -1 : -1), header: rt("attendanceRate"), meta: { align: "center" }, @@ -134,6 +142,7 @@ export function InsightStudentsTable(props: { }, { id: "study", + size: 95, accessorFn: (row) => row.study.stints, header: t("insights.studyStints"), meta: { align: "center" }, @@ -141,6 +150,7 @@ export function InsightStudentsTable(props: { }, { id: "confidence", + size: 105, accessorFn: (row) => row.confidence ?? "", header: rt("confidence"), meta: { align: "center" }, @@ -148,6 +158,7 @@ export function InsightStudentsTable(props: { }, { id: "computedAt", + size: 95, accessorFn: (row) => row.computed_at ?? 0, header: t("insights.computedAt"), meta: { align: "center", cellClass: "text-xs text-muted-foreground whitespace-nowrap" }, diff --git a/src/components/ui/data-table.test.tsx b/src/components/ui/data-table.test.tsx index 3ca5f91..bbf3e6c 100644 --- a/src/components/ui/data-table.test.tsx +++ b/src/components/ui/data-table.test.tsx @@ -48,8 +48,10 @@ test("keeps only the rightmost action column sticky and fixed at 110x45", () => expect(actionsCell.classList).not.toContain("text-right"); expect(actionsCell.style.width).toBe("110px"); const columnTracks = document.querySelectorAll("col"); - expect(columnTracks[0]?.style.width).toBe("calc(50% - 55px)"); - expect(columnTracks[1]?.style.width).toBe("calc(50% - 55px)"); + // Plain percentages: Chrome reads a %-and-px calc() on a table column as + // auto and splits the table evenly, whatever each column's size says. + expect(columnTracks[0]?.style.width).toBe("50%"); + expect(columnTracks[1]?.style.width).toBe("50%"); expect(columnTracks[2]?.style.width).toBe("110px"); const roleHeader = screen.getAllByRole("columnheader").find((header) => header.textContent?.startsWith("Role")); expect(roleHeader?.classList).not.toContain("table-sticky-head-right"); diff --git a/src/components/ui/data-table.tsx b/src/components/ui/data-table.tsx index c8d1ff0..ac5e02b 100644 --- a/src/components/ui/data-table.tsx +++ b/src/components/ui/data-table.tsx @@ -208,8 +208,11 @@ export function DataTable(props: DataTableProps (props.mobileLayout ?? "cards") === "cards" && compactScreen(); @@ -326,7 +329,7 @@ export function DataTable(props: DataTableProps (props: DataTableProps{props.filters} -
+ {/* Beside the search the actions keep their own width (the search + out-grows them 100:1). A label too long to fit there wraps to + a line of its own, where the sole grower takes the full row and + the button stretches instead of hanging off the right edge. */} +
{/* A "yakında" button does nothing yet; on a phone it only pushes the working action off the search row. */} -
{props.actions}
+
{props.actions}
@@ -395,13 +402,19 @@ export function DataTable(props: DataTableProps{(cell) =>
{flexRender(cell().column.columnDef.cell, cell().getContext())}
}
0}> -
+ {/* Two fields per line, label over value: a label/value + row per field made every card as tall as its column + count. Cells are written for a centred table column, + so the card pulls their content back to the left. */} +
{(cell) => ( - <> -
{headerLabel(cell.column.id)}
-
{flexRender(cell.column.columnDef.cell, cell.getContext())}
- +
+
{headerLabel(cell.column.id)}
+
+ {flexRender(cell.column.columnDef.cell, cell.getContext())} +
+
)}
diff --git a/src/components/ui/data-toolbar.tsx b/src/components/ui/data-toolbar.tsx index 3c408cb..430560a 100644 --- a/src/components/ui/data-toolbar.tsx +++ b/src/components/ui/data-toolbar.tsx @@ -25,7 +25,7 @@ export function DataToolbar(props: {
{props.filters}
-
{props.actions}
+
{props.actions}
);