🧹 drop the deprecated IconPencilQuestion alias
Browse files at this commitbf534718a6a7762c62ca9441a8747da857c849f4Parent: 6195b47- refactor
- 🧹 drop the deprecated IconPencilQuestion alias
4 changed files +37 -38
- src/components/layout/command-palette.tsx +1 -2
- src/components/ui/icons.tsx +0 -5
- src/pages/course-detail-page.tsx +34 -29
- src/pages/exam-detail-page.tsx +2 -2
src/components/layout/command-palette.tsxmodified+1 -2
| @@ -11,7 +11,6 @@ import { | |||
| 11 | IconLogout, | 11 | IconLogout, |
| 12 | IconMoon, | 12 | IconMoon, |
| 13 | IconNote, | 13 | IconNote, |
| 14 | - IconPencilQuestion, | ||
| 15 | IconSearch, | 14 | IconSearch, |
| 16 | IconSparkles, | 15 | IconSparkles, |
| 17 | IconSun, | 16 | IconSun, |
| @@ -155,7 +154,7 @@ export function CommandPalette(props: CommandPaletteProps) { | |||
| 155 | title: t("command.action.askQuestion"), | 154 | title: t("command.action.askQuestion"), |
| 156 | description: t("command.action.askQuestionDesc"), | 155 | description: t("command.action.askQuestionDesc"), |
| 157 | keywords: "question soru sor havuz ekle topluluk", | 156 | keywords: "question soru sor havuz ekle topluluk", |
| 158 | - icon: IconPencilQuestion, | 157 | + icon: IconExam, |
| 159 | shortcut: `${mod}Q`, | 158 | shortcut: `${mod}Q`, |
| 160 | roleBadge: isStudent ? t("role.student") : undefined, | 159 | roleBadge: isStudent ? t("role.student") : undefined, |
| 161 | onSelect: () => void navigate({ to: "/questions", search: { action: "new" } as any }), | 160 | onSelect: () => void navigate({ to: "/questions", search: { action: "new" } as any }), |
src/components/ui/icons.tsxmodified+0 -5
| @@ -507,11 +507,6 @@ export function IconExam(props: IconProps) { | |||
| 507 | ); | 507 | ); |
| 508 | } | 508 | } |
| 509 | 509 | ||
| 510 | -/** @deprecated Prefer IconExam — kept as stable alias. */ | ||
| 511 | -export function IconPencilQuestion(props: IconProps) { | ||
| 512 | - return <IconExam {...props} />; | ||
| 513 | -} | ||
| 514 | - | ||
| 515 | export function IconGuide(props: IconProps) { | 510 | export function IconGuide(props: IconProps) { |
| 516 | return ( | 511 | return ( |
| 517 | <Svg {...props}> | 512 | <Svg {...props}> |
src/pages/course-detail-page.tsxmodified+34 -29
| @@ -157,6 +157,10 @@ function CourseDetailContent() { | |||
| 157 | .sort((a, b) => (a.starts_at ?? a.ends_at ?? 0) - (b.starts_at ?? b.ends_at ?? 0))[0], | 157 | .sort((a, b) => (a.starts_at ?? a.ends_at ?? 0) - (b.starts_at ?? b.ends_at ?? 0))[0], |
| 158 | ); | 158 | ); |
| 159 | const rosterCount = createMemo(() => roster()?.length ?? 0); | 159 | const rosterCount = createMemo(() => roster()?.length ?? 0); |
| 160 | + // `teachers` is the backend's assigned-teacher list. The course creator is | ||
| 161 | + // rendered separately below, so adding one here made an admin-created course | ||
| 162 | + // look as though it had a teacher who was never assigned to it. | ||
| 163 | + const assignedTeacherCount = createMemo(() => course()?.teachers?.length ?? 0); | ||
| 160 | const countDescription = (count: number, item: string) => t("common.countItem", { count, item }); | 164 | const countDescription = (count: number, item: string) => t("common.countItem", { count, item }); |
| 161 | 165 | ||
| 162 | const enrolledUserIds = () => (roster() ?? []).map((row) => row.user.id); | 166 | const enrolledUserIds = () => (roster() ?? []).map((row) => row.user.id); |
| @@ -285,8 +289,8 @@ function CourseDetailContent() { | |||
| 285 | {(c) => ( | 289 | {(c) => ( |
| 286 | <Show when={accessReady()} fallback={<PageSpinner />}> | 290 | <Show when={accessReady()} fallback={<PageSpinner />}> |
| 287 | <Show when={canViewCourse()} fallback={<Alert variant="destructive">{t("common.accessDenied")}</Alert>}> | 291 | <Show when={canViewCourse()} fallback={<Alert variant="destructive">{t("common.accessDenied")}</Alert>}> |
| 288 | - <div class="mx-auto w-full max-w-[1440px] space-y-6"> | 292 | + <div class="mx-auto w-full max-w-[1440px] space-y-4"> |
| 289 | - <div class="space-y-2"> | 293 | + <div class="space-y-1.5"> |
| 290 | <nav class="detail-breadcrumb"> | 294 | <nav class="detail-breadcrumb"> |
| 291 | <Link to="/courses" search={courseListSearch(c().kind)}>{courseKindLabel(c().kind)}</Link> | 295 | <Link to="/courses" search={courseListSearch(c().kind)}>{courseKindLabel(c().kind)}</Link> |
| 292 | <span aria-hidden>›</span> | 296 | <span aria-hidden>›</span> |
| @@ -320,7 +324,7 @@ function CourseDetailContent() { | |||
| 320 | } | 324 | } |
| 321 | /> | 325 | /> |
| 322 | <div class="grid gap-2 sm:grid-cols-2 xl:grid-cols-4"> | 326 | <div class="grid gap-2 sm:grid-cols-2 xl:grid-cols-4"> |
| 323 | - <div class="flex min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-card p-3.5"> | 327 | + <div class="flex min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-card p-3"> |
| 324 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground"> | 328 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground"> |
| 325 | <IconBook class="h-4 w-4" /> | 329 | <IconBook class="h-4 w-4" /> |
| 326 | </span> | 330 | </span> |
| @@ -329,7 +333,7 @@ function CourseDetailContent() { | |||
| 329 | <p class="truncate text-sm font-semibold">{courseKindLabel(c().kind)}</p> | 333 | <p class="truncate text-sm font-semibold">{courseKindLabel(c().kind)}</p> |
| 330 | </div> | 334 | </div> |
| 331 | </div> | 335 | </div> |
| 332 | - <div class="flex min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-card p-3.5"> | 336 | + <div class="flex min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-card p-3"> |
| 333 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground"> | 337 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground"> |
| 334 | <IconCalendarDays class="h-4 w-4" /> | 338 | <IconCalendarDays class="h-4 w-4" /> |
| 335 | </span> | 339 | </span> |
| @@ -338,7 +342,7 @@ function CourseDetailContent() { | |||
| 338 | <p class="truncate text-sm font-semibold">{terms()?.find((term) => term.id === c().term)?.name ?? t("terms.unassigned")}</p> | 342 | <p class="truncate text-sm font-semibold">{terms()?.find((term) => term.id === c().term)?.name ?? t("terms.unassigned")}</p> |
| 339 | </div> | 343 | </div> |
| 340 | </div> | 344 | </div> |
| 341 | - <div class="flex min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-card p-3.5"> | 345 | + <div class="flex min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-card p-3"> |
| 342 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground"> | 346 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground"> |
| 343 | <IconUsers class="h-4 w-4" /> | 347 | <IconUsers class="h-4 w-4" /> |
| 344 | </span> | 348 | </span> |
| @@ -347,7 +351,7 @@ function CourseDetailContent() { | |||
| 347 | <p class="mono truncate text-sm font-semibold">{c().capacity == null ? "—" : hasCourseManagementRights() ? `${rosterCount()} / ${c().capacity}` : c().capacity}</p> | 351 | <p class="mono truncate text-sm font-semibold">{c().capacity == null ? "—" : hasCourseManagementRights() ? `${rosterCount()} / ${c().capacity}` : c().capacity}</p> |
| 348 | </div> | 352 | </div> |
| 349 | </div> | 353 | </div> |
| 350 | - <div class="flex min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-card p-3.5"> | 354 | + <div class="flex min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-card p-3"> |
| 351 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground"> | 355 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground"> |
| 352 | <IconExam class="h-4 w-4" /> | 356 | <IconExam class="h-4 w-4" /> |
| 353 | </span> | 357 | </span> |
| @@ -606,35 +610,35 @@ function CourseDetailContent() { | |||
| 606 | </Show> | 610 | </Show> |
| 607 | </TabsList> | 611 | </TabsList> |
| 608 | 612 | ||
| 609 | - <TabsContent value="subjects" class="space-y-4 border-border/60 bg-card/80 shadow-sm"> | 613 | + <TabsContent value="subjects" class="space-y-3"> |
| 610 | - <div class="flex flex-wrap items-center justify-between gap-3"> | 614 | + <div class="flex flex-wrap items-center gap-2"> |
| 611 | <Badge variant="secondary" class="rounded-full">{countDescription(subjectCount(), t("subjects.item"))}</Badge> | 615 | <Badge variant="secondary" class="rounded-full">{countDescription(subjectCount(), t("subjects.item"))}</Badge> |
| 612 | - <Show when={canManage()}><Button type="button" variant="outline" size="sm" class="rounded-lg border-primary/30 hover:bg-muted" onClick={() => setShowSubjectForm(true)}><IconPlus class="h-4 w-4" />{t("subjects.add")}</Button></Show> | 616 | + <Show when={canManage()}><Button type="button" variant="outline" size="sm" class="ml-auto rounded-lg" onClick={() => setShowSubjectForm(true)}><IconPlus class="h-4 w-4" />{t("subjects.add")}</Button></Show> |
| 613 | </div> | 617 | </div> |
| 614 | <CourseSubjectsPanel courseId={id()} canManage={canManage()} active={courseTab() === "subjects"} createOpen={showSubjectForm()} onCreateOpenChange={setShowSubjectForm} onCountChange={setSubjectCount} /> | 618 | <CourseSubjectsPanel courseId={id()} canManage={canManage()} active={courseTab() === "subjects"} createOpen={showSubjectForm()} onCreateOpenChange={setShowSubjectForm} onCountChange={setSubjectCount} /> |
| 615 | </TabsContent> | 619 | </TabsContent> |
| 616 | 620 | ||
| 617 | - <TabsContent value="exams" class="space-y-4 border-border/60 bg-card/80 shadow-sm"> | 621 | + <TabsContent value="exams" class="space-y-3"> |
| 618 | - <div class="flex flex-wrap items-center justify-between gap-3"> | 622 | + <div class="flex flex-wrap items-center gap-2"> |
| 619 | <Badge variant="secondary" class="rounded-full">{countDescription(examCount(), t("courses.examItem"))}</Badge> | 623 | <Badge variant="secondary" class="rounded-full">{countDescription(examCount(), t("courses.examItem"))}</Badge> |
| 620 | - <Show when={canManage()}><Button type="button" variant="outline" size="sm" class="rounded-lg border-primary/30 hover:bg-muted" onClick={() => setShowExamForm(true)}><IconPlus class="h-4 w-4" />{t("courses.addExam")}</Button></Show> | 624 | + <Show when={canManage()}><Button type="button" variant="outline" size="sm" class="ml-auto rounded-lg" onClick={() => setShowExamForm(true)}><IconPlus class="h-4 w-4" />{t("courses.addExam")}</Button></Show> |
| 621 | </div> | 625 | </div> |
| 622 | <Suspense fallback={<DataTableSkeleton />}><DataTable columns={examColumns()} data={exams() ?? []} filterColumn="title" enablePagination pageSize={10} empty={t("exams.empty")} onRowClick={(exam) => void navigate({ to: "/exams/$id", params: { id: exam.id } })} /></Suspense> | 626 | <Suspense fallback={<DataTableSkeleton />}><DataTable columns={examColumns()} data={exams() ?? []} filterColumn="title" enablePagination pageSize={10} empty={t("exams.empty")} onRowClick={(exam) => void navigate({ to: "/exams/$id", params: { id: exam.id } })} /></Suspense> |
| 623 | </TabsContent> | 627 | </TabsContent> |
| 624 | 628 | ||
| 625 | - <TabsContent value="homework" class="space-y-4 border-border/60 bg-card/80 shadow-sm"> | 629 | + <TabsContent value="homework" class="space-y-3"> |
| 626 | - <div class="flex flex-wrap items-center justify-between gap-3"> | 630 | + <div class="flex flex-wrap items-center gap-2"> |
| 627 | <Badge variant="secondary" class="rounded-full">{countDescription(homeworkCount(), t("homework.item"))}</Badge> | 631 | <Badge variant="secondary" class="rounded-full">{countDescription(homeworkCount(), t("homework.item"))}</Badge> |
| 628 | - <Show when={canManage()}><Button type="button" variant="outline" size="sm" class="rounded-lg border-primary/30 hover:bg-muted" onClick={() => setShowHomeworkForm(true)}><IconPlus class="h-4 w-4" />{t("homework.add")}</Button></Show> | 632 | + <Show when={canManage()}><Button type="button" variant="outline" size="sm" class="ml-auto rounded-lg" onClick={() => setShowHomeworkForm(true)}><IconPlus class="h-4 w-4" />{t("homework.add")}</Button></Show> |
| 629 | </div> | 633 | </div> |
| 630 | <CourseHomeworkPanel courseId={id()} canManage={canManage()} active={courseTab() === "homework"} createOpen={showHomeworkForm()} onCreateOpenChange={setShowHomeworkForm} onCountChange={setHomeworkCount} /> | 634 | <CourseHomeworkPanel courseId={id()} canManage={canManage()} active={courseTab() === "homework"} createOpen={showHomeworkForm()} onCreateOpenChange={setShowHomeworkForm} onCountChange={setHomeworkCount} /> |
| 631 | </TabsContent> | 635 | </TabsContent> |
| 632 | 636 | ||
| 633 | - <TabsContent value="sessions" class="space-y-4 border-border/60 bg-card/80 shadow-sm"> | 637 | + <TabsContent value="sessions" class="space-y-3"> |
| 634 | - <div class="flex flex-wrap items-center justify-between gap-3"> | 638 | + <div class="flex flex-wrap items-center gap-2"> |
| 635 | <Badge variant="secondary" class="rounded-full">{countDescription(sessionCount(), t("sessions.item"))}</Badge> | 639 | <Badge variant="secondary" class="rounded-full">{countDescription(sessionCount(), t("sessions.item"))}</Badge> |
| 636 | <Show when={canManage()}> | 640 | <Show when={canManage()}> |
| 637 | - <Button type="button" variant="outline" size="sm" class="rounded-lg border-primary/30 hover:bg-muted" onClick={() => setShowSessionForm(true)}> | 641 | + <Button type="button" variant="outline" size="sm" class="ml-auto rounded-lg" onClick={() => setShowSessionForm(true)}> |
| 638 | <IconPlus class="h-4 w-4" /> | 642 | <IconPlus class="h-4 w-4" /> |
| 639 | {t("sessions.add")} | 643 | {t("sessions.add")} |
| 640 | </Button> | 644 | </Button> |
| @@ -643,23 +647,24 @@ function CourseDetailContent() { | |||
| 643 | <CourseSessionsPanel courseId={id()} roster={roster() ?? []} canManage={canManage()} active={courseTab() === "sessions"} createOpen={showSessionForm()} onCreateOpenChange={setShowSessionForm} onCountChange={setSessionCount} /> | 647 | <CourseSessionsPanel courseId={id()} roster={roster() ?? []} canManage={canManage()} active={courseTab() === "sessions"} createOpen={showSessionForm()} onCreateOpenChange={setShowSessionForm} onCountChange={setSessionCount} /> |
| 644 | </TabsContent> | 648 | </TabsContent> |
| 645 | 649 | ||
| 646 | - <TabsContent value="teachers" class="space-y-4 border-border/60 bg-card/80 shadow-sm"> | 650 | + <TabsContent value="teachers" class="space-y-3"> |
| 647 | - <div class="flex flex-wrap items-center justify-between gap-3"> | 651 | + <div class="flex flex-wrap items-center gap-2 text-sm"> |
| 648 | - <Badge variant="secondary" class="rounded-full">{countDescription((c().teachers ?? []).length + 1, t("courses.teachers"))}</Badge> | 652 | + <Badge variant="secondary" class="rounded-full">{countDescription(assignedTeacherCount(), t("courses.teachers"))}</Badge> |
| 649 | - <Show when={canStaffCourse()}><Button type="button" variant="outline" size="sm" class="rounded-lg border-primary/30 hover:bg-muted" onClick={() => setShowTeacherForm(true)}><IconPlus class="h-4 w-4" />{t("courses.assignTeacher")}</Button></Show> | 653 | + <span class="inline-flex min-w-0 items-center gap-1.5 text-muted-foreground"> |
| 650 | - </div> | 654 | + <IconSchool class="h-4 w-4 shrink-0" /> |
| 651 | - <div class="flex items-center gap-3 rounded-xl border border-border/70 bg-card px-3 py-2.5 text-sm"> | 655 | + <span>{t("common.creator")}:</span> |
| 652 | - <IconSchool class="h-4 w-4 shrink-0 text-muted-foreground" /> | 656 | + <span class="truncate font-medium text-foreground">{c().creator.display_name || c().creator.username}</span> |
| 653 | - <span><span class="text-muted-foreground">{t("common.creator")}:</span> <span class="font-medium">{c().creator.display_name || c().creator.username}</span></span> | 657 | + </span> |
| 658 | + <Show when={canStaffCourse()}><Button type="button" variant="outline" size="sm" class="ml-auto rounded-lg" onClick={() => setShowTeacherForm(true)}><IconPlus class="h-4 w-4" />{t("courses.assignTeacher")}</Button></Show> | ||
| 654 | </div> | 659 | </div> |
| 655 | <CourseTeachersPanel courseId={id()} teachers={c().teachers ?? []} canStaff={canStaffCourse()} assignOpen={showTeacherForm()} onAssignOpenChange={setShowTeacherForm} onCourseUpdated={refetchCourse} /> | 660 | <CourseTeachersPanel courseId={id()} teachers={c().teachers ?? []} canStaff={canStaffCourse()} assignOpen={showTeacherForm()} onAssignOpenChange={setShowTeacherForm} onCourseUpdated={refetchCourse} /> |
| 656 | </TabsContent> | 661 | </TabsContent> |
| 657 | 662 | ||
| 658 | <Show when={hasCourseManagementRights()}> | 663 | <Show when={hasCourseManagementRights()}> |
| 659 | - <TabsContent value="students" class="space-y-4 border-border/60 bg-card/80 shadow-sm"> | 664 | + <TabsContent value="students" class="space-y-3"> |
| 660 | - <div class="flex flex-wrap items-center justify-between gap-3"> | 665 | + <div class="flex flex-wrap items-center gap-2"> |
| 661 | <Badge variant="secondary" class="rounded-full">{countDescription(rosterCount(), t("courses.rosterItem"))}</Badge> | 666 | <Badge variant="secondary" class="rounded-full">{countDescription(rosterCount(), t("courses.rosterItem"))}</Badge> |
| 662 | - <Show when={canManage()}><Button type="button" variant="outline" size="sm" class="rounded-lg border-primary/30 hover:bg-muted" onClick={() => setShowEnrollPanel(true)}><IconPlus class="h-4 w-4" />{t("courses.enroll")}</Button></Show> | 667 | + <Show when={canManage()}><Button type="button" variant="outline" size="sm" class="ml-auto rounded-lg" onClick={() => setShowEnrollPanel(true)}><IconPlus class="h-4 w-4" />{t("courses.enroll")}</Button></Show> |
| 663 | </div> | 668 | </div> |
| 664 | <Suspense fallback={<DataTableSkeleton />}><Show when={(roster() ?? []).length > 0} fallback={<EmptyState kind="courses" title={t("exams.emptyRoster")} />}><DataTable columns={rosterColumns()} data={roster() ?? []} filterColumn="username" enablePagination pageSize={10} /></Show></Suspense> | 669 | <Suspense fallback={<DataTableSkeleton />}><Show when={(roster() ?? []).length > 0} fallback={<EmptyState kind="courses" title={t("exams.emptyRoster")} />}><DataTable columns={rosterColumns()} data={roster() ?? []} filterColumn="username" enablePagination pageSize={10} /></Show></Suspense> |
| 665 | </TabsContent> | 670 | </TabsContent> |
src/pages/exam-detail-page.tsxmodified+2 -2
| @@ -28,7 +28,7 @@ import { Button } from "@/components/ui/button"; | |||
| 28 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 28 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 29 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 29 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 30 | import { EmptyState } from "@/components/ui/empty-state"; | 30 | import { EmptyState } from "@/components/ui/empty-state"; |
| 31 | -import { IconCalendarDays, IconChart, IconChevronDown, IconClipboardCheck, IconClock, IconEdit, IconExam, IconEye, IconPencilQuestion, IconRefresh, IconTrash } from "@/components/ui/icons"; | 31 | +import { IconCalendarDays, IconChart, IconChevronDown, IconClipboardCheck, IconClock, IconEdit, IconExam, IconEye, IconRefresh, IconTrash } from "@/components/ui/icons"; |
| 32 | import { Input } from "@/components/ui/input"; | 32 | import { Input } from "@/components/ui/input"; |
| 33 | import { PaginationControls } from "@/components/ui/pagination-controls"; | 33 | import { PaginationControls } from "@/components/ui/pagination-controls"; |
| 34 | import { PageSpinner } from "@/components/ui/page-spinner"; | 34 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| @@ -637,7 +637,7 @@ function ExamDetailContent() { | |||
| 637 | <Tabs value={examTab()} onChange={setExamTab} class="space-y-3"> | 637 | <Tabs value={examTab()} onChange={setExamTab} class="space-y-3"> |
| 638 | <TabsList class="border-primary/10 bg-card/80 shadow-sm"> | 638 | <TabsList class="border-primary/10 bg-card/80 shadow-sm"> |
| 639 | <TabsTrigger value="statistics"><IconChart class="h-4 w-4" />{t("exams.statistics")}</TabsTrigger> | 639 | <TabsTrigger value="statistics"><IconChart class="h-4 w-4" />{t("exams.statistics")}</TabsTrigger> |
| 640 | - <TabsTrigger value="questions"><IconPencilQuestion class="h-4 w-4" />{t("questions.title")}</TabsTrigger> | 640 | + <TabsTrigger value="questions"><IconExam class="h-4 w-4" />{t("questions.title")}</TabsTrigger> |
| 641 | <TabsTrigger value="results"><IconClipboardCheck class="h-4 w-4" />{t("exams.results")}</TabsTrigger> | 641 | <TabsTrigger value="results"><IconClipboardCheck class="h-4 w-4" />{t("exams.results")}</TabsTrigger> |
| 642 | </TabsList> | 642 | </TabsList> |
| 643 | 643 | ||