From bd48f3f25c0cfad1eb8bd98e4ade023867a3a2bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Mon, 21 Sep 2026 21:00:30 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20table=20column=20widths,?= =?UTF-8?q?=20compact=20phone=20cards,=20insights=20frame=20-=20table=20co?= =?UTF-8?q?lumns=20take=20their=20declared=20size:=20a=20calc()=20mixing?= =?UTF-8?q?=20%=20and=20px=20on=20a=20=20=20=20reads=20as=20auto=20in?= =?UTF-8?q?=20Chrome,=20so=20every=20table=20split=20into=20equal=20column?= =?UTF-8?q?s;=20=20=20the=20shares=20are=20plain=20percentages=20now,=20be?= =?UTF-8?q?side=20the=20fixed=20action=20column=20-=20phone=20cards=20lay?= =?UTF-8?q?=20fields=20out=20two=20per=20line,=20label=20over=20value,=20a?= =?UTF-8?q?nd=20pull=20=20=20cell=20content=20back=20to=20the=20left=20?= =?UTF-8?q?=E2=80=94=20cells=20centred=20for=20a=20table=20column=20had=20?= =?UTF-8?q?=20=20values=20drifting=20to=20the=20middle=20of=20the=20card?= =?UTF-8?q?=20-=20a=20toolbar=20action=20too=20long=20to=20share=20the=20s?= =?UTF-8?q?earch=20row=20stretches=20across=20its=20=20=20own=20row=20inst?= =?UTF-8?q?ead=20of=20hanging=20off=20the=20right=20edge=20-=20insights=20?= =?UTF-8?q?tables=20lose=20the=20extra=20card=20around=20them,=20which=20b?= =?UTF-8?q?oxed=20the=20=20=20toolbar=20and=20grid=20twice=20-=20insights?= =?UTF-8?q?=20student=20columns=20are=20sized=20to=20fit=20a=201440px=20sc?= =?UTF-8?q?reen=20beside=20the=20=20=20sidebar=20without=20a=20horizontal?= =?UTF-8?q?=20scroll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ai/insights-board.tsx | 6 ++-- .../insights/insight-students-table.tsx | 13 +++++++- src/components/ui/data-table.test.tsx | 6 ++-- src/components/ui/data-table.tsx | 33 +++++++++++++------ src/components/ui/data-toolbar.tsx | 4 +-- 5 files changed, 45 insertions(+), 17 deletions(-) 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}
);