From 249dfed185ed266f43390de237fdabdc28d1f99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Sun, 19 Jul 2026 22:24:36 +0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=9A=9A=20courses/exams=20page?= =?UTF-8?q?s=20use=20DataTable=20empty=20prop,=20action=20column=20width?= =?UTF-8?q?=20-=20DataTable:=20action=20columns=20(actions/update)=20get?= =?UTF-8?q?=20fixed=20w-20=20centered=20width=20-=20courses-page:=20remove?= =?UTF-8?q?d=20EmptyState=20wrapper,=20use=20DataTable=20empty=20prop=20-?= =?UTF-8?q?=20exams-page:=20removed=20EmptyState=20wrapper,=20use=20DataTa?= =?UTF-8?q?ble=20empty=20prop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ui/data-table.tsx | 5 ++- src/pages/courses-page.tsx | 75 ++++++++++++-------------------- src/pages/exams-page.tsx | 75 ++++++++++++-------------------- 3 files changed, 61 insertions(+), 94 deletions(-) diff --git a/src/components/ui/data-table.tsx b/src/components/ui/data-table.tsx index c373a51..be1205d 100644 --- a/src/components/ui/data-table.tsx +++ b/src/components/ui/data-table.tsx @@ -109,6 +109,7 @@ export function DataTable(props: DataTableProps columnId === "actions" || columnId === "update"; + const actionColumnClass = (columnId: string) => hiddenLocked(columnId) ? "w-20 min-w-20 max-w-20 px-1 text-center" : undefined; const hideableColumns = () => table.getAllColumns().filter((column) => column.getCanHide() && !hiddenLocked(column.id)); const columnLabel = (column: Column) => { const header = column.columnDef.header; @@ -193,7 +194,7 @@ export function DataTable(props: DataTableProps {(header) => ( - + {renderHeader(header)} )} @@ -218,7 +219,7 @@ export function DataTable(props: DataTableProps {(cell) => ( - + {flexRender(cell.column.columnDef.cell, cell.getContext())} )} diff --git a/src/pages/courses-page.tsx b/src/pages/courses-page.tsx index c0d611e..bae30f4 100644 --- a/src/pages/courses-page.tsx +++ b/src/pages/courses-page.tsx @@ -14,7 +14,6 @@ import { PageHeader } from "@/components/layout/page-header"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; -import { EmptyState } from "@/components/ui/empty-state"; import { IconEye, IconPlus } from "@/components/ui/icons"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; @@ -232,53 +231,37 @@ function CoursesContent() { {formatApiError(list.error)} - 0} - fallback={ - setShowForm(true)}> - - {t("common.createItem", { item: pageLabel() })} - - ) : undefined - } - /> - } - > -
-
-
-

{t("courses.listTitle", { item: pageLabel() })}

-

- {t("common.countItem", { count: rows().length, item: pageLabel() })} -

-
+
+
+
+

{t("courses.listTitle", { item: pageLabel() })}

+

+ {t("common.countItem", { count: rows().length, item: pageLabel() })} +

- setTermFilter(event.currentTarget.value)} - > - - - {(term) => } - - } - />
- + setTermFilter(event.currentTarget.value)} + > + + + {(term) => } + + } + /> +
diff --git a/src/pages/exams-page.tsx b/src/pages/exams-page.tsx index aa01842..90c48c9 100644 --- a/src/pages/exams-page.tsx +++ b/src/pages/exams-page.tsx @@ -15,7 +15,6 @@ import { Alert } from "@/components/ui/alert"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; -import { EmptyState } from "@/components/ui/empty-state"; import { IconEdit, IconEye, IconPlus } from "@/components/ui/icons"; import { Select } from "@/components/ui/select"; import { SidePanel } from "@/components/ui/side-panel"; @@ -244,53 +243,37 @@ function ExamsContent() { {formatApiError(list.error)} - 0} - fallback={ - setCreateOpen(true)}> - - {t("exams.create")} - - ) : undefined - } - /> - } - > - - setStatusFilter(event.currentTarget.value as ExamStatus | "all")}> + + + + + + + + + - - - - - - } - /> - + + + + } + />