✨ split courses into /courses, /studies, /clubs with shared page
Browse files at this commitcd3f0a85e790c3252d66d3b19dda1a40cebef998Parent: e600469- feat
- ✨ split courses into /courses, /studies, /clubs with shared page
6 changed files +76 -40
- src/components/layout/side-nav.tsx +2 -0
- src/i18n/messages.ts +25 -10
- src/pages/course-detail-page.tsx +5 -4
- src/pages/courses-page.tsx +17 -24
- src/pages/dashboard-page.tsx +13 -2
- src/routes/router.tsx +14 -0
src/components/layout/side-nav.tsxmodified+2 -0
| @@ -58,6 +58,8 @@ const NAV_GROUPS: NavGroup[] = [ | ||
| 58 | 58 | Icon: IconSchool, |
| 59 | 59 | items: [ |
| 60 | 60 | { to: "/courses", labelKey: "nav.courses", Icon: IconBook }, |
| 61 | + { to: "/studies", labelKey: "nav.studies", Icon: IconClock }, | |
| 62 | + { to: "/clubs", labelKey: "nav.clubs", Icon: IconUsers }, | |
| 61 | 63 | { to: "/exams", labelKey: "nav.exams", Icon: IconExam }, |
| 62 | 64 | { to: "/events", labelKey: "nav.events", Icon: IconCalendar }, |
| 63 | 65 | ], |
src/i18n/messages.tsmodified+25 -10
| @@ -8,6 +8,8 @@ export type MessageKey = | ||
| 8 | 8 | | "nav.events" |
| 9 | 9 | | "nav.exams" |
| 10 | 10 | | "nav.courses" |
| 11 | + | "nav.studies" | |
| 12 | + | "nav.clubs" | |
| 11 | 13 | | "nav.marks" |
| 12 | 14 | | "nav.pomodoro" |
| 13 | 15 | | "nav.attendance" |
| @@ -83,6 +85,7 @@ export type MessageKey = | ||
| 83 | 85 | | "common.created" |
| 84 | 86 | | "common.deleted" |
| 85 | 87 | | "common.saved" |
| 88 | + | "common.createItem" | |
| 86 | 89 | | "common.countItem" |
| 87 | 90 | | "theme.light" |
| 88 | 91 | | "theme.dark" |
| @@ -169,6 +172,8 @@ export type MessageKey = | ||
| 169 | 172 | | "dashboard.continueGuide" |
| 170 | 173 | | "dashboard.portal.sections" |
| 171 | 174 | | "dashboard.portal.coursesDesc" |
| 175 | + | "dashboard.portal.studiesDesc" | |
| 176 | + | "dashboard.portal.clubsDesc" | |
| 172 | 177 | | "dashboard.portal.examsDesc" |
| 173 | 178 | | "dashboard.portal.eventsDesc" |
| 174 | 179 | | "dashboard.portal.marksDesc" |
| @@ -590,7 +595,9 @@ const en: Dict = { | ||
| 590 | 595 | "nav.notes": "Notes", |
| 591 | 596 | "nav.events": "Events", |
| 592 | 597 | "nav.exams": "Exams", |
| 593 | - "nav.courses": "Education", | |
| 598 | + "nav.courses": "Courses", | |
| 599 | + "nav.studies": "Study sessions", | |
| 600 | + "nav.clubs": "Clubs", | |
| 594 | 601 | "nav.marks": "Report card", |
| 595 | 602 | "nav.pomodoro": "Pomodoro", |
| 596 | 603 | "nav.attendance": "Attendance", |
| @@ -666,6 +673,7 @@ const en: Dict = { | ||
| 666 | 673 | "common.created": "Created.", |
| 667 | 674 | "common.deleted": "Deleted.", |
| 668 | 675 | "common.saved": "Saved.", |
| 676 | + "common.createItem": "Create {item}", | |
| 669 | 677 | "common.countItem": "{count} {item}", |
| 670 | 678 | "theme.light": "Light", |
| 671 | 679 | "theme.dark": "Dark", |
| @@ -751,7 +759,9 @@ const en: Dict = { | ||
| 751 | 759 | "dashboard.helpBody": "Stuck on a page or looking for the next step? Open the short app guide.", |
| 752 | 760 | "dashboard.continueGuide": "Guide", |
| 753 | 761 | "dashboard.portal.sections": "Sections", |
| 754 | - "dashboard.portal.coursesDesc": "Browse courses, study sessions, clubs, and materials.", | |
| 762 | + "dashboard.portal.coursesDesc": "Browse course rosters, subjects, and exams.", | |
| 763 | + "dashboard.portal.studiesDesc": "Browse study sessions, rosters, and exams.", | |
| 764 | + "dashboard.portal.clubsDesc": "Browse clubs, rosters, and exams.", | |
| 755 | 765 | "dashboard.portal.examsDesc": "Course exams, deadlines, and results.", |
| 756 | 766 | "dashboard.portal.eventsDesc": "Events with student attendance records.", |
| 757 | 767 | "dashboard.portal.marksDesc": "Your grades and overall report card.", |
| @@ -1018,10 +1028,10 @@ const en: Dict = { | ||
| 1018 | 1028 | "role.manager": "Manager", |
| 1019 | 1029 | "role.admin": "ADMIN", |
| 1020 | 1030 | "courses.title": "Education", |
| 1021 | - "courses.listTitle": "Education records", | |
| 1022 | - "courses.subtitle": "Courses, study sessions, clubs, enrollment, and exams live here.", | |
| 1031 | + "courses.listTitle": "{item} records", | |
| 1032 | + "courses.subtitle": "Manage {item}, enrollment, and exams here.", | |
| 1023 | 1033 | "courses.create": "New education item", |
| 1024 | - "courses.empty": "No courses yet.", | |
| 1034 | + "courses.empty": "No {item} yet.", | |
| 1025 | 1035 | "courses.enrolled": "Enrolled", |
| 1026 | 1036 | "courses.roster": "Roster", |
| 1027 | 1037 | "courses.rosterItem": "Student", |
| @@ -1185,7 +1195,9 @@ const tr: Dict = { | ||
| 1185 | 1195 | "nav.notes": "Notlar", |
| 1186 | 1196 | "nav.events": "Etkinlikler", |
| 1187 | 1197 | "nav.exams": "Sınavlar", |
| 1188 | - "nav.courses": "Eğitim", | |
| 1198 | + "nav.courses": "Ders", | |
| 1199 | + "nav.studies": "Etüt", | |
| 1200 | + "nav.clubs": "Kulüp", | |
| 1189 | 1201 | "nav.marks": "Notlar", |
| 1190 | 1202 | "nav.pomodoro": "Pomodoro", |
| 1191 | 1203 | "nav.attendance": "Yoklamalar", |
| @@ -1261,6 +1273,7 @@ const tr: Dict = { | ||
| 1261 | 1273 | "common.created": "Oluşturuldu.", |
| 1262 | 1274 | "common.deleted": "Silindi.", |
| 1263 | 1275 | "common.saved": "Kaydedildi.", |
| 1276 | + "common.createItem": "{item} oluştur", | |
| 1264 | 1277 | "common.countItem": "{count} Adet {item}", |
| 1265 | 1278 | "theme.light": "Açık", |
| 1266 | 1279 | "theme.dark": "Koyu", |
| @@ -1346,7 +1359,9 @@ const tr: Dict = { | ||
| 1346 | 1359 | "dashboard.helpBody": "Bir sayfada takıldın veya sonraki adımı mı arıyorsun? Kısa uygulama rehberini aç.", |
| 1347 | 1360 | "dashboard.continueGuide": "Rehber", |
| 1348 | 1361 | "dashboard.portal.sections": "Bölümler", |
| 1349 | - "dashboard.portal.coursesDesc": "Dersleri, etütleri, kulüpleri ve materyalleri görüntüle.", | |
| 1362 | + "dashboard.portal.coursesDesc": "Dersleri, konuları, kayıtları ve sınavları görüntüle.", | |
| 1363 | + "dashboard.portal.studiesDesc": "Etütleri, kayıtları ve sınavları görüntüle.", | |
| 1364 | + "dashboard.portal.clubsDesc": "Kulüpleri, kayıtları ve sınavları görüntüle.", | |
| 1350 | 1365 | "dashboard.portal.examsDesc": "Eğitim sınavları, tarihler ve sonuçlar.", |
| 1351 | 1366 | "dashboard.portal.eventsDesc": "Öğrenci yoklamalı etkinlikler.", |
| 1352 | 1367 | "dashboard.portal.marksDesc": "Notların ve genel karnen.", |
| @@ -1613,10 +1628,10 @@ const tr: Dict = { | ||
| 1613 | 1628 | "role.manager": "Yönetici", |
| 1614 | 1629 | "role.admin": "ADMIN", |
| 1615 | 1630 | "courses.title": "Eğitim", |
| 1616 | - "courses.listTitle": "Eğitim kayıtları", | |
| 1617 | - "courses.subtitle": "Dersler, etütler, kulüpler, kayıtlar ve sınavlar burada.", | |
| 1631 | + "courses.listTitle": "{item} kayıtları", | |
| 1632 | + "courses.subtitle": "{item}, kayıtlar ve sınavlar burada.", | |
| 1618 | 1633 | "courses.create": "Yeni eğitim kaydı", |
| 1619 | - "courses.empty": "Henüz ders yok.", | |
| 1634 | + "courses.empty": "Henüz {item} yok.", | |
| 1620 | 1635 | "courses.enrolled": "Kayıtlı", |
| 1621 | 1636 | "courses.roster": "Sınıf listesi", |
| 1622 | 1637 | "courses.rosterItem": "Öğrenci", |
src/pages/course-detail-page.tsxmodified+5 -4
| @@ -122,6 +122,7 @@ function CourseDetailContent() { | ||
| 122 | 122 | }; |
| 123 | 123 | const courseKindLabel = (value: CourseKind | undefined) => |
| 124 | 124 | value === "study" ? t("courses.kind.study") : value === "club" ? t("courses.kind.club") : t("courses.kind.course"); |
| 125 | + const courseListPath = (value: CourseKind | undefined) => value === "study" ? "/studies" : value === "club" ? "/clubs" : "/courses"; | |
| 125 | 126 | |
| 126 | 127 | const examCount = createMemo(() => exams()?.length ?? 0); |
| 127 | 128 | const rosterCount = createMemo(() => roster()?.length ?? 0); |
| @@ -257,18 +258,18 @@ function CourseDetailContent() { | ||
| 257 | 258 | <div class="detail-breadcrumb"> |
| 258 | 259 | <span>{t("nav.group.classes")}</span> |
| 259 | 260 | <span>/</span> |
| 260 | - <Link to="/courses">{t("courses.title")}</Link> | |
| 261 | + <Link to={courseListPath(c().kind)}>{courseKindLabel(c().kind)}</Link> | |
| 261 | 262 | <span>/</span> |
| 262 | 263 | <span class="truncate">{c().title}</span> |
| 263 | 264 | </div> |
| 264 | 265 | <PageHeader |
| 265 | 266 | accent="violet" |
| 266 | - eyebrow={t("courses.title")} | |
| 267 | + eyebrow={courseKindLabel(c().kind)} | |
| 267 | 268 | title={c().title} |
| 268 | 269 | description={`${t("terms.term")}: ${terms()?.find((term) => term.id === c().term)?.name ?? t("terms.unassigned")}${c().description ? ` - ${c().description}` : ""}`} |
| 269 | 270 | actions={ |
| 270 | 271 | <div class="detail-action-group"> |
| 271 | - <Link to="/courses"> | |
| 272 | + <Link to={courseListPath(c().kind)}> | |
| 272 | 273 | <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto"> |
| 273 | 274 | <IconChevronLeft class="h-4 w-4" /> |
| 274 | 275 | {t("common.back")} |
| @@ -307,7 +308,7 @@ function CourseDetailContent() { | ||
| 307 | 308 | onConfirm={async () => { |
| 308 | 309 | await wrap(async () => { |
| 309 | 310 | await deleteCourseById(id()); |
| 310 | - void navigate({ to: "/courses" }); | |
| 311 | + void navigate({ to: courseListPath(c().kind) }); | |
| 311 | 312 | }); |
| 312 | 313 | }} |
| 313 | 314 | /> |
src/pages/courses-page.tsxmodified+17 -24
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | import { For, Show, Suspense, createMemo, createResource, createSignal } from "solid-js"; |
| 2 | 2 | import type { ColumnDef } from "@tanstack/solid-table"; |
| 3 | -import { useNavigate } from "@tanstack/solid-router"; | |
| 3 | +import { useLocation, useNavigate } from "@tanstack/solid-router"; | |
| 4 | 4 | import { getCourses } from "@/api/getCourses"; |
| 5 | 5 | import { getMyCourses } from "@/api/getMyCourses"; |
| 6 | 6 | import { getTerms } from "@/api/getTerms"; |
| @@ -28,7 +28,6 @@ import { useT } from "@/stores/preferences-context"; | ||
| 28 | 28 | import { hasMinRole } from "@/lib/roles"; |
| 29 | 29 | |
| 30 | 30 | const COURSE_PAGE_SIZE = 12; |
| 31 | -const COURSE_KINDS: CourseKind[] = ["course", "study", "club"]; | |
| 32 | 31 | |
| 33 | 32 | export default function CoursesPage() { |
| 34 | 33 | return ( |
| @@ -41,11 +40,11 @@ export default function CoursesPage() { | ||
| 41 | 40 | function CoursesContent() { |
| 42 | 41 | const auth = useAuth(); |
| 43 | 42 | const navigate = useNavigate(); |
| 43 | + const location = useLocation(); | |
| 44 | 44 | const t = useT(); |
| 45 | 45 | const [showForm, setShowForm] = createSignal(false); |
| 46 | 46 | const [title, setTitle] = createSignal(""); |
| 47 | 47 | const [description, setDescription] = createSignal(""); |
| 48 | - const [kind, setKind] = createSignal<CourseKind>("course"); | |
| 49 | 48 | const [termId, setTermId] = createSignal(""); |
| 50 | 49 | const [capacity, setCapacity] = createSignal(""); |
| 51 | 50 | const [error, setError] = createSignal(""); |
| @@ -65,6 +64,8 @@ function CoursesContent() { | ||
| 65 | 64 | const termName = (id: string | null | undefined) => terms()?.find((term) => term.id === id)?.name ?? t("terms.unassigned"); |
| 66 | 65 | const courseKindLabel = (value: CourseKind | undefined) => |
| 67 | 66 | value === "study" ? t("courses.kind.study") : value === "club" ? t("courses.kind.club") : t("courses.kind.course"); |
| 67 | + const pageKind = (): CourseKind => location().pathname.startsWith("/studies") ? "study" : location().pathname.startsWith("/clubs") ? "club" : "course"; | |
| 68 | + const pageLabel = () => courseKindLabel(pageKind()); | |
| 68 | 69 | const creatorName = (creatorId: string) => { |
| 69 | 70 | if (creatorId === auth.user()?.id) return auth.user()?.username ?? creatorId; |
| 70 | 71 | return users()?.find((user) => user.id === creatorId)?.username ?? creatorId; |
| @@ -75,7 +76,7 @@ function CoursesContent() { | ||
| 75 | 76 | return items.filter((course) => { |
| 76 | 77 | if (selectedTerm === "unassigned" && course.term) return false; |
| 77 | 78 | if (selectedTerm !== "all" && selectedTerm !== "unassigned" && course.term !== selectedTerm) return false; |
| 78 | - return true; | |
| 79 | + return course.kind === pageKind(); | |
| 79 | 80 | }); |
| 80 | 81 | }; |
| 81 | 82 | const searchCourse = (course: Course, query: string) => |
| @@ -93,11 +94,10 @@ function CoursesContent() { | ||
| 93 | 94 | const columns = createMemo<ColumnDef<Course>[]>(() => [ |
| 94 | 95 | { |
| 95 | 96 | accessorKey: "title", |
| 96 | - header: t("courses.title"), | |
| 97 | + header: pageLabel(), | |
| 97 | 98 | cell: (cell) => ( |
| 98 | 99 | <div class="min-w-0 space-y-1"> |
| 99 | 100 | <p class="truncate font-medium">{cell.row.original.title}</p> |
| 100 | - <Badge variant="outline" class="rounded-sm text-[11px]">{courseKindLabel(cell.row.original.kind)}</Badge> | |
| 101 | 101 | <Show when={isStudent()}> |
| 102 | 102 | <Badge variant="secondary" class="rounded-sm">{t("courses.enrolled")}</Badge> |
| 103 | 103 | </Show> |
| @@ -149,13 +149,12 @@ function CoursesContent() { | ||
| 149 | 149 | await postCourse({ |
| 150 | 150 | title: title().trim(), |
| 151 | 151 | description: description().trim() || undefined, |
| 152 | - kind: kind(), | |
| 152 | + kind: pageKind(), | |
| 153 | 153 | term_id: termId() || null, |
| 154 | 154 | capacity: cap ? Number(cap) : null, |
| 155 | 155 | }); |
| 156 | 156 | setTitle(""); |
| 157 | 157 | setDescription(""); |
| 158 | - setKind("course"); | |
| 159 | 158 | setTermId(""); |
| 160 | 159 | setCapacity(""); |
| 161 | 160 | setShowForm(false); |
| @@ -174,25 +173,25 @@ function CoursesContent() { | ||
| 174 | 173 | <div class="flex flex-wrap items-center gap-1 text-xs text-muted-foreground"> |
| 175 | 174 | <span>{t("nav.group.classes")}</span> |
| 176 | 175 | <span>/</span> |
| 177 | - <span>{t("nav.courses")}</span> | |
| 176 | + <span>{pageLabel()}</span> | |
| 178 | 177 | </div> |
| 179 | 178 | <PageHeader |
| 180 | 179 | accent="violet" |
| 181 | - eyebrow={t("nav.courses")} | |
| 182 | - title={t("courses.title")} | |
| 183 | - description={t("courses.subtitle")} | |
| 180 | + eyebrow={t("nav.group.classes")} | |
| 181 | + title={pageLabel()} | |
| 182 | + description={t("courses.subtitle", { item: pageLabel() })} | |
| 184 | 183 | actions={ |
| 185 | 184 | canCreate() ? ( |
| 186 | 185 | <Button type="button" size="sm" class="min-w-[7.5rem] rounded-lg" onClick={() => setShowForm(true)}> |
| 187 | 186 | <IconPlus class="h-4 w-4" /> |
| 188 | - {t("courses.create")} | |
| 187 | + {t("common.createItem", { item: pageLabel() })} | |
| 189 | 188 | </Button> |
| 190 | 189 | ) : undefined |
| 191 | 190 | } |
| 192 | 191 | /> |
| 193 | 192 | </div> |
| 194 | 193 | |
| 195 | - <SidePanel open={canCreate() && showForm()} onOpenChange={setShowForm} title={t("courses.create")} description={t("courses.subtitle")}> | |
| 194 | + <SidePanel open={canCreate() && showForm()} onOpenChange={setShowForm} title={t("common.createItem", { item: pageLabel() })} description={t("courses.subtitle", { item: pageLabel() })}> | |
| 196 | 195 | <form class="space-y-3" onSubmit={onCreate}> |
| 197 | 196 | <div class="space-y-1.5"> |
| 198 | 197 | <Label for="course-title">{t("form.title")}</Label> |
| @@ -202,12 +201,6 @@ function CoursesContent() { | ||
| 202 | 201 | <Label for="course-desc">{t("form.description")}</Label> |
| 203 | 202 | <Textarea id="course-desc" maxlength={2000} rows={3} value={description()} onInput={(e) => setDescription(e.currentTarget.value)} /> |
| 204 | 203 | </div> |
| 205 | - <div class="space-y-1.5"> | |
| 206 | - <Label for="course-kind">{t("courses.kind")}</Label> | |
| 207 | - <Select id="course-kind" value={kind()} onChange={(e) => setKind(e.currentTarget.value as CourseKind)}> | |
| 208 | - <For each={COURSE_KINDS}>{(item) => <option value={item}>{courseKindLabel(item)}</option>}</For> | |
| 209 | - </Select> | |
| 210 | - </div> | |
| 211 | 204 | <div class="space-y-1.5"> |
| 212 | 205 | <Label for="course-term">{t("terms.term")}</Label> |
| 213 | 206 | <Select id="course-term" value={termId()} onChange={(e) => setTermId(e.currentTarget.value)}> |
| @@ -243,12 +236,12 @@ function CoursesContent() { | ||
| 243 | 236 | when={rows().length > 0} |
| 244 | 237 | fallback={ |
| 245 | 238 | <EmptyState |
| 246 | - title={t("courses.empty")} | |
| 239 | + title={t("courses.empty", { item: pageLabel() })} | |
| 247 | 240 | action={ |
| 248 | 241 | canCreate() ? ( |
| 249 | 242 | <Button type="button" size="sm" class="rounded-lg" onClick={() => setShowForm(true)}> |
| 250 | 243 | <IconPlus class="h-4 w-4" /> |
| 251 | - {t("courses.create")} | |
| 244 | + {t("common.createItem", { item: pageLabel() })} | |
| 252 | 245 | </Button> |
| 253 | 246 | ) : undefined |
| 254 | 247 | } |
| @@ -258,9 +251,9 @@ function CoursesContent() { | ||
| 258 | 251 | <div class="space-y-4"> |
| 259 | 252 | <div class="flex flex-wrap items-center justify-between gap-3"> |
| 260 | 253 | <div> |
| 261 | - <h2 class="font-display text-lg font-semibold">{t("courses.listTitle")}</h2> | |
| 254 | + <h2 class="font-display text-lg font-semibold">{t("courses.listTitle", { item: pageLabel() })}</h2> | |
| 262 | 255 | <p class="mt-1 text-sm text-muted-foreground"> |
| 263 | - {rows().length} {t("nav.courses")} | |
| 256 | + {t("common.countItem", { count: rows().length, item: pageLabel() })} | |
| 264 | 257 | </p> |
| 265 | 258 | </div> |
| 266 | 259 | </div> |
src/pages/dashboard-page.tsxmodified+13 -2
| @@ -7,7 +7,7 @@ import { getExams } from "@/api/getExams"; | ||
| 7 | 7 | import { getMyCourses } from "@/api/getMyCourses"; |
| 8 | 8 | import { getMyMarks } from "@/api/getMyMarks"; |
| 9 | 9 | import { getNotes } from "@/api/getNotes"; |
| 10 | -import type { Exam, Event, Role } from "@/api/types"; | |
| 10 | +import type { Course, Exam, Event, Role } from "@/api/types"; | |
| 11 | 11 | import { RouteGuard } from "@/components/layout/route-guard"; |
| 12 | 12 | import { Alert } from "@/components/ui/alert"; |
| 13 | 13 | import { |
| @@ -166,7 +166,10 @@ function DashboardContent() { | ||
| 166 | 166 | return all; |
| 167 | 167 | }); |
| 168 | 168 | |
| 169 | - const courseCount = createMemo(() => scopedCourses().length); | |
| 169 | + const countCoursesByKind = (kind: Course["kind"]) => scopedCourses().filter((course) => course.kind === kind).length; | |
| 170 | + const courseCount = createMemo(() => countCoursesByKind("course")); | |
| 171 | + const studyCount = createMemo(() => countCoursesByKind("study")); | |
| 172 | + const clubCount = createMemo(() => countCoursesByKind("club")); | |
| 170 | 173 | const examCount = createMemo(() => visibleExams().length); |
| 171 | 174 | const eventCount = createMemo(() => events().length); |
| 172 | 175 | const noteCount = createMemo(() => notes().length); |
| @@ -178,6 +181,8 @@ function DashboardContent() { | ||
| 178 | 181 | const portalCards = createMemo<PortalCardDef[]>(() => { |
| 179 | 182 | const r = role(); |
| 180 | 183 | const cc = String(courseCount()); |
| 184 | + const sc = String(studyCount()); | |
| 185 | + const clc = String(clubCount()); | |
| 181 | 186 | const ec = String(examCount()); |
| 182 | 187 | const evc = String(eventCount()); |
| 183 | 188 | const nc = String(noteCount()); |
| @@ -186,6 +191,8 @@ function DashboardContent() { | ||
| 186 | 191 | if (r === "student") { |
| 187 | 192 | list.push( |
| 188 | 193 | { Icon: IconBook, titleKey: "nav.courses", to: "/courses", descKey: "dashboard.portal.coursesDesc", stat: cc }, |
| 194 | + { Icon: IconClock, titleKey: "nav.studies", to: "/studies", descKey: "dashboard.portal.studiesDesc", stat: sc }, | |
| 195 | + { Icon: IconUsers, titleKey: "nav.clubs", to: "/clubs", descKey: "dashboard.portal.clubsDesc", stat: clc }, | |
| 189 | 196 | { Icon: IconExam, titleKey: "nav.exams", to: "/exams", descKey: "dashboard.portal.examsDesc", stat: ec }, |
| 190 | 197 | { Icon: IconCalendar, titleKey: "nav.events", to: "/events", descKey: "dashboard.portal.eventsDesc", stat: evc }, |
| 191 | 198 | { Icon: IconChart, titleKey: "nav.marks", to: "/marks", descKey: "dashboard.portal.marksDesc", stat: avgLabel() }, |
| @@ -198,6 +205,8 @@ function DashboardContent() { | ||
| 198 | 205 | if (r === "teacher") { |
| 199 | 206 | list.push( |
| 200 | 207 | { Icon: IconBook, titleKey: "nav.courses", to: "/courses", descKey: "dashboard.portal.coursesDesc", stat: cc }, |
| 208 | + { Icon: IconClock, titleKey: "nav.studies", to: "/studies", descKey: "dashboard.portal.studiesDesc", stat: sc }, | |
| 209 | + { Icon: IconUsers, titleKey: "nav.clubs", to: "/clubs", descKey: "dashboard.portal.clubsDesc", stat: clc }, | |
| 201 | 210 | { Icon: IconExam, titleKey: "nav.exams", to: "/exams", descKey: "dashboard.portal.examsDesc", stat: ec }, |
| 202 | 211 | { Icon: IconCalendar, titleKey: "nav.events", to: "/events", descKey: "dashboard.portal.eventsDesc", stat: evc, minRole: "teacher" }, |
| 203 | 212 | { Icon: IconChart, titleKey: "nav.studentMarks", to: "/management/student-marks", descKey: "dashboard.portal.studentMarksDesc", minRole: "teacher" }, |
| @@ -211,6 +220,8 @@ function DashboardContent() { | ||
| 211 | 220 | // manager + admin |
| 212 | 221 | list.push( |
| 213 | 222 | { Icon: IconBook, titleKey: "nav.courses", to: "/courses", descKey: "dashboard.portal.coursesDesc", stat: cc }, |
| 223 | + { Icon: IconClock, titleKey: "nav.studies", to: "/studies", descKey: "dashboard.portal.studiesDesc", stat: sc }, | |
| 224 | + { Icon: IconUsers, titleKey: "nav.clubs", to: "/clubs", descKey: "dashboard.portal.clubsDesc", stat: clc }, | |
| 214 | 225 | { Icon: IconExam, titleKey: "nav.exams", to: "/exams", descKey: "dashboard.portal.examsDesc", stat: ec }, |
| 215 | 226 | { Icon: IconCalendar, titleKey: "nav.events", to: "/events", descKey: "dashboard.portal.eventsDesc", stat: evc }, |
| 216 | 227 | { Icon: IconNote, titleKey: "nav.notes", to: "/notes", descKey: "dashboard.portal.notesDesc", stat: nc }, |
src/routes/router.tsxmodified+14 -0
| @@ -130,6 +130,18 @@ const coursesRoute = createRoute({ | ||
| 130 | 130 | component: CoursesPage, |
| 131 | 131 | }); |
| 132 | 132 | |
| 133 | +const studiesRoute = createRoute({ | |
| 134 | + getParentRoute: () => rootRoute, | |
| 135 | + path: "/studies", | |
| 136 | + component: CoursesPage, | |
| 137 | +}); | |
| 138 | + | |
| 139 | +const clubsRoute = createRoute({ | |
| 140 | + getParentRoute: () => rootRoute, | |
| 141 | + path: "/clubs", | |
| 142 | + component: CoursesPage, | |
| 143 | +}); | |
| 144 | + | |
| 133 | 145 | const courseDetailRoute = createRoute({ |
| 134 | 146 | getParentRoute: () => rootRoute, |
| 135 | 147 | path: "/courses/$id", |
| @@ -226,6 +238,8 @@ const routeTree = rootRoute.addChildren([ | ||
| 226 | 238 | liveMonitorRoute, |
| 227 | 239 | examsRoute, |
| 228 | 240 | coursesRoute, |
| 241 | + studiesRoute, | |
| 242 | + clubsRoute, | |
| 229 | 243 | courseDetailRoute, |
| 230 | 244 | marksRoute, |
| 231 | 245 | pomodoroRoute, |