♻️ move course session actions into side panels
Browse files at this commit0301cb05f8ed8a9595fab477efd46927aaad9ea0Parent: 828b795- refactor
- ♻️ move course session actions into side panels
4 changed files +150 -69
- src/components/sessions/course-sessions-panel.tsx +125 -63
- src/components/ui/section-disclosure.tsx +1 -1
- src/i18n/messages.ts +3 -0
- src/pages/course-detail-page.tsx +21 -5
src/components/sessions/course-sessions-panel.tsxmodified+125 -63
| @@ -1,19 +1,21 @@ | ||
| 1 | -import { For, Show, Suspense, createMemo, createResource, createSignal } from "solid-js"; | |
| 1 | +import { For, Show, Suspense, createEffect, createMemo, createResource, createSignal } from "solid-js"; | |
| 2 | 2 | import { deleteSessionById } from "@/api/deleteSessionById"; |
| 3 | 3 | import { getCourseSessions } from "@/api/getCourseSessions"; |
| 4 | 4 | import { getSessionAttendance } from "@/api/getSessionAttendance"; |
| 5 | 5 | import { postCourseSession } from "@/api/postCourseSession"; |
| 6 | 6 | import { postSessionAttendance } from "@/api/postSessionAttendance"; |
| 7 | 7 | import { formatApiError } from "@/api/client"; |
| 8 | -import type { AttendanceStatus, Enrollment, SessionAttendance } from "@/api/types"; | |
| 8 | +import type { AttendanceStatus, CourseSession, Enrollment, SessionAttendance } from "@/api/types"; | |
| 9 | 9 | import { AttendanceStatusPicker } from "@/components/events/attendance-status-picker"; |
| 10 | 10 | import { Alert } from "@/components/ui/alert"; |
| 11 | 11 | import { Button } from "@/components/ui/button"; |
| 12 | 12 | import { DatePicker } from "@/components/ui/date-picker"; |
| 13 | -import { IconPlus, IconTrash } from "@/components/ui/icons"; | |
| 13 | +import { IconTrash } from "@/components/ui/icons"; | |
| 14 | 14 | import { Input } from "@/components/ui/input"; |
| 15 | 15 | import { Label } from "@/components/ui/label"; |
| 16 | 16 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 17 | +import { PaginationControls } from "@/components/ui/pagination-controls"; | |
| 18 | +import { SidePanel } from "@/components/ui/side-panel"; | |
| 17 | 19 | import { formatDateTime } from "@/lib/format"; |
| 18 | 20 | import { personLabel } from "@/lib/person"; |
| 19 | 21 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| @@ -34,11 +36,19 @@ function dateInputToMs(date: string, time: string): number | null { | ||
| 34 | 36 | return d.getTime(); |
| 35 | 37 | } |
| 36 | 38 | |
| 37 | -export function CourseSessionsPanel(props: { courseId: string; roster: Enrollment[]; canManage: boolean }) { | |
| 39 | +const ROLL_CALL_PAGE_SIZE = 8; | |
| 40 | + | |
| 41 | +export function CourseSessionsPanel(props: { | |
| 42 | + courseId: string; | |
| 43 | + roster: Enrollment[]; | |
| 44 | + canManage: boolean; | |
| 45 | + createOpen: boolean; | |
| 46 | + onCreateOpenChange: (open: boolean) => void; | |
| 47 | +}) { | |
| 38 | 48 | const t = useT(); |
| 39 | 49 | const { locale } = usePreferences(); |
| 40 | 50 | const [sessions, { refetch }] = createResource(() => props.courseId, (courseId) => getCourseSessions(courseId)); |
| 41 | - const [openSessionId, setOpenSessionId] = createSignal<string | null>(null); | |
| 51 | + const [selectedSession, setSelectedSession] = createSignal<CourseSession | null>(null); | |
| 42 | 52 | const [topic, setTopic] = createSignal(""); |
| 43 | 53 | const [startsDate, setStartsDate] = createSignal(""); |
| 44 | 54 | const [startsTime, setStartsTime] = createSignal(""); |
| @@ -47,6 +57,15 @@ export function CourseSessionsPanel(props: { courseId: string; roster: Enrollmen | ||
| 47 | 57 | const [error, setError] = createSignal(""); |
| 48 | 58 | const [pending, setPending] = createSignal(false); |
| 49 | 59 | |
| 60 | + const resetCreateForm = () => { | |
| 61 | + setTopic(""); | |
| 62 | + setStartsDate(""); | |
| 63 | + setStartsTime(""); | |
| 64 | + setEndsDate(""); | |
| 65 | + setEndsTime(""); | |
| 66 | + setError(""); | |
| 67 | + }; | |
| 68 | + | |
| 50 | 69 | const createSession = async (e: SubmitEvent) => { |
| 51 | 70 | e.preventDefault(); |
| 52 | 71 | setError(""); |
| @@ -66,12 +85,14 @@ export function CourseSessionsPanel(props: { courseId: string; roster: Enrollmen | ||
| 66 | 85 | } |
| 67 | 86 | setPending(true); |
| 68 | 87 | try { |
| 69 | - await postCourseSession(props.courseId, { topic: topic().trim() || null, starts_at, ends_at }); | |
| 70 | - setTopic(""); | |
| 71 | - setStartsDate(""); | |
| 72 | - setStartsTime(""); | |
| 73 | - setEndsDate(""); | |
| 74 | - setEndsTime(""); | |
| 88 | + const body = { | |
| 89 | + starts_at, | |
| 90 | + ...(topic().trim() ? { topic: topic().trim() } : {}), | |
| 91 | + ...(ends_at != null ? { ends_at } : {}), | |
| 92 | + }; | |
| 93 | + await postCourseSession(props.courseId, body); | |
| 94 | + resetCreateForm(); | |
| 95 | + props.onCreateOpenChange(false); | |
| 75 | 96 | await refetch(); |
| 76 | 97 | } catch (err) { |
| 77 | 98 | setError(formatApiError(err)); |
| @@ -84,35 +105,6 @@ export function CourseSessionsPanel(props: { courseId: string; roster: Enrollmen | ||
| 84 | 105 | <div class="space-y-4"> |
| 85 | 106 | {error() && <Alert variant="destructive">{error()}</Alert>} |
| 86 | 107 | |
| 87 | - <Show when={props.canManage}> | |
| 88 | - <form class="grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]" onSubmit={createSession}> | |
| 89 | - <div class="space-y-1.5"> | |
| 90 | - <Label for="session-topic">{t("sessions.topic")}</Label> | |
| 91 | - <Input id="session-topic" value={topic()} maxlength={200} onInput={(e) => setTopic(e.currentTarget.value)} /> | |
| 92 | - </div> | |
| 93 | - <div class="space-y-1.5"> | |
| 94 | - <Label for="session-starts">{t("events.starts")}</Label> | |
| 95 | - <div class="grid grid-cols-[minmax(0,1fr)_6.5rem] gap-2"> | |
| 96 | - <DatePicker id="session-starts" placeholder={t("form.datePlaceholder")} value={startsDate()} required onChange={setStartsDate} /> | |
| 97 | - <Input class="font-mono" placeholder="09:00" value={startsTime()} required onInput={(e) => setStartsTime(e.currentTarget.value)} /> | |
| 98 | - </div> | |
| 99 | - </div> | |
| 100 | - <div class="space-y-1.5"> | |
| 101 | - <Label for="session-ends">{t("events.ends")}</Label> | |
| 102 | - <div class="grid grid-cols-[minmax(0,1fr)_6.5rem] gap-2"> | |
| 103 | - <DatePicker id="session-ends" placeholder={t("form.datePlaceholder")} value={endsDate()} onChange={setEndsDate} /> | |
| 104 | - <Input class="font-mono" placeholder="10:00" value={endsTime()} onInput={(e) => setEndsTime(e.currentTarget.value)} /> | |
| 105 | - </div> | |
| 106 | - </div> | |
| 107 | - <div class="flex items-end"> | |
| 108 | - <Button type="submit" disabled={pending()}> | |
| 109 | - <IconPlus class="h-4 w-4" /> | |
| 110 | - {t("sessions.add")} | |
| 111 | - </Button> | |
| 112 | - </div> | |
| 113 | - </form> | |
| 114 | - </Show> | |
| 115 | - | |
| 116 | 108 | <Suspense fallback={<PageSpinner />}> |
| 117 | 109 | <Show when={sessions.error}> |
| 118 | 110 | <Alert variant="destructive">{formatApiError(sessions.error)}</Alert> |
| @@ -121,7 +113,7 @@ export function CourseSessionsPanel(props: { courseId: string; roster: Enrollmen | ||
| 121 | 113 | <div class="space-y-3"> |
| 122 | 114 | <For each={sessions() ?? []}> |
| 123 | 115 | {(session) => ( |
| 124 | - <article class="rounded-lg border bg-background/60 p-4"> | |
| 116 | + <article class="rounded-xl border border-border/80 bg-card p-4 shadow-sm"> | |
| 125 | 117 | <div class="flex flex-wrap items-start justify-between gap-3"> |
| 126 | 118 | <div> |
| 127 | 119 | <h3 class="font-medium">{session.topic || t("sessions.untitled")}</h3> |
| @@ -131,25 +123,76 @@ export function CourseSessionsPanel(props: { courseId: string; roster: Enrollmen | ||
| 131 | 123 | <p class="mt-1 text-xs text-muted-foreground">{t("sessions.teacher")}: {personLabel(session.teacher)}</p> |
| 132 | 124 | </div> |
| 133 | 125 | <div class="flex gap-2"> |
| 134 | - <Button type="button" variant="outline" size="sm" onClick={() => setOpenSessionId(openSessionId() === session.id ? null : session.id)}> | |
| 126 | + <Button type="button" variant="outline" size="sm" class="rounded-lg" onClick={() => setSelectedSession(session)}> | |
| 135 | 127 | {t("sessions.rollCall")} |
| 136 | 128 | </Button> |
| 137 | 129 | <Show when={props.canManage}> |
| 138 | - <Button type="button" variant="ghost" size="sm" class="text-destructive hover:text-destructive" onClick={async () => { await deleteSessionById(session.id); await refetch(); }}> | |
| 130 | + <Button type="button" variant="ghost" size="sm" class="rounded-lg text-destructive hover:text-destructive" onClick={async () => { await deleteSessionById(session.id); await refetch(); }}> | |
| 139 | 131 | <IconTrash class="h-4 w-4" /> |
| 140 | 132 | </Button> |
| 141 | 133 | </Show> |
| 142 | 134 | </div> |
| 143 | 135 | </div> |
| 144 | - <Show when={openSessionId() === session.id}> | |
| 145 | - <RollCall sessionId={session.id} roster={props.roster} /> | |
| 146 | - </Show> | |
| 147 | 136 | </article> |
| 148 | 137 | )} |
| 149 | 138 | </For> |
| 150 | 139 | </div> |
| 151 | 140 | </Show> |
| 152 | 141 | </Suspense> |
| 142 | + | |
| 143 | + <SidePanel | |
| 144 | + open={props.createOpen} | |
| 145 | + onOpenChange={(open) => { | |
| 146 | + props.onCreateOpenChange(open); | |
| 147 | + if (!open) resetCreateForm(); | |
| 148 | + }} | |
| 149 | + title={t("sessions.add")} | |
| 150 | + description={t("sessions.subtitle")} | |
| 151 | + > | |
| 152 | + <form onSubmit={createSession}> | |
| 153 | + <div class="space-y-1.5"> | |
| 154 | + <Label for="session-topic">{t("sessions.topic")}</Label> | |
| 155 | + <Input id="session-topic" value={topic()} maxlength={200} onInput={(e) => setTopic(e.currentTarget.value)} /> | |
| 156 | + </div> | |
| 157 | + <div class="grid gap-3"> | |
| 158 | + <div class="space-y-1.5"> | |
| 159 | + <Label for="session-starts">{t("events.starts")}</Label> | |
| 160 | + <div class="grid grid-cols-[minmax(0,1fr)_6.5rem] gap-2"> | |
| 161 | + <DatePicker id="session-starts" placeholder={t("form.datePlaceholder")} value={startsDate()} required onChange={setStartsDate} /> | |
| 162 | + <Input class="font-mono placeholder:text-muted-foreground/35" placeholder="09:00" value={startsTime()} required onInput={(e) => setStartsTime(e.currentTarget.value)} /> | |
| 163 | + </div> | |
| 164 | + </div> | |
| 165 | + <div class="space-y-1.5"> | |
| 166 | + <Label for="session-ends">{t("events.ends")}</Label> | |
| 167 | + <div class="grid grid-cols-[minmax(0,1fr)_6.5rem] gap-2"> | |
| 168 | + <DatePicker id="session-ends" placeholder={t("form.datePlaceholder")} value={endsDate()} onChange={setEndsDate} /> | |
| 169 | + <Input class="font-mono placeholder:text-muted-foreground/35" placeholder="10:00" value={endsTime()} onInput={(e) => setEndsTime(e.currentTarget.value)} /> | |
| 170 | + </div> | |
| 171 | + </div> | |
| 172 | + </div> | |
| 173 | + <div class="flex flex-wrap items-center gap-2"> | |
| 174 | + <Button type="button" variant="outline" class="h-10 rounded-lg" onClick={() => props.onCreateOpenChange(false)}> | |
| 175 | + {t("common.cancel")} | |
| 176 | + </Button> | |
| 177 | + <Button type="submit" class="h-10 rounded-lg" disabled={pending()}> | |
| 178 | + {t("sessions.add")} | |
| 179 | + </Button> | |
| 180 | + </div> | |
| 181 | + </form> | |
| 182 | + </SidePanel> | |
| 183 | + | |
| 184 | + <SidePanel | |
| 185 | + open={selectedSession() != null} | |
| 186 | + onOpenChange={(open) => { | |
| 187 | + if (!open) setSelectedSession(null); | |
| 188 | + }} | |
| 189 | + title={t("sessions.rollCall")} | |
| 190 | + description={selectedSession() ? `${selectedSession()!.topic || t("sessions.untitled")} · ${formatDateTime(selectedSession()!.starts_at, locale())}` : undefined} | |
| 191 | + > | |
| 192 | + <Show when={selectedSession()}> | |
| 193 | + {(session) => <RollCall sessionId={session().id} roster={props.roster} />} | |
| 194 | + </Show> | |
| 195 | + </SidePanel> | |
| 153 | 196 | </div> |
| 154 | 197 | ); |
| 155 | 198 | } |
| @@ -160,6 +203,17 @@ function RollCall(props: { sessionId: string; roster: Enrollment[] }) { | ||
| 160 | 203 | const rows = createMemo(() => new Map((attendance() ?? []).map((row) => [row.user.id, row]))); |
| 161 | 204 | const [local, setLocal] = createSignal<Record<string, AttendanceStatus>>({}); |
| 162 | 205 | const [error, setError] = createSignal(""); |
| 206 | + const [page, setPage] = createSignal(0); | |
| 207 | + const totalPages = createMemo(() => Math.max(1, Math.ceil(props.roster.length / ROLL_CALL_PAGE_SIZE))); | |
| 208 | + const safePage = createMemo(() => Math.min(page(), totalPages() - 1)); | |
| 209 | + const visibleRoster = createMemo(() => { | |
| 210 | + const start = safePage() * ROLL_CALL_PAGE_SIZE; | |
| 211 | + return props.roster.slice(start, start + ROLL_CALL_PAGE_SIZE); | |
| 212 | + }); | |
| 213 | + | |
| 214 | + createEffect(() => { | |
| 215 | + if (page() >= totalPages()) setPage(totalPages() - 1); | |
| 216 | + }); | |
| 163 | 217 | |
| 164 | 218 | const statusFor = (userId: string) => local()[userId] ?? rows().get(userId)?.status ?? "present"; |
| 165 | 219 | const save = async (userId: string) => { |
| @@ -173,25 +227,33 @@ function RollCall(props: { sessionId: string; roster: Enrollment[] }) { | ||
| 173 | 227 | }; |
| 174 | 228 | |
| 175 | 229 | return ( |
| 176 | - <div class="mt-4 space-y-3 border-t pt-4"> | |
| 230 | + <div class="space-y-3"> | |
| 177 | 231 | {error() && <Alert variant="destructive">{error()}</Alert>} |
| 178 | - <For each={props.roster}> | |
| 179 | - {(row) => { | |
| 180 | - const saved = () => rows().get(row.user.id) as SessionAttendance | undefined; | |
| 181 | - return ( | |
| 182 | - <div class="grid gap-2 rounded-md border bg-muted/15 p-3 sm:grid-cols-[minmax(0,1fr)_12rem_auto] sm:items-end"> | |
| 183 | - <div> | |
| 184 | - <p class="font-medium">{personLabel(row.user)}</p> | |
| 185 | - <p class="font-mono text-xs text-muted-foreground">{row.user.id}</p> | |
| 232 | + <Show | |
| 233 | + when={props.roster.length > 0} | |
| 234 | + fallback={<p class="rounded-xl border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground">{t("sessions.emptyRoster")}</p>} | |
| 235 | + > | |
| 236 | + <For each={visibleRoster()}> | |
| 237 | + {(row) => { | |
| 238 | + const saved = () => rows().get(row.user.id) as SessionAttendance | undefined; | |
| 239 | + return ( | |
| 240 | + <div class="grid gap-3 rounded-xl border border-border/80 bg-card p-4 shadow-sm sm:grid-cols-[minmax(0,1fr)_13rem_auto] sm:items-end"> | |
| 241 | + <div class="min-w-0"> | |
| 242 | + <p class="truncate font-medium">{personLabel(row.user)}</p> | |
| 243 | + <p class="mono mt-1 truncate text-xs text-muted-foreground">{row.user.id}</p> | |
| 244 | + </div> | |
| 245 | + <AttendanceStatusPicker id={`session-${props.sessionId}-${row.user.id}`} value={statusFor(row.user.id)} onChange={(status) => setLocal((current) => ({ ...current, [row.user.id]: status }))} /> | |
| 246 | + <Button type="button" class="rounded-lg" variant={saved() ? "outline" : "default"} onClick={() => void save(row.user.id)}> | |
| 247 | + {saved() ? t("common.update") : t("common.save")} | |
| 248 | + </Button> | |
| 186 | 249 | </div> |
| 187 | - <AttendanceStatusPicker id={`session-${props.sessionId}-${row.user.id}`} value={statusFor(row.user.id)} onChange={(status) => setLocal((current) => ({ ...current, [row.user.id]: status }))} /> | |
| 188 | - <Button type="button" variant={saved() ? "outline" : "default"} onClick={() => void save(row.user.id)}> | |
| 189 | - {saved() ? t("common.update") : t("common.save")} | |
| 190 | - </Button> | |
| 191 | - </div> | |
| 192 | - ); | |
| 193 | - }} | |
| 194 | - </For> | |
| 250 | + ); | |
| 251 | + }} | |
| 252 | + </For> | |
| 253 | + </Show> | |
| 254 | + <Show when={totalPages() > 1}> | |
| 255 | + <PaginationControls page={safePage()} totalPages={totalPages()} onPageChange={setPage} /> | |
| 256 | + </Show> | |
| 195 | 257 | </div> |
| 196 | 258 | ); |
| 197 | 259 | } |
src/components/ui/section-disclosure.tsxmodified+1 -1
| @@ -26,7 +26,7 @@ export function SectionDisclosure(props: ParentProps<{ | ||
| 26 | 26 | {props.description && <span class="mt-1 block truncate text-sm text-muted-foreground">{props.description}</span>} |
| 27 | 27 | </span> |
| 28 | 28 | </button> |
| 29 | - <div class="flex items-center gap-2 [&>button]:h-8 [&>button]:min-w-32 [&>button]:justify-center [&>div]:h-8 [&>div]:min-w-8 [&>div]:justify-center"> | |
| 29 | + <div class="flex items-center gap-2 [&>button]:h-8 [&>button]:min-w-36 [&>button]:justify-center [&>div]:h-8 [&>div]:justify-center"> | |
| 30 | 30 | {props.meta} |
| 31 | 31 | {props.actions} |
| 32 | 32 | </div> |
src/i18n/messages.tsmodified+3 -0
| @@ -443,6 +443,7 @@ export type MessageKey = | ||
| 443 | 443 | | "sessions.untitled" |
| 444 | 444 | | "sessions.teacher" |
| 445 | 445 | | "sessions.rollCall" |
| 446 | + | "sessions.emptyRoster" | |
| 446 | 447 | | "sessions.startRequired" |
| 447 | 448 | | "sessions.endInvalid" |
| 448 | 449 | | "attendance.title" |
| @@ -928,6 +929,7 @@ const en: Dict = { | ||
| 928 | 929 | "sessions.untitled": "Untitled lesson", |
| 929 | 930 | "sessions.teacher": "Teacher", |
| 930 | 931 | "sessions.rollCall": "Roll call", |
| 932 | + "sessions.emptyRoster": "No enrolled students yet.", | |
| 931 | 933 | "sessions.startRequired": "Session start date and time are required.", |
| 932 | 934 | "sessions.endInvalid": "Enter both end date and end time, or leave both empty.", |
| 933 | 935 | "attendance.title": "Attendance report", |
| @@ -1412,6 +1414,7 @@ const tr: Dict = { | ||
| 1412 | 1414 | "sessions.untitled": "Konu girilmemiş ders", |
| 1413 | 1415 | "sessions.teacher": "Öğretmen", |
| 1414 | 1416 | "sessions.rollCall": "Yoklama", |
| 1417 | + "sessions.emptyRoster": "Henüz kayıtlı öğrenci yok.", | |
| 1415 | 1418 | "sessions.startRequired": "Oturum başlangıç tarihi ve saati gerekli.", |
| 1416 | 1419 | "sessions.endInvalid": "Bitiş için tarih ve saati birlikte gir ya da ikisini de boş bırak.", |
| 1417 | 1420 | "attendance.title": "Yoklama raporu", |
src/pages/course-detail-page.tsxmodified+21 -5
| @@ -82,6 +82,7 @@ function CourseDetailContent() { | ||
| 82 | 82 | const [description, setDescription] = createSignal(""); |
| 83 | 83 | const [termId, setTermId] = createSignal(""); |
| 84 | 84 | const [showExamForm, setShowExamForm] = createSignal(false); |
| 85 | + const [showSessionForm, setShowSessionForm] = createSignal(false); | |
| 85 | 86 | const [showEnrollPanel, setShowEnrollPanel] = createSignal(false); |
| 86 | 87 | const [openSections, setOpenSections] = createSignal({ exams: true, sessions: false, roster: false }); |
| 87 | 88 | const [enrollUserId, setEnrollUserId] = createSignal(""); |
| @@ -375,10 +376,10 @@ function CourseDetailContent() { | ||
| 375 | 376 | onToggle={() => toggleSection("exams")} |
| 376 | 377 | title={t("courses.exams")} |
| 377 | 378 | description={`${examCount()} ${t("nav.exams")}`} |
| 378 | - meta={<Badge variant="secondary" class="mono rounded-sm px-3 py-1">{examCount()}</Badge>} | |
| 379 | + meta={<Badge variant="secondary" class="rounded-lg px-3 py-1"><span class="mono tabular-nums">{examCount()}</span><span class="ml-1">{t("nav.exams")}</span></Badge>} | |
| 379 | 380 | actions={ |
| 380 | 381 | <Show when={canManage()}> |
| 381 | - <Button type="button" variant="outline" size="sm" class="rounded-sm" onClick={() => setShowExamForm(true)}> | |
| 382 | + <Button type="button" variant="outline" size="sm" class="rounded-lg" onClick={() => setShowExamForm(true)}> | |
| 382 | 383 | <IconPlus class="h-4 w-4" /> |
| 383 | 384 | {t("courses.addExam")} |
| 384 | 385 | </Button> |
| @@ -432,8 +433,23 @@ function CourseDetailContent() { | ||
| 432 | 433 | onToggle={() => toggleSection("sessions")} |
| 433 | 434 | title={t("sessions.title")} |
| 434 | 435 | description={t("sessions.subtitle")} |
| 436 | + meta={<Badge variant="secondary" class="rounded-lg px-3 py-1">{t("sessions.title")}</Badge>} | |
| 437 | + actions={ | |
| 438 | + <Show when={canManage()}> | |
| 439 | + <Button type="button" variant="outline" size="sm" class="rounded-lg" onClick={() => setShowSessionForm(true)}> | |
| 440 | + <IconPlus class="h-4 w-4" /> | |
| 441 | + {t("sessions.add")} | |
| 442 | + </Button> | |
| 443 | + </Show> | |
| 444 | + } | |
| 435 | 445 | > |
| 436 | - <CourseSessionsPanel courseId={id()} roster={roster() ?? []} canManage={canManage()} /> | |
| 446 | + <CourseSessionsPanel | |
| 447 | + courseId={id()} | |
| 448 | + roster={roster() ?? []} | |
| 449 | + canManage={canManage()} | |
| 450 | + createOpen={showSessionForm()} | |
| 451 | + onCreateOpenChange={setShowSessionForm} | |
| 452 | + /> | |
| 437 | 453 | </SectionDisclosure> |
| 438 | 454 | |
| 439 | 455 | <Show when={isTeacherPlus()}> |
| @@ -442,10 +458,10 @@ function CourseDetailContent() { | ||
| 442 | 458 | onToggle={() => toggleSection("roster")} |
| 443 | 459 | title={t("courses.roster")} |
| 444 | 460 | description={t("courses.enroll")} |
| 445 | - meta={<Badge variant="secondary" class="mono rounded-sm px-3 py-1">{rosterCount()}</Badge>} | |
| 461 | + meta={<Badge variant="secondary" class="rounded-lg px-3 py-1"><span class="mono tabular-nums">{rosterCount()}</span><span class="ml-1">{t("courses.roster")}</span></Badge>} | |
| 446 | 462 | actions={ |
| 447 | 463 | <Show when={canManage()}> |
| 448 | - <Button type="button" variant="outline" size="sm" class="rounded-sm" onClick={() => setShowEnrollPanel(true)}> | |
| 464 | + <Button type="button" variant="outline" size="sm" class="rounded-lg" onClick={() => setShowEnrollPanel(true)}> | |
| 449 | 465 | <IconPlus class="h-4 w-4" /> |
| 450 | 466 | {t("courses.enroll")} |
| 451 | 467 | </Button> |