🖱️ add row-click navigation to list tables
Browse files at this commitd8a273cab5bd78612f0bdfb1681602bec6c18e3dParent: 5b8e6ed- feat
- 🖱️ add row-click navigation to list tables
8 changed files +28 -1
- src/pages/course-detail-page.tsx +9 -1
- src/pages/courses-page.tsx +1 -0
- src/pages/events-page.tsx +1 -0
- src/pages/exams-page.tsx +1 -0
- src/pages/staff-work-page.tsx +4 -0
- src/pages/student-attendance-page.tsx +4 -0
- src/pages/student-marks-page.tsx +4 -0
- src/pages/student-pomodoro-page.tsx +4 -0
src/pages/course-detail-page.tsxmodified+9 -1
| @@ -610,7 +610,15 @@ function CourseDetailContent() { | |||
| 610 | } | 610 | } |
| 611 | > | 611 | > |
| 612 | <Suspense fallback={<PageSpinner />}> | 612 | <Suspense fallback={<PageSpinner />}> |
| 613 | - <DataTable columns={examColumns()} data={exams() ?? []} filterColumn="title" enablePagination pageSize={10} empty={t("exams.empty")} /> | 613 | + <DataTable |
| 614 | + columns={examColumns()} | ||
| 615 | + data={exams() ?? []} | ||
| 616 | + filterColumn="title" | ||
| 617 | + enablePagination | ||
| 618 | + pageSize={10} | ||
| 619 | + empty={t("exams.empty")} | ||
| 620 | + onRowClick={(exam) => void navigate({ to: "/exams/$id", params: { id: exam.id } })} | ||
| 621 | + /> | ||
| 614 | </Suspense> | 622 | </Suspense> |
| 615 | </SectionDisclosure> | 623 | </SectionDisclosure> |
| 616 | 624 | ||
src/pages/courses-page.tsxmodified+1 -0
| @@ -259,6 +259,7 @@ function CoursesContent() { | |||
| 259 | enablePagination | 259 | enablePagination |
| 260 | pageSize={COURSE_PAGE_SIZE} | 260 | pageSize={COURSE_PAGE_SIZE} |
| 261 | empty={t("courses.empty", { item: pageLabel() })} | 261 | empty={t("courses.empty", { item: pageLabel() })} |
| 262 | + onRowClick={(course) => void navigate({ to: "/courses/$id", params: { id: course.id } })} | ||
| 262 | filters={ | 263 | filters={ |
| 263 | <Select | 264 | <Select |
| 264 | class="h-9 w-full rounded-sm sm:w-44" | 265 | class="h-9 w-full rounded-sm sm:w-44" |
src/pages/events-page.tsxmodified+1 -0
| @@ -206,6 +206,7 @@ function EventsContent() { | |||
| 206 | enablePagination | 206 | enablePagination |
| 207 | pageSize={EVENT_PAGE_SIZE} | 207 | pageSize={EVENT_PAGE_SIZE} |
| 208 | empty={t("events.empty")} | 208 | empty={t("events.empty")} |
| 209 | + onRowClick={(event) => void navigate({ to: "/events/$id", params: { id: event.id } })} | ||
| 209 | filters={ | 210 | filters={ |
| 210 | <Select class="h-9 w-full rounded-sm sm:w-44" value={timeFilter()} aria-label={t("events.title")} onChange={(event) => setTimeFilter(event.currentTarget.value)}> | 211 | <Select class="h-9 w-full rounded-sm sm:w-44" value={timeFilter()} aria-label={t("events.title")} onChange={(event) => setTimeFilter(event.currentTarget.value)}> |
| 211 | <option value="all">{t("common.all")}</option> | 212 | <option value="all">{t("common.all")}</option> |
src/pages/exams-page.tsxmodified+1 -0
| @@ -279,6 +279,7 @@ function ExamsContent() { | |||
| 279 | enablePagination | 279 | enablePagination |
| 280 | pageSize={EXAM_PAGE_SIZE} | 280 | pageSize={EXAM_PAGE_SIZE} |
| 281 | empty={t("exams.empty")} | 281 | empty={t("exams.empty")} |
| 282 | + onRowClick={(exam) => void navigate({ to: "/exams/$id", params: { id: exam.id } })} | ||
| 282 | filters={ | 283 | filters={ |
| 283 | <> | 284 | <> |
| 284 | <Select class="h-9 w-full rounded-sm sm:w-40" value={statusFilter()} onChange={(event) => setStatusFilter(event.currentTarget.value as ExamDisplayStatus | "all")}> | 285 | <Select class="h-9 w-full rounded-sm sm:w-40" value={statusFilter()} onChange={(event) => setStatusFilter(event.currentTarget.value as ExamDisplayStatus | "all")}> |
src/pages/staff-work-page.tsxmodified+4 -0
| @@ -276,6 +276,10 @@ function StaffWorkContent() { | |||
| 276 | searchPredicate={searchPerson} | 276 | searchPredicate={searchPerson} |
| 277 | enablePagination | 277 | enablePagination |
| 278 | pageSize={PEOPLE_PAGE_SIZE} | 278 | pageSize={PEOPLE_PAGE_SIZE} |
| 279 | + onRowClick={(person) => { | ||
| 280 | + setError(""); | ||
| 281 | + setViewUser(person); | ||
| 282 | + }} | ||
| 279 | /> | 283 | /> |
| 280 | </Show> | 284 | </Show> |
| 281 | </section> | 285 | </section> |
src/pages/student-attendance-page.tsxmodified+4 -0
| @@ -133,6 +133,10 @@ function StudentAttendanceContent() { | |||
| 133 | searchPredicate={searchPerson} | 133 | searchPredicate={searchPerson} |
| 134 | enablePagination | 134 | enablePagination |
| 135 | pageSize={PAGE_SIZE} | 135 | pageSize={PAGE_SIZE} |
| 136 | + onRowClick={(person) => { | ||
| 137 | + setError(""); | ||
| 138 | + setViewUser(person); | ||
| 139 | + }} | ||
| 136 | /> | 140 | /> |
| 137 | </Show> | 141 | </Show> |
| 138 | </section> | 142 | </section> |
src/pages/student-marks-page.tsxmodified+4 -0
| @@ -133,6 +133,10 @@ function StudentMarksContent() { | |||
| 133 | searchPredicate={searchPerson} | 133 | searchPredicate={searchPerson} |
| 134 | enablePagination | 134 | enablePagination |
| 135 | pageSize={PAGE_SIZE} | 135 | pageSize={PAGE_SIZE} |
| 136 | + onRowClick={(person) => { | ||
| 137 | + setError(""); | ||
| 138 | + setViewUser(person); | ||
| 139 | + }} | ||
| 136 | /> | 140 | /> |
| 137 | </Show> | 141 | </Show> |
| 138 | </section> | 142 | </section> |
src/pages/student-pomodoro-page.tsxmodified+4 -0
| @@ -149,6 +149,10 @@ function StudentPomodoroContent() { | |||
| 149 | searchPredicate={searchPerson} | 149 | searchPredicate={searchPerson} |
| 150 | enablePagination | 150 | enablePagination |
| 151 | pageSize={PAGE_SIZE} | 151 | pageSize={PAGE_SIZE} |
| 152 | + onRowClick={(person) => { | ||
| 153 | + setError(""); | ||
| 154 | + setViewUser(person); | ||
| 155 | + }} | ||
| 152 | /> | 156 | /> |
| 153 | </Show> | 157 | </Show> |
| 154 | </section> | 158 | </section> |