✨ standardize admin table views
Browse files at this commit97ee2cfd78b24f42ef360d399aec0c9d7522d821Parent: 6545972- feat
- ✨ standardize admin table views
12 changed files +120 -87
- src/components/attendance/attendance-report-view.tsx +31 -21
- src/components/events/attendance-table.tsx +3 -2
- src/components/marks/marks-report-view.tsx +20 -17
- src/components/ui/data-toolbar.tsx +10 -6
- src/components/users/user-table.tsx +18 -9
- src/pages/admin-users-page.tsx +17 -15
- src/pages/course-detail-page.tsx +3 -2
- src/pages/exam-detail-page.tsx +3 -2
- src/pages/live-monitor-page.tsx +4 -3
- src/pages/student-attendance-page.tsx +4 -4
- src/pages/student-marks-page.tsx +4 -4
- src/pages/work-log-page.tsx +3 -2
src/components/attendance/attendance-report-view.tsxmodified+31 -21
| @@ -2,6 +2,7 @@ import { For, Show } from "solid-js"; | |||
| 2 | import { Link } from "@tanstack/solid-router"; | 2 | import { Link } from "@tanstack/solid-router"; |
| 3 | import type { AttendanceCounts, AttendanceReport } from "@/api/types"; | 3 | import type { AttendanceCounts, AttendanceReport } from "@/api/types"; |
| 4 | import { Badge } from "@/components/ui/badge"; | 4 | import { Badge } from "@/components/ui/badge"; |
| 5 | +import { DataTableEmpty, DataTableFrame } from "@/components/ui/data-table"; | ||
| 5 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; | 6 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; |
| 6 | import { useT } from "@/stores/preferences-context"; | 7 | import { useT } from "@/stores/preferences-context"; |
| 7 | 8 | ||
| @@ -17,10 +18,10 @@ function customEntries(counts: AttendanceCounts) { | |||
| 17 | function CountsCard(props: { title: string; counts: AttendanceCounts }) { | 18 | function CountsCard(props: { title: string; counts: AttendanceCounts }) { |
| 18 | const t = useT(); | 19 | const t = useT(); |
| 19 | return ( | 20 | return ( |
| 20 | - <article class="surface-card space-y-3 p-5"> | 21 | + <article class="data-shell space-y-3 p-4"> |
| 21 | <div class="flex items-center justify-between gap-3"> | 22 | <div class="flex items-center justify-between gap-3"> |
| 22 | <h3 class="font-display text-lg font-semibold">{props.title}</h3> | 23 | <h3 class="font-display text-lg font-semibold">{props.title}</h3> |
| 23 | - <Badge variant="secondary" class="rounded-full px-3 py-1">{percent(props.counts.rate)}</Badge> | 24 | + <Badge variant="secondary" class="mono rounded-sm px-3 py-1">{percent(props.counts.rate)}</Badge> |
| 24 | </div> | 25 | </div> |
| 25 | <dl class="grid grid-cols-2 gap-2 text-sm sm:grid-cols-3"> | 26 | <dl class="grid grid-cols-2 gap-2 text-sm sm:grid-cols-3"> |
| 26 | <Stat label={t("status.present")} value={props.counts.present} /> | 27 | <Stat label={t("status.present")} value={props.counts.present} /> |
| @@ -32,7 +33,7 @@ function CountsCard(props: { title: string; counts: AttendanceCounts }) { | |||
| 32 | </dl> | 33 | </dl> |
| 33 | <Show when={customEntries(props.counts).length > 0}> | 34 | <Show when={customEntries(props.counts).length > 0}> |
| 34 | <div class="flex flex-wrap gap-2 pt-1"> | 35 | <div class="flex flex-wrap gap-2 pt-1"> |
| 35 | - <For each={customEntries(props.counts)}>{([label, count]) => <Badge variant="outline" class="rounded-full">{label}: {count}</Badge>}</For> | 36 | + <For each={customEntries(props.counts)}>{([label, count]) => <Badge variant="outline" class="rounded-sm">{label}: {count}</Badge>}</For> |
| 36 | </div> | 37 | </div> |
| 37 | </Show> | 38 | </Show> |
| 38 | </article> | 39 | </article> |
| @@ -43,7 +44,7 @@ function Stat(props: { label: string; value: string | number }) { | |||
| 43 | return ( | 44 | return ( |
| 44 | <div class="rounded-md border bg-background/60 p-3"> | 45 | <div class="rounded-md border bg-background/60 p-3"> |
| 45 | <dt class="text-xs text-muted-foreground">{props.label}</dt> | 46 | <dt class="text-xs text-muted-foreground">{props.label}</dt> |
| 46 | - <dd class="mt-1 font-display text-xl font-semibold tabular-nums">{props.value}</dd> | 47 | + <dd class="mono mt-1 text-xl font-semibold tabular-nums">{props.value}</dd> |
| 47 | </div> | 48 | </div> |
| 48 | ); | 49 | ); |
| 49 | } | 50 | } |
| @@ -57,23 +58,32 @@ export function AttendanceReportView(props: { report: AttendanceReport }) { | |||
| 57 | <CountsCard title={t("attendance.sessions")} counts={props.report.sessions} /> | 58 | <CountsCard title={t("attendance.sessions")} counts={props.report.sessions} /> |
| 58 | </div> | 59 | </div> |
| 59 | 60 | ||
| 60 | - <section class="surface-card space-y-4 p-5"> | 61 | + <section class="data-shell space-y-4 p-4"> |
| 61 | <h3 class="font-display text-lg font-semibold">{t("attendance.courseBreakdown")}</h3> | 62 | <h3 class="font-display text-lg font-semibold">{t("attendance.courseBreakdown")}</h3> |
| 62 | <Show | 63 | <Show |
| 63 | when={props.report.courses.length > 0} | 64 | when={props.report.courses.length > 0} |
| 64 | - fallback={<div class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground">{t("attendance.emptyCourses")}</div>} | 65 | + fallback={<DataTableEmpty>{t("attendance.emptyCourses")}</DataTableEmpty>} |
| 65 | > | 66 | > |
| 66 | - <div class="overflow-hidden rounded-lg border border-border/70 bg-background/60"> | 67 | + <DataTableFrame> |
| 67 | - <Table> | 68 | + <Table class="data-table table-fixed min-w-[48rem]"> |
| 69 | + <colgroup> | ||
| 70 | + <col class="w-[30%]" /> | ||
| 71 | + <col class="w-[7rem]" /> | ||
| 72 | + <col class="w-[7rem]" /> | ||
| 73 | + <col class="w-[7rem]" /> | ||
| 74 | + <col class="w-[7rem]" /> | ||
| 75 | + <col class="w-[7rem]" /> | ||
| 76 | + <col class="w-[7rem]" /> | ||
| 77 | + </colgroup> | ||
| 68 | <TableHeader> | 78 | <TableHeader> |
| 69 | <TableRow> | 79 | <TableRow> |
| 70 | <TableHead>{t("nav.courses")}</TableHead> | 80 | <TableHead>{t("nav.courses")}</TableHead> |
| 71 | - <TableHead>{t("status.present")}</TableHead> | 81 | + <TableHead class="text-right">{t("status.present")}</TableHead> |
| 72 | - <TableHead>{t("status.absent")}</TableHead> | 82 | + <TableHead class="text-right">{t("status.absent")}</TableHead> |
| 73 | - <TableHead>{t("status.late")}</TableHead> | 83 | + <TableHead class="text-right">{t("status.late")}</TableHead> |
| 74 | - <TableHead>{t("status.excused")}</TableHead> | 84 | + <TableHead class="text-right">{t("status.excused")}</TableHead> |
| 75 | - <TableHead>{t("common.all")}</TableHead> | 85 | + <TableHead class="text-right">{t("common.all")}</TableHead> |
| 76 | - <TableHead>{t("attendance.rate")}</TableHead> | 86 | + <TableHead class="text-right">{t("attendance.rate")}</TableHead> |
| 77 | </TableRow> | 87 | </TableRow> |
| 78 | </TableHeader> | 88 | </TableHeader> |
| 79 | <TableBody> | 89 | <TableBody> |
| @@ -83,18 +93,18 @@ export function AttendanceReportView(props: { report: AttendanceReport }) { | |||
| 83 | <TableCell class="font-medium"> | 93 | <TableCell class="font-medium"> |
| 84 | <Link to="/courses/$id" params={{ id: block.course.id }} class="hover:underline">{block.course.title}</Link> | 94 | <Link to="/courses/$id" params={{ id: block.course.id }} class="hover:underline">{block.course.title}</Link> |
| 85 | </TableCell> | 95 | </TableCell> |
| 86 | - <TableCell>{block.counts.present}</TableCell> | 96 | + <TableCell class="mono text-right">{block.counts.present}</TableCell> |
| 87 | - <TableCell>{block.counts.absent}</TableCell> | 97 | + <TableCell class="mono text-right">{block.counts.absent}</TableCell> |
| 88 | - <TableCell>{block.counts.late}</TableCell> | 98 | + <TableCell class="mono text-right">{block.counts.late}</TableCell> |
| 89 | - <TableCell>{block.counts.excused}</TableCell> | 99 | + <TableCell class="mono text-right">{block.counts.excused}</TableCell> |
| 90 | - <TableCell>{block.counts.total}</TableCell> | 100 | + <TableCell class="mono text-right">{block.counts.total}</TableCell> |
| 91 | - <TableCell class="font-semibold tabular-nums">{percent(block.counts.rate)}</TableCell> | 101 | + <TableCell class="mono text-right font-semibold">{percent(block.counts.rate)}</TableCell> |
| 92 | </TableRow> | 102 | </TableRow> |
| 93 | )} | 103 | )} |
| 94 | </For> | 104 | </For> |
| 95 | </TableBody> | 105 | </TableBody> |
| 96 | </Table> | 106 | </Table> |
| 97 | - </div> | 107 | + </DataTableFrame> |
| 98 | </Show> | 108 | </Show> |
| 99 | </section> | 109 | </section> |
| 100 | </div> | 110 | </div> |
src/components/events/attendance-table.tsxmodified+3 -2
| @@ -2,6 +2,7 @@ import { For, Show, createSignal } from "solid-js"; | |||
| 2 | import type { Attendance } from "@/api/types"; | 2 | import type { Attendance } from "@/api/types"; |
| 3 | import { Button } from "@/components/ui/button"; | 3 | import { Button } from "@/components/ui/button"; |
| 4 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 4 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 5 | +import { DataTableFrame } from "@/components/ui/data-table"; | ||
| 5 | import { IconTrash } from "@/components/ui/icons"; | 6 | import { IconTrash } from "@/components/ui/icons"; |
| 6 | import { | 7 | import { |
| 7 | Table, | 8 | Table, |
| @@ -34,7 +35,7 @@ export function AttendanceTable(props: { | |||
| 34 | </p> | 35 | </p> |
| 35 | } | 36 | } |
| 36 | > | 37 | > |
| 37 | - <div class="data-table-wrap"> | 38 | + <DataTableFrame> |
| 38 | <Table class="data-table"> | 39 | <Table class="data-table"> |
| 39 | <TableHeader> | 40 | <TableHeader> |
| 40 | <TableRow> | 41 | <TableRow> |
| @@ -76,7 +77,7 @@ export function AttendanceTable(props: { | |||
| 76 | </For> | 77 | </For> |
| 77 | </TableBody> | 78 | </TableBody> |
| 78 | </Table> | 79 | </Table> |
| 79 | - </div> | 80 | + </DataTableFrame> |
| 80 | </Show> | 81 | </Show> |
| 81 | 82 | ||
| 82 | <ConfirmDialog | 83 | <ConfirmDialog |
src/components/marks/marks-report-view.tsxmodified+20 -17
| @@ -2,6 +2,7 @@ import { For, Show } from "solid-js"; | |||
| 2 | import { Link } from "@tanstack/solid-router"; | 2 | import { Link } from "@tanstack/solid-router"; |
| 3 | import type { MarksReport } from "@/api/types"; | 3 | import type { MarksReport } from "@/api/types"; |
| 4 | import { Badge } from "@/components/ui/badge"; | 4 | import { Badge } from "@/components/ui/badge"; |
| 5 | +import { DataTableEmpty, DataTableFrame } from "@/components/ui/data-table"; | ||
| 5 | import { ExamLink } from "@/components/exams/exam-link"; | 6 | import { ExamLink } from "@/components/exams/exam-link"; |
| 6 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; | 7 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; |
| 7 | import { examKindLabel } from "@/lib/exam-labels"; | 8 | import { examKindLabel } from "@/lib/exam-labels"; |
| @@ -21,13 +22,11 @@ export function MarksReportView(props: { report: MarksReport }) { | |||
| 21 | <Show | 22 | <Show |
| 22 | when={props.report.courses.length > 0} | 23 | when={props.report.courses.length > 0} |
| 23 | fallback={ | 24 | fallback={ |
| 24 | - <div class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground"> | 25 | + <DataTableEmpty>{t("marks.empty")}</DataTableEmpty> |
| 25 | - {t("marks.empty")} | ||
| 26 | - </div> | ||
| 27 | } | 26 | } |
| 28 | > | 27 | > |
| 29 | <div class="space-y-4"> | 28 | <div class="space-y-4"> |
| 30 | - <div class="surface-card flex flex-wrap items-center justify-between gap-3 p-5"> | 29 | + <div class="data-shell flex flex-wrap items-center justify-between gap-3 p-4"> |
| 31 | <span class="text-sm font-medium text-muted-foreground">{t("marks.overall")}</span> | 30 | <span class="text-sm font-medium text-muted-foreground">{t("marks.overall")}</span> |
| 32 | <p class="font-display text-3xl font-semibold tabular-nums"> | 31 | <p class="font-display text-3xl font-semibold tabular-nums"> |
| 33 | {markWithGrade(props.report.overall_average, props.report.overall_grade)} | 32 | {markWithGrade(props.report.overall_average, props.report.overall_grade)} |
| @@ -39,14 +38,14 @@ export function MarksReportView(props: { report: MarksReport }) { | |||
| 39 | 38 | ||
| 40 | <For each={props.report.courses}> | 39 | <For each={props.report.courses}> |
| 41 | {(block) => ( | 40 | {(block) => ( |
| 42 | - <article class="surface-card space-y-4 p-5"> | 41 | + <article class="data-shell space-y-4 p-4"> |
| 43 | <header class="flex flex-wrap items-center justify-between gap-2"> | 42 | <header class="flex flex-wrap items-center justify-between gap-2"> |
| 44 | <h3 class="font-display text-lg font-semibold"> | 43 | <h3 class="font-display text-lg font-semibold"> |
| 45 | <Link to="/courses/$id" params={{ id: block.course.id }} class="hover:text-primary hover:underline"> | 44 | <Link to="/courses/$id" params={{ id: block.course.id }} class="hover:text-primary hover:underline"> |
| 46 | {block.course.title} | 45 | {block.course.title} |
| 47 | </Link> | 46 | </Link> |
| 48 | </h3> | 47 | </h3> |
| 49 | - <Badge variant="secondary" class="rounded-full px-3 py-1" title={t("marks.courseAvg")}> | 48 | + <Badge variant="secondary" class="mono rounded-sm px-3 py-1" title={t("marks.courseAvg")}> |
| 50 | {markWithGrade(block.average, block.average_grade)} | 49 | {markWithGrade(block.average, block.average_grade)} |
| 51 | </Badge> | 50 | </Badge> |
| 52 | </header> | 51 | </header> |
| @@ -54,19 +53,23 @@ export function MarksReportView(props: { report: MarksReport }) { | |||
| 54 | <Show | 53 | <Show |
| 55 | when={block.results.length > 0} | 54 | when={block.results.length > 0} |
| 56 | fallback={ | 55 | fallback={ |
| 57 | - <p class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground"> | 56 | + <DataTableEmpty>{t("exams.noResults")}</DataTableEmpty> |
| 58 | - {t("exams.noResults")} | ||
| 59 | - </p> | ||
| 60 | } | 57 | } |
| 61 | > | 58 | > |
| 62 | - <div class="overflow-hidden rounded-lg border border-border/70 bg-background/60"> | 59 | + <DataTableFrame> |
| 63 | - <Table> | 60 | + <Table class="data-table table-fixed min-w-[42rem]"> |
| 61 | + <colgroup> | ||
| 62 | + <col class="w-[42%]" /> | ||
| 63 | + <col class="w-[18%]" /> | ||
| 64 | + <col class="w-[8rem]" /> | ||
| 65 | + <col class="w-[10rem]" /> | ||
| 66 | + </colgroup> | ||
| 64 | <TableHeader> | 67 | <TableHeader> |
| 65 | <TableRow> | 68 | <TableRow> |
| 66 | <TableHead>{t("marks.exam")}</TableHead> | 69 | <TableHead>{t("marks.exam")}</TableHead> |
| 67 | <TableHead>{t("exams.kind")}</TableHead> | 70 | <TableHead>{t("exams.kind")}</TableHead> |
| 68 | - <TableHead>{t("marks.weight")}</TableHead> | 71 | + <TableHead class="text-right">{t("marks.weight")}</TableHead> |
| 69 | - <TableHead>{t("marks.mark")}</TableHead> | 72 | + <TableHead class="text-right">{t("marks.mark")}</TableHead> |
| 70 | </TableRow> | 73 | </TableRow> |
| 71 | </TableHeader> | 74 | </TableHeader> |
| 72 | <TableBody> | 75 | <TableBody> |
| @@ -79,18 +82,18 @@ export function MarksReportView(props: { report: MarksReport }) { | |||
| 79 | </ExamLink> | 82 | </ExamLink> |
| 80 | </TableCell> | 83 | </TableCell> |
| 81 | <TableCell> | 84 | <TableCell> |
| 82 | - <Badge variant="outline" class="rounded-full capitalize"> | 85 | + <Badge variant="outline" class="rounded-sm capitalize"> |
| 83 | {examKindLabel(entry.kind, t)} | 86 | {examKindLabel(entry.kind, t)} |
| 84 | </Badge> | 87 | </Badge> |
| 85 | </TableCell> | 88 | </TableCell> |
| 86 | - <TableCell class="tabular-nums">{examWeight(entry) ?? "—"}</TableCell> | 89 | + <TableCell class="mono text-right">{examWeight(entry) ?? "—"}</TableCell> |
| 87 | - <TableCell class="font-semibold tabular-nums">{markWithGrade(entry.mark, entry.grade)}</TableCell> | 90 | + <TableCell class="mono text-right font-semibold">{markWithGrade(entry.mark, entry.grade)}</TableCell> |
| 88 | </TableRow> | 91 | </TableRow> |
| 89 | )} | 92 | )} |
| 90 | </For> | 93 | </For> |
| 91 | </TableBody> | 94 | </TableBody> |
| 92 | </Table> | 95 | </Table> |
| 93 | - </div> | 96 | + </DataTableFrame> |
| 94 | </Show> | 97 | </Show> |
| 95 | </article> | 98 | </article> |
| 96 | )} | 99 | )} |
src/components/ui/data-toolbar.tsxmodified+10 -6
| @@ -1,3 +1,4 @@ | |||
| 1 | +import { Show } from "solid-js"; | ||
| 1 | import type { JSX } from "solid-js"; | 2 | import type { JSX } from "solid-js"; |
| 2 | import { Input } from "@/components/ui/input"; | 3 | import { Input } from "@/components/ui/input"; |
| 3 | import { cn } from "@/lib/cn"; | 4 | import { cn } from "@/lib/cn"; |
| @@ -10,15 +11,18 @@ export function DataToolbar(props: { | |||
| 10 | actions?: JSX.Element; | 11 | actions?: JSX.Element; |
| 11 | class?: string; | 12 | class?: string; |
| 12 | }) { | 13 | }) { |
| 14 | + const hasSearch = () => props.searchValue !== undefined || props.searchPlaceholder !== undefined || props.onSearchInput !== undefined; | ||
| 13 | return ( | 15 | return ( |
| 14 | <div class={cn("flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between", props.class)}> | 16 | <div class={cn("flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between", props.class)}> |
| 15 | <div class="flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center"> | 17 | <div class="flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center"> |
| 16 | - <Input | 18 | + <Show when={hasSearch()}> |
| 17 | - class="h-9 w-full rounded-sm sm:max-w-xs" | 19 | + <Input |
| 18 | - value={props.searchValue ?? ""} | 20 | + class="h-9 w-full rounded-sm sm:max-w-xs" |
| 19 | - placeholder={props.searchPlaceholder} | 21 | + value={props.searchValue ?? ""} |
| 20 | - onInput={(e) => props.onSearchInput?.(e.currentTarget.value)} | 22 | + placeholder={props.searchPlaceholder} |
| 21 | - /> | 23 | + onInput={(e) => props.onSearchInput?.(e.currentTarget.value)} |
| 24 | + /> | ||
| 25 | + </Show> | ||
| 22 | {props.filters} | 26 | {props.filters} |
| 23 | </div> | 27 | </div> |
| 24 | <div class="flex shrink-0 items-center gap-2">{props.actions}</div> | 28 | <div class="flex shrink-0 items-center gap-2">{props.actions}</div> |
src/components/users/user-table.tsxmodified+18 -9
| @@ -13,6 +13,7 @@ import { Select } from "@/components/ui/select"; | |||
| 13 | import { Button } from "@/components/ui/button"; | 13 | import { Button } from "@/components/ui/button"; |
| 14 | import { Badge } from "@/components/ui/badge"; | 14 | import { Badge } from "@/components/ui/badge"; |
| 15 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 15 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 16 | +import { DataTableFrame } from "@/components/ui/data-table"; | ||
| 16 | import { IconCheck } from "@/components/ui/icons"; | 17 | import { IconCheck } from "@/components/ui/icons"; |
| 17 | import { ROLES } from "@/lib/roles"; | 18 | import { ROLES } from "@/lib/roles"; |
| 18 | import { cn } from "@/lib/cn"; | 19 | import { cn } from "@/lib/cn"; |
| @@ -42,15 +43,15 @@ function UserRoleRow(props: { | |||
| 42 | 43 | ||
| 43 | return ( | 44 | return ( |
| 44 | <TableRow> | 45 | <TableRow> |
| 45 | - <TableCell class="font-medium">{props.user.username}</TableCell> | 46 | + <TableCell class="truncate font-medium">{props.user.username}</TableCell> |
| 46 | - <TableCell>{displayName(props.user)}</TableCell> | 47 | + <TableCell class="truncate">{displayName(props.user)}</TableCell> |
| 47 | - <TableCell class="text-muted-foreground">{props.user.email || "—"}</TableCell> | 48 | + <TableCell class="truncate text-muted-foreground">{props.user.email || "—"}</TableCell> |
| 48 | - <TableCell> | 49 | + <TableCell class="text-center"> |
| 49 | <Badge variant="outline" class={cn("mono uppercase tracking-[0.08em]", roleTone(props.user.role))}> | 50 | <Badge variant="outline" class={cn("mono uppercase tracking-[0.08em]", roleTone(props.user.role))}> |
| 50 | {t(`role.${props.user.role}` as MessageKey)} | 51 | {t(`role.${props.user.role}` as MessageKey)} |
| 51 | </Badge> | 52 | </Badge> |
| 52 | </TableCell> | 53 | </TableCell> |
| 53 | - <TableCell class="mono text-xs text-muted-foreground">{props.user.id}</TableCell> | 54 | + <TableCell class="mono truncate text-xs text-muted-foreground">{props.user.id}</TableCell> |
| 54 | <TableCell class="w-52"> | 55 | <TableCell class="w-52"> |
| 55 | <Select | 56 | <Select |
| 56 | class="h-8 rounded-sm text-xs" | 57 | class="h-8 rounded-sm text-xs" |
| @@ -95,14 +96,22 @@ export function UserTable(props: { | |||
| 95 | }) { | 96 | }) { |
| 96 | const t = useT(); | 97 | const t = useT(); |
| 97 | return ( | 98 | return ( |
| 98 | - <div class="data-table-wrap"> | 99 | + <DataTableFrame> |
| 99 | - <Table class="data-table"> | 100 | + <Table class="data-table table-fixed min-w-[58rem]"> |
| 101 | + <colgroup> | ||
| 102 | + <col class="w-[15%]" /> | ||
| 103 | + <col class="w-[18%]" /> | ||
| 104 | + <col class="w-[22%]" /> | ||
| 105 | + <col class="w-[9rem]" /> | ||
| 106 | + <col class="w-[18%]" /> | ||
| 107 | + <col class="w-[13rem]" /> | ||
| 108 | + </colgroup> | ||
| 100 | <TableHeader> | 109 | <TableHeader> |
| 101 | <TableRow> | 110 | <TableRow> |
| 102 | <TableHead>{t("admin.username")}</TableHead> | 111 | <TableHead>{t("admin.username")}</TableHead> |
| 103 | <TableHead>{t("profile.name")}</TableHead> | 112 | <TableHead>{t("profile.name")}</TableHead> |
| 104 | <TableHead>{t("profile.email")}</TableHead> | 113 | <TableHead>{t("profile.email")}</TableHead> |
| 105 | - <TableHead>{t("admin.role")}</TableHead> | 114 | + <TableHead class="text-center">{t("admin.role")}</TableHead> |
| 106 | <TableHead>{t("admin.id")}</TableHead> | 115 | <TableHead>{t("admin.id")}</TableHead> |
| 107 | <TableHead class="w-52">{t("common.update")}</TableHead> | 116 | <TableHead class="w-52">{t("common.update")}</TableHead> |
| 108 | </TableRow> | 117 | </TableRow> |
| @@ -119,6 +128,6 @@ export function UserTable(props: { | |||
| 119 | </For> | 128 | </For> |
| 120 | </TableBody> | 129 | </TableBody> |
| 121 | </Table> | 130 | </Table> |
| 122 | - </div> | 131 | + </DataTableFrame> |
| 123 | ); | 132 | ); |
| 124 | } | 133 | } |
src/pages/admin-users-page.tsxmodified+17 -15
| @@ -7,8 +7,9 @@ import { RouteGuard } from "@/components/layout/route-guard"; | |||
| 7 | import { PageHeader } from "@/components/layout/page-header"; | 7 | import { PageHeader } from "@/components/layout/page-header"; |
| 8 | import { UserSearchSelect } from "@/components/users/user-search-select"; | 8 | import { UserSearchSelect } from "@/components/users/user-search-select"; |
| 9 | import { UserTable } from "@/components/users/user-table"; | 9 | import { UserTable } from "@/components/users/user-table"; |
| 10 | -import { PageSpinner } from "@/components/ui/page-spinner"; | ||
| 11 | import { Badge } from "@/components/ui/badge"; | 10 | import { Badge } from "@/components/ui/badge"; |
| 11 | +import { DataTableEmpty, DataTableSkeleton } from "@/components/ui/data-table"; | ||
| 12 | +import { DataToolbar } from "@/components/ui/data-toolbar"; | ||
| 12 | import { useAuth } from "@/stores/auth-context"; | 13 | import { useAuth } from "@/stores/auth-context"; |
| 13 | import { useT } from "@/stores/preferences-context"; | 14 | import { useT } from "@/stores/preferences-context"; |
| 14 | import type { MessageKey } from "@/i18n/messages"; | 15 | import type { MessageKey } from "@/i18n/messages"; |
| @@ -72,24 +73,25 @@ function AdminUsersContent() { | |||
| 72 | </div> | 73 | </div> |
| 73 | <Badge variant="outline" class="mono rounded-sm uppercase tracking-[0.08em]">{t("admin.directory")}</Badge> | 74 | <Badge variant="outline" class="mono rounded-sm uppercase tracking-[0.08em]">{t("admin.directory")}</Badge> |
| 74 | </div> | 75 | </div> |
| 75 | - <UserSearchSelect | 76 | + <DataToolbar |
| 76 | - id="admin-user-search" | 77 | + filters={ |
| 77 | - label={t("common.search")} | 78 | + <div class="min-w-0 flex-1 sm:max-w-sm"> |
| 78 | - value={selectedUserId()} | 79 | + <UserSearchSelect |
| 79 | - onChange={setSelectedUserId} | 80 | + id="admin-user-search" |
| 80 | - placeholder={t("common.searchPlaceholder")} | 81 | + value={selectedUserId()} |
| 81 | - selectPlaceholder={t("admin.username")} | 82 | + onChange={setSelectedUserId} |
| 82 | - emptyMessage={t("admin.noUsers")} | 83 | + placeholder={t("common.searchPlaceholder")} |
| 84 | + selectPlaceholder={t("admin.username")} | ||
| 85 | + emptyMessage={t("admin.noUsers")} | ||
| 86 | + /> | ||
| 87 | + </div> | ||
| 88 | + } | ||
| 83 | /> | 89 | /> |
| 84 | - <Suspense fallback={<PageSpinner />}> | 90 | + <Suspense fallback={<DataTableSkeleton columns={6} rows={8} />}> |
| 85 | <Show when={users()}> | 91 | <Show when={users()}> |
| 86 | <Show | 92 | <Show |
| 87 | when={visibleUsers().length > 0} | 93 | when={visibleUsers().length > 0} |
| 88 | - fallback={ | 94 | + fallback={<DataTableEmpty>{t("admin.noUsers")}</DataTableEmpty>} |
| 89 | - <div class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground"> | ||
| 90 | - {t("admin.noUsers")} | ||
| 91 | - </div> | ||
| 92 | - } | ||
| 93 | > | 95 | > |
| 94 | <UserTable | 96 | <UserTable |
| 95 | users={visibleUsers()} | 97 | users={visibleUsers()} |
src/pages/course-detail-page.tsxmodified+3 -2
| @@ -20,6 +20,7 @@ import { Alert } from "@/components/ui/alert"; | |||
| 20 | import { Badge } from "@/components/ui/badge"; | 20 | import { Badge } from "@/components/ui/badge"; |
| 21 | import { Button } from "@/components/ui/button"; | 21 | import { Button } from "@/components/ui/button"; |
| 22 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 22 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 23 | +import { DataTableFrame } from "@/components/ui/data-table"; | ||
| 23 | import { FormDialog } from "@/components/ui/form-dialog"; | 24 | import { FormDialog } from "@/components/ui/form-dialog"; |
| 24 | import { IconChevronLeft, IconEdit, IconPlus, IconTrash } from "@/components/ui/icons"; | 25 | import { IconChevronLeft, IconEdit, IconPlus, IconTrash } from "@/components/ui/icons"; |
| 25 | import { Input } from "@/components/ui/input"; | 26 | import { Input } from "@/components/ui/input"; |
| @@ -440,7 +441,7 @@ function CourseDetailContent() { | |||
| 440 | </div> | 441 | </div> |
| 441 | } | 442 | } |
| 442 | > | 443 | > |
| 443 | - <div class="data-table-wrap"> | 444 | + <DataTableFrame> |
| 444 | <Table class="data-table"> | 445 | <Table class="data-table"> |
| 445 | <TableHeader> | 446 | <TableHeader> |
| 446 | <TableRow> | 447 | <TableRow> |
| @@ -482,7 +483,7 @@ function CourseDetailContent() { | |||
| 482 | </For> | 483 | </For> |
| 483 | </TableBody> | 484 | </TableBody> |
| 484 | </Table> | 485 | </Table> |
| 485 | - </div> | 486 | + </DataTableFrame> |
| 486 | </Show> | 487 | </Show> |
| 487 | </Suspense> | 488 | </Suspense> |
| 488 | </section> | 489 | </section> |
src/pages/exam-detail-page.tsxmodified+3 -2
| @@ -22,6 +22,7 @@ import { Alert } from "@/components/ui/alert"; | |||
| 22 | import { Badge } from "@/components/ui/badge"; | 22 | import { Badge } from "@/components/ui/badge"; |
| 23 | import { Button } from "@/components/ui/button"; | 23 | import { Button } from "@/components/ui/button"; |
| 24 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 24 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 25 | +import { DataTableFrame } from "@/components/ui/data-table"; | ||
| 25 | import { FormDialog } from "@/components/ui/form-dialog"; | 26 | import { FormDialog } from "@/components/ui/form-dialog"; |
| 26 | import { IconChevronLeft, IconEdit, IconExam, IconEye, IconTrash } from "@/components/ui/icons"; | 27 | import { IconChevronLeft, IconEdit, IconExam, IconEye, IconTrash } from "@/components/ui/icons"; |
| 27 | import { PageSpinner } from "@/components/ui/page-spinner"; | 28 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| @@ -408,7 +409,7 @@ function ExamDetailContent() { | |||
| 408 | </p> | 409 | </p> |
| 409 | } | 410 | } |
| 410 | > | 411 | > |
| 411 | - <div class="data-table-wrap"> | 412 | + <DataTableFrame> |
| 412 | <Table class="data-table"> | 413 | <Table class="data-table"> |
| 413 | <TableHeader> | 414 | <TableHeader> |
| 414 | <TableRow> | 415 | <TableRow> |
| @@ -463,7 +464,7 @@ function ExamDetailContent() { | |||
| 463 | </For> | 464 | </For> |
| 464 | </TableBody> | 465 | </TableBody> |
| 465 | </Table> | 466 | </Table> |
| 466 | - </div> | 467 | + </DataTableFrame> |
| 467 | </Show> | 468 | </Show> |
| 468 | </Suspense> | 469 | </Suspense> |
| 469 | </section> | 470 | </section> |
src/pages/live-monitor-page.tsxmodified+4 -3
| @@ -11,6 +11,7 @@ import { PageHeader } from "@/components/layout/page-header"; | |||
| 11 | import { Alert } from "@/components/ui/alert"; | 11 | import { Alert } from "@/components/ui/alert"; |
| 12 | import { Badge } from "@/components/ui/badge"; | 12 | import { Badge } from "@/components/ui/badge"; |
| 13 | import { Button } from "@/components/ui/button"; | 13 | import { Button } from "@/components/ui/button"; |
| 14 | +import { DataTableFrame } from "@/components/ui/data-table"; | ||
| 14 | import { IconChevronLeft, IconChevronRight } from "@/components/ui/icons"; | 15 | import { IconChevronLeft, IconChevronRight } from "@/components/ui/icons"; |
| 15 | import { PageSpinner } from "@/components/ui/page-spinner"; | 16 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 16 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; | 17 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; |
| @@ -288,8 +289,8 @@ function LiveMonitorContent() { | |||
| 288 | </p> | 289 | </p> |
| 289 | } | 290 | } |
| 290 | > | 291 | > |
| 291 | - <div class="overflow-hidden rounded-lg border border-border/70 bg-background/60"> | 292 | + <DataTableFrame> |
| 292 | - <Table> | 293 | + <Table class="data-table"> |
| 293 | <TableHeader> | 294 | <TableHeader> |
| 294 | <TableRow> | 295 | <TableRow> |
| 295 | <SortHead label={t("admin.username")} sortKey="username" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-left" /> | 296 | <SortHead label={t("admin.username")} sortKey="username" currentKey={sortKey()} currentDir={sortDir()} onSort={toggleSort} class="text-left" /> |
| @@ -347,7 +348,7 @@ function LiveMonitorContent() { | |||
| 347 | </For> | 348 | </For> |
| 348 | </TableBody> | 349 | </TableBody> |
| 349 | </Table> | 350 | </Table> |
| 350 | - </div> | 351 | + </DataTableFrame> |
| 351 | 352 | ||
| 352 | <Show when={sorted.length > PAGE_SIZE}> | 353 | <Show when={sorted.length > PAGE_SIZE}> |
| 353 | <div class="mt-4 flex flex-col items-stretch gap-2 border-t border-border/60 pt-3 sm:flex-row sm:items-center sm:justify-between"> | 354 | <div class="mt-4 flex flex-col items-stretch gap-2 border-t border-border/60 pt-3 sm:flex-row sm:items-center sm:justify-between"> |
src/pages/student-attendance-page.tsxmodified+4 -4
| @@ -30,13 +30,13 @@ function StudentAttendanceContent() { | |||
| 30 | <div class="space-y-6"> | 30 | <div class="space-y-6"> |
| 31 | <PageHeader accent="sky" eyebrow={t("nav.admin")} title={t("nav.studentAttendance")} description={t("attendance.lookup")} /> | 31 | <PageHeader accent="sky" eyebrow={t("nav.admin")} title={t("nav.studentAttendance")} description={t("attendance.lookup")} /> |
| 32 | 32 | ||
| 33 | - <section class="surface-card space-y-4 p-5"> | 33 | + <section class="data-shell space-y-4 p-4"> |
| 34 | <div> | 34 | <div> |
| 35 | <h2 class="font-display text-lg font-semibold">{t("nav.studentAttendance")}</h2> | 35 | <h2 class="font-display text-lg font-semibold">{t("nav.studentAttendance")}</h2> |
| 36 | <p class="mt-1 text-sm text-muted-foreground">{t("attendance.lookup")}</p> | 36 | <p class="mt-1 text-sm text-muted-foreground">{t("attendance.lookup")}</p> |
| 37 | </div> | 37 | </div> |
| 38 | <form | 38 | <form |
| 39 | - class="grid gap-3 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end" | 39 | + class="grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end" |
| 40 | onSubmit={(e) => { | 40 | onSubmit={(e) => { |
| 41 | e.preventDefault(); | 41 | e.preventDefault(); |
| 42 | const id = userId().trim(); | 42 | const id = userId().trim(); |
| @@ -54,7 +54,7 @@ function StudentAttendanceContent() { | |||
| 54 | emptyMessage={t("admin.noUsers")} | 54 | emptyMessage={t("admin.noUsers")} |
| 55 | allowManualValue | 55 | allowManualValue |
| 56 | /> | 56 | /> |
| 57 | - <Button type="submit" class="h-9 w-full sm:w-auto">{t("attendance.show")}</Button> | 57 | + <Button type="submit" class="h-9 w-full rounded-sm sm:w-auto">{t("attendance.show")}</Button> |
| 58 | </form> | 58 | </form> |
| 59 | 59 | ||
| 60 | <Show when={report.error}> | 60 | <Show when={report.error}> |
| @@ -66,7 +66,7 @@ function StudentAttendanceContent() { | |||
| 66 | <Show when={report()}> | 66 | <Show when={report()}> |
| 67 | {(r) => ( | 67 | {(r) => ( |
| 68 | <div class="space-y-4"> | 68 | <div class="space-y-4"> |
| 69 | - <p class="rounded-lg border bg-background/60 px-4 py-3 text-sm text-muted-foreground"> | 69 | + <p class="data-shell px-4 py-3 text-sm text-muted-foreground"> |
| 70 | {t("attendance.forUser", { user: lookupId() ?? "" })} | 70 | {t("attendance.forUser", { user: lookupId() ?? "" })} |
| 71 | </p> | 71 | </p> |
| 72 | <AttendanceReportView report={r()} /> | 72 | <AttendanceReportView report={r()} /> |
src/pages/student-marks-page.tsxmodified+4 -4
| @@ -35,13 +35,13 @@ function StudentMarksContent() { | |||
| 35 | description={t("marks.lookup")} | 35 | description={t("marks.lookup")} |
| 36 | /> | 36 | /> |
| 37 | 37 | ||
| 38 | - <section class="surface-card space-y-4 p-5"> | 38 | + <section class="data-shell space-y-4 p-4"> |
| 39 | <div> | 39 | <div> |
| 40 | <h2 class="font-display text-lg font-semibold">{t("nav.studentMarks")}</h2> | 40 | <h2 class="font-display text-lg font-semibold">{t("nav.studentMarks")}</h2> |
| 41 | <p class="mt-1 text-sm text-muted-foreground">{t("marks.lookup")}</p> | 41 | <p class="mt-1 text-sm text-muted-foreground">{t("marks.lookup")}</p> |
| 42 | </div> | 42 | </div> |
| 43 | <form | 43 | <form |
| 44 | - class="grid gap-3 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end" | 44 | + class="grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end" |
| 45 | onSubmit={(e) => { | 45 | onSubmit={(e) => { |
| 46 | e.preventDefault(); | 46 | e.preventDefault(); |
| 47 | const id = userId().trim(); | 47 | const id = userId().trim(); |
| @@ -59,7 +59,7 @@ function StudentMarksContent() { | |||
| 59 | emptyMessage={t("admin.noUsers")} | 59 | emptyMessage={t("admin.noUsers")} |
| 60 | allowManualValue | 60 | allowManualValue |
| 61 | /> | 61 | /> |
| 62 | - <Button type="submit" class="h-9 w-full sm:w-auto">{t("marks.show")}</Button> | 62 | + <Button type="submit" class="h-9 w-full rounded-sm sm:w-auto">{t("marks.show")}</Button> |
| 63 | </form> | 63 | </form> |
| 64 | 64 | ||
| 65 | <Show when={report.error}> | 65 | <Show when={report.error}> |
| @@ -73,7 +73,7 @@ function StudentMarksContent() { | |||
| 73 | <Show when={report()}> | 73 | <Show when={report()}> |
| 74 | {(r) => ( | 74 | {(r) => ( |
| 75 | <div class="space-y-4"> | 75 | <div class="space-y-4"> |
| 76 | - <p class="rounded-lg border bg-background/60 px-4 py-3 text-sm text-muted-foreground"> | 76 | + <p class="data-shell px-4 py-3 text-sm text-muted-foreground"> |
| 77 | {t("marks.forUser", { user: lookupId() ?? "" })} | 77 | {t("marks.forUser", { user: lookupId() ?? "" })} |
| 78 | </p> | 78 | </p> |
| 79 | <MarksReportView report={r()} /> | 79 | <MarksReportView report={r()} /> |
src/pages/work-log-page.tsxmodified+3 -2
| @@ -8,6 +8,7 @@ import { PageHeader } from "@/components/layout/page-header"; | |||
| 8 | import { Alert } from "@/components/ui/alert"; | 8 | import { Alert } from "@/components/ui/alert"; |
| 9 | import { Badge } from "@/components/ui/badge"; | 9 | import { Badge } from "@/components/ui/badge"; |
| 10 | import { Button } from "@/components/ui/button"; | 10 | import { Button } from "@/components/ui/button"; |
| 11 | +import { DataTableFrame } from "@/components/ui/data-table"; | ||
| 11 | import { PageSpinner } from "@/components/ui/page-spinner"; | 12 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 12 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; | 13 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; |
| 13 | import { formatDateTime, formatDurationMinutes } from "@/lib/format"; | 14 | import { formatDateTime, formatDurationMinutes } from "@/lib/format"; |
| @@ -86,7 +87,7 @@ function WorkLogContent() { | |||
| 86 | when={(entries() ?? []).length > 0} | 87 | when={(entries() ?? []).length > 0} |
| 87 | fallback={<div class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground">{t("work.empty")}</div>} | 88 | fallback={<div class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground">{t("work.empty")}</div>} |
| 88 | > | 89 | > |
| 89 | - <div class="data-table-wrap"> | 90 | + <DataTableFrame> |
| 90 | <Table class="data-table"> | 91 | <Table class="data-table"> |
| 91 | <TableHeader> | 92 | <TableHeader> |
| 92 | <TableRow> | 93 | <TableRow> |
| @@ -113,7 +114,7 @@ function WorkLogContent() { | |||
| 113 | </For> | 114 | </For> |
| 114 | </TableBody> | 115 | </TableBody> |
| 115 | </Table> | 116 | </Table> |
| 116 | - </div> | 117 | + </DataTableFrame> |
| 117 | </Show> | 118 | </Show> |
| 118 | </Suspense> | 119 | </Suspense> |
| 119 | </section> | 120 | </section> |