From 97ee2cfd78b24f42ef360d399aec0c9d7522d821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Wed, 15 Jul 2026 08:35:30 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20standardize=20admin=20table?= =?UTF-8?q?=20views?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - let the shared data toolbar support filter-only layouts - move admin users search, loading, empty, and table layout to shared primitives - align user table columns with fixed widths, truncation, and centered role badges - convert marks and attendance reports to shared table frames with mono numeric columns - reuse shared table frames in roster, work log, event attendance, exam results, and live monitor tables --- .../attendance/attendance-report-view.tsx | 52 +++++++++++-------- src/components/events/attendance-table.tsx | 5 +- src/components/marks/marks-report-view.tsx | 37 +++++++------ src/components/ui/data-toolbar.tsx | 16 +++--- src/components/users/user-table.tsx | 27 ++++++---- src/pages/admin-users-page.tsx | 32 ++++++------ src/pages/course-detail-page.tsx | 5 +- src/pages/exam-detail-page.tsx | 5 +- src/pages/live-monitor-page.tsx | 7 +-- src/pages/student-attendance-page.tsx | 8 +-- src/pages/student-marks-page.tsx | 8 +-- src/pages/work-log-page.tsx | 5 +- 12 files changed, 120 insertions(+), 87 deletions(-) diff --git a/src/components/attendance/attendance-report-view.tsx b/src/components/attendance/attendance-report-view.tsx index 79dc7d1..908a75c 100644 --- a/src/components/attendance/attendance-report-view.tsx +++ b/src/components/attendance/attendance-report-view.tsx @@ -2,6 +2,7 @@ import { For, Show } from "solid-js"; import { Link } from "@tanstack/solid-router"; import type { AttendanceCounts, AttendanceReport } from "@/api/types"; import { Badge } from "@/components/ui/badge"; +import { DataTableEmpty, DataTableFrame } from "@/components/ui/data-table"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { useT } from "@/stores/preferences-context"; @@ -17,10 +18,10 @@ function customEntries(counts: AttendanceCounts) { function CountsCard(props: { title: string; counts: AttendanceCounts }) { const t = useT(); return ( -
+

{props.title}

- {percent(props.counts.rate)} + {percent(props.counts.rate)}
@@ -32,7 +33,7 @@ function CountsCard(props: { title: string; counts: AttendanceCounts }) {
0}>
- {([label, count]) => {label}: {count}} + {([label, count]) => {label}: {count}}
@@ -43,7 +44,7 @@ function Stat(props: { label: string; value: string | number }) { return (
{props.label}
-
{props.value}
+
{props.value}
); } @@ -57,23 +58,32 @@ export function AttendanceReportView(props: { report: AttendanceReport }) { -
+

{t("attendance.courseBreakdown")}

0} - fallback={
{t("attendance.emptyCourses")}
} + fallback={{t("attendance.emptyCourses")}} > -
- + +
+ + + + + + + + + {t("nav.courses")} - {t("status.present")} - {t("status.absent")} - {t("status.late")} - {t("status.excused")} - {t("common.all")} - {t("attendance.rate")} + {t("status.present")} + {t("status.absent")} + {t("status.late")} + {t("status.excused")} + {t("common.all")} + {t("attendance.rate")} @@ -83,18 +93,18 @@ export function AttendanceReportView(props: { report: AttendanceReport }) { {block.course.title} - {block.counts.present} - {block.counts.absent} - {block.counts.late} - {block.counts.excused} - {block.counts.total} - {percent(block.counts.rate)} + {block.counts.present} + {block.counts.absent} + {block.counts.late} + {block.counts.excused} + {block.counts.total} + {percent(block.counts.rate)} )}
-
+
diff --git a/src/components/events/attendance-table.tsx b/src/components/events/attendance-table.tsx index f484824..7c04dd8 100644 --- a/src/components/events/attendance-table.tsx +++ b/src/components/events/attendance-table.tsx @@ -2,6 +2,7 @@ import { For, Show, createSignal } from "solid-js"; import type { Attendance } from "@/api/types"; import { Button } from "@/components/ui/button"; import { ConfirmDialog } from "@/components/ui/confirm-dialog"; +import { DataTableFrame } from "@/components/ui/data-table"; import { IconTrash } from "@/components/ui/icons"; import { Table, @@ -34,7 +35,7 @@ export function AttendanceTable(props: {

} > -
+ @@ -76,7 +77,7 @@ export function AttendanceTable(props: {
-
+ 0} fallback={ -
- {t("marks.empty")} -
+ {t("marks.empty")} } >
-
+
{t("marks.overall")}

{markWithGrade(props.report.overall_average, props.report.overall_grade)} @@ -39,14 +38,14 @@ export function MarksReportView(props: { report: MarksReport }) { {(block) => ( -

+

{block.course.title}

- + {markWithGrade(block.average, block.average_grade)}
@@ -54,19 +53,23 @@ export function MarksReportView(props: { report: MarksReport }) { 0} fallback={ -

- {t("exams.noResults")} -

+ {t("exams.noResults")} } > -
- + +
+ + + + + + {t("marks.exam")} {t("exams.kind")} - {t("marks.weight")} - {t("marks.mark")} + {t("marks.weight")} + {t("marks.mark")} @@ -79,18 +82,18 @@ export function MarksReportView(props: { report: MarksReport }) { - + {examKindLabel(entry.kind, t)} - {examWeight(entry) ?? "—"} - {markWithGrade(entry.mark, entry.grade)} + {examWeight(entry) ?? "—"} + {markWithGrade(entry.mark, entry.grade)} )}
-
+
)} diff --git a/src/components/ui/data-toolbar.tsx b/src/components/ui/data-toolbar.tsx index 1a14af6..621d005 100644 --- a/src/components/ui/data-toolbar.tsx +++ b/src/components/ui/data-toolbar.tsx @@ -1,3 +1,4 @@ +import { Show } from "solid-js"; import type { JSX } from "solid-js"; import { Input } from "@/components/ui/input"; import { cn } from "@/lib/cn"; @@ -10,15 +11,18 @@ export function DataToolbar(props: { actions?: JSX.Element; class?: string; }) { + const hasSearch = () => props.searchValue !== undefined || props.searchPlaceholder !== undefined || props.onSearchInput !== undefined; return (
- props.onSearchInput?.(e.currentTarget.value)} - /> + + props.onSearchInput?.(e.currentTarget.value)} + /> + {props.filters}
{props.actions}
diff --git a/src/components/users/user-table.tsx b/src/components/users/user-table.tsx index 67efea6..512fb2f 100644 --- a/src/components/users/user-table.tsx +++ b/src/components/users/user-table.tsx @@ -13,6 +13,7 @@ import { Select } from "@/components/ui/select"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { ConfirmDialog } from "@/components/ui/confirm-dialog"; +import { DataTableFrame } from "@/components/ui/data-table"; import { IconCheck } from "@/components/ui/icons"; import { ROLES } from "@/lib/roles"; import { cn } from "@/lib/cn"; @@ -42,15 +43,15 @@ function UserRoleRow(props: { return ( - {props.user.username} - {displayName(props.user)} - {props.user.email || "—"} - + {props.user.username} + {displayName(props.user)} + {props.user.email || "—"} + {t(`role.${props.user.role}` as MessageKey)} - {props.user.id} + {props.user.id}