forge
Explore
Log in

Don't you dare go Hollow

✨ enhance exam and exams pages with improved UI elements and layout adjustments

Browse files at this commit

c3ded6f381cabc2747c233d8e60f51300486ffccBurak BoduroğluParent: f796060
  • feat
    • ✨ enhance exam and exams pages with improved UI elements and layout adjustments
Show full message
feat: ✨ enhance exam and exams pages with improved UI elements and layout adjustments
src/pages/exam-detail-page.tsxmodified+58 -49
@@ -182,22 +182,30 @@ function ExamDetailContent() {
182 <Show when={accessReady()} fallback={<PageSpinner />}>182 <Show when={accessReady()} fallback={<PageSpinner />}>
183 <Show when={canViewExam()} fallback={<Alert variant="destructive">{t("common.accessDenied")}</Alert>}>183 <Show when={canViewExam()} fallback={<Alert variant="destructive">{t("common.accessDenied")}</Alert>}>
184 <div class="space-y-6">184 <div class="space-y-6">
185- <PageHeader185+ <div class="space-y-2">
186- accent="rose"186+ <div class="flex flex-wrap items-center gap-1 text-xs text-muted-foreground">
187- eyebrow={t("exams.title")}187+ <span>{t("nav.group.classes")}</span>
188- title={ex().title}188+ <span>/</span>
189- description={ex().description || "—"}189+ <Link to="/exams" class="hover:text-foreground">{t("exams.title")}</Link>
190- actions={190+ <span>/</span>
191- <div class="flex w-full flex-wrap items-center gap-1 rounded-lg border bg-background/80 p-1 shadow-sm sm:w-auto">191+ <span class="truncate">{ex().title}</span>
192+ </div>
193+ <PageHeader
194+ accent="rose"
195+ eyebrow={t("exams.title")}
196+ title={ex().title}
197+ description={ex().description || "—"}
198+ actions={
199+ <div class="flex w-full flex-wrap items-center gap-1 rounded-lg border bg-card p-1 shadow-sm sm:w-auto">
192 <Link to="/exams">200 <Link to="/exams">
193- <Button variant="ghost" size="sm" class="w-full rounded-md sm:w-auto">201+ <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">
194 <IconChevronLeft class="h-4 w-4" />202 <IconChevronLeft class="h-4 w-4" />
195 {t("common.back")}203 {t("common.back")}
196 </Button>204 </Button>
197 </Link>205 </Link>
198 <Show when={!isFinished() && !isUpcoming() && isSittable()}>206 <Show when={!isFinished() && !isUpcoming() && isSittable()}>
199 <Link to="/exam-room/$id" params={{ id: id() }}>207 <Link to="/exam-room/$id" params={{ id: id() }}>
200- <Button size="sm" class="flex-1 rounded-md sm:flex-none">208+ <Button size="sm" class="flex-1 rounded-sm sm:flex-none">
201 <IconExam class="h-4 w-4" />209 <IconExam class="h-4 w-4" />
202 {t("attempt.openRoom")}210 {t("attempt.openRoom")}
203 </Button>211 </Button>
@@ -205,7 +213,7 @@ function ExamDetailContent() {
205 </Show>213 </Show>
206 <Show when={isTeacherPlus() && !isUpcoming() && isSittable()}>214 <Show when={isTeacherPlus() && !isUpcoming() && isSittable()}>
207 <Link to="/exams/$id/live" params={{ id: id() }}>215 <Link to="/exams/$id/live" params={{ id: id() }}>
208- <Button variant="outline" size="sm" class="flex-1 rounded-md sm:flex-none">216+ <Button variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none">
209 <IconEye class="h-4 w-4" />217 <IconEye class="h-4 w-4" />
210 {isFinished() ? t("exams.finalState") : t("exams.liveMonitor")}218 {isFinished() ? t("exams.finalState") : t("exams.liveMonitor")}
211 </Button>219 </Button>
@@ -217,7 +225,7 @@ function ExamDetailContent() {
217 type="button"225 type="button"
218 variant="outline"226 variant="outline"
219 size="sm"227 size="sm"
220- class="flex-1 rounded-md sm:flex-none"228+ class="flex-1 rounded-sm sm:flex-none"
221 onClick={() => setEditing(true)}229 onClick={() => setEditing(true)}
222 >230 >
223 <IconEdit class="h-4 w-4" />231 <IconEdit class="h-4 w-4" />
@@ -227,7 +235,7 @@ function ExamDetailContent() {
227 type="button"235 type="button"
228 variant="destructive"236 variant="destructive"
229 size="sm"237 size="sm"
230- class="flex-1 rounded-md sm:flex-none"238+ class="flex-1 rounded-sm sm:flex-none"
231 disabled={pending()}239 disabled={pending()}
232 onClick={() => setDeleteOpen(true)}240 onClick={() => setDeleteOpen(true)}
233 >241 >
@@ -237,8 +245,8 @@ function ExamDetailContent() {
237 </div>245 </div>
238 </Show>246 </Show>
239 </div>247 </div>
240- }248+ }
241- >249+ >
242 <div class="flex flex-wrap items-center gap-2 pt-1">250 <div class="flex flex-wrap items-center gap-2 pt-1">
243 <Badge variant="outline" class={cn(251 <Badge variant="outline" class={cn(
244 "rounded-sm capitalize",252 "rounded-sm capitalize",
@@ -266,7 +274,8 @@ function ExamDetailContent() {
266 {examModeLabel(ex().mode)}274 {examModeLabel(ex().mode)}
267 </Badge>275 </Badge>
268 </div>276 </div>
269- </PageHeader>277+ </PageHeader>
278+ </div>
270 279
271 <ConfirmDialog280 <ConfirmDialog
272 open={deleteOpen()}281 open={deleteOpen()}
@@ -300,30 +309,30 @@ function ExamDetailContent() {
300 />309 />
301 </FormDialog>310 </FormDialog>
302 311
303- <section class="surface-card space-y-4 p-5">312+ <section class="data-shell space-y-4 p-4">
304 <h2 class="font-display text-lg font-semibold">{t("exams.schedule")}</h2>313 <h2 class="font-display text-lg font-semibold">{t("exams.schedule")}</h2>
305 <div class="grid gap-3 text-sm sm:grid-cols-2 lg:grid-cols-4">314 <div class="grid gap-3 text-sm sm:grid-cols-2 lg:grid-cols-4">
306- <div class="rounded-lg border bg-background/60 p-3">315+ <div class="rounded-lg border bg-muted/25 p-3">
307- <p class="text-xs text-muted-foreground">{t("exams.mode")}</p>316+ <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.mode")}</p>
308 <p class="mt-1 font-medium">{examModeLabel(ex().mode)}</p>317 <p class="mt-1 font-medium">{examModeLabel(ex().mode)}</p>
309 </div>318 </div>
310- <div class="rounded-lg border bg-background/60 p-3">319+ <div class="rounded-lg border bg-muted/25 p-3">
311- <p class="text-xs text-muted-foreground">{t("events.starts")}</p>320+ <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.starts")}</p>
312- <p class="mt-1 font-medium">{formatDateTime(ex().starts_at, locale())}</p>321+ <p class="mono mt-1 font-medium">{formatDateTime(ex().starts_at, locale())}</p>
313 </div>322 </div>
314- <div class="rounded-lg border bg-background/60 p-3">323+ <div class="rounded-lg border bg-muted/25 p-3">
315- <p class="text-xs text-muted-foreground">{t("events.ends")}</p>324+ <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.ends")}</p>
316- <p class="mt-1 font-medium">{formatDateTime(ex().ends_at, locale())}</p>325+ <p class="mono mt-1 font-medium">{formatDateTime(ex().ends_at, locale())}</p>
317 </div>326 </div>
318- <div class="rounded-lg border bg-background/60 p-3">327+ <div class="rounded-lg border bg-muted/25 p-3">
319- <p class="text-xs text-muted-foreground">{t("exams.durationMinutes")}</p>328+ <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.durationMinutes")}</p>
320- <p class="mt-1 font-medium">{formatDurationMinutes(examDurationMs(ex().duration_ms, ex().starts_at, ex().ends_at), locale())}</p>329+ <p class="mono mt-1 font-medium">{formatDurationMinutes(examDurationMs(ex().duration_ms, ex().starts_at, ex().ends_at), locale())}</p>
321 </div>330 </div>
322 </div>331 </div>
323 </section>332 </section>
324 333
325 <Show when={!isTeacherPlus() && !isScheduled()}>334 <Show when={!isTeacherPlus() && !isScheduled()}>
326- <section class="surface-card p-6">335+ <section class="data-shell p-4">
327 <h2 class="font-display text-lg font-semibold">{t("exams.yourResult")}</h2>336 <h2 class="font-display text-lg font-semibold">{t("exams.yourResult")}</h2>
328 <div class="mt-4">337 <div class="mt-4">
329 <Suspense fallback={<PageSpinner />}>338 <Suspense fallback={<PageSpinner />}>
@@ -336,7 +345,7 @@ function ExamDetailContent() {
336 </Show>345 </Show>
337 346
338 <Show when={isTeacherPlus() && sheetUserId()}>347 <Show when={isTeacherPlus() && sheetUserId()}>
339- <section class="surface-card space-y-4 p-5">348+ <section class="data-shell space-y-4 p-4">
340 <h2 class="font-display text-lg font-semibold">{t("exams.answerSheet")} — {sheetUserId()}</h2>349 <h2 class="font-display text-lg font-semibold">{t("exams.answerSheet")} — {sheetUserId()}</h2>
341 <Suspense fallback={<PageSpinner />}>350 <Suspense fallback={<PageSpinner />}>
342 <AnswerSheetView examId={id()} userId={sheetUserId()!} />351 <AnswerSheetView examId={id()} userId={sheetUserId()!} />
@@ -345,27 +354,27 @@ function ExamDetailContent() {
345 </Show>354 </Show>
346 355
347 <Show when={isTeacherPlus()}>356 <Show when={isTeacherPlus()}>
348- <section class="surface-card space-y-4 p-5">357+ <section class="data-shell space-y-4 p-4">
349 <h2 class="font-display text-lg font-semibold">{t("exams.statistics")}</h2>358 <h2 class="font-display text-lg font-semibold">{t("exams.statistics")}</h2>
350 <Suspense fallback={<PageSpinner />}>359 <Suspense fallback={<PageSpinner />}>
351 <Show when={stats()}>360 <Show when={stats()}>
352 {(s) => (361 {(s) => (
353 <div class="grid gap-3 text-sm sm:grid-cols-4">362 <div class="grid gap-3 text-sm sm:grid-cols-4">
354- <div class="rounded-lg border bg-background/60 p-3">363+ <div class="rounded-lg border bg-muted/25 p-3">
355- <p class="text-xs text-muted-foreground">{t("exams.graded")}</p>364+ <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.graded")}</p>
356- <p class="mt-1 font-display text-2xl font-semibold tabular-nums">{s().graded}</p>365+ <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().graded}</p>
357 </div>366 </div>
358- <div class="rounded-lg border bg-background/60 p-3">367+ <div class="rounded-lg border bg-muted/25 p-3">
359- <p class="text-xs text-muted-foreground">{t("exams.average")}</p>368+ <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.average")}</p>
360- <p class="mt-1 font-display text-2xl font-semibold tabular-nums">{s().average == null ? "—" : s().average}</p>369+ <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().average == null ? "—" : s().average}</p>
361 </div>370 </div>
362- <div class="rounded-lg border bg-background/60 p-3">371+ <div class="rounded-lg border bg-muted/25 p-3">
363- <p class="text-xs text-muted-foreground">{t("exams.min")}</p>372+ <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.min")}</p>
364- <p class="mt-1 font-display text-2xl font-semibold tabular-nums">{s().min == null ? "—" : s().min}</p>373+ <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().min == null ? "—" : s().min}</p>
365 </div>374 </div>
366- <div class="rounded-lg border bg-background/60 p-3">375+ <div class="rounded-lg border bg-muted/25 p-3">
367- <p class="text-xs text-muted-foreground">{t("exams.max")}</p>376+ <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.max")}</p>
368- <p class="mt-1 font-display text-2xl font-semibold tabular-nums">{s().max == null ? "—" : s().max}</p>377+ <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().max == null ? "—" : s().max}</p>
369 </div>378 </div>
370 </div>379 </div>
371 )}380 )}
@@ -376,7 +385,7 @@ function ExamDetailContent() {
376 <ExamQuestionsPanel examId={id()} readOnly={isFinished() || isUpcoming()} />385 <ExamQuestionsPanel examId={id()} readOnly={isFinished() || isUpcoming()} />
377 386
378 <Show when={!isFinished()}>387 <Show when={!isFinished()}>
379- <section class="surface-card space-y-4 p-5">388+ <section class="data-shell space-y-4 p-4">
380 <h2 class="font-display text-lg font-semibold">{t("exams.gradeStudent")}</h2>389 <h2 class="font-display text-lg font-semibold">{t("exams.gradeStudent")}</h2>
381 <GradeForm390 <GradeForm
382 students={gradeStudents()}391 students={gradeStudents()}
@@ -388,7 +397,7 @@ function ExamDetailContent() {
388 </section>397 </section>
389 </Show>398 </Show>
390 399
391- <section class="surface-card space-y-4 p-5">400+ <section class="data-shell space-y-4 p-4">
392 <h2 class="font-display text-lg font-semibold">{t("exams.results")}</h2>401 <h2 class="font-display text-lg font-semibold">{t("exams.results")}</h2>
393 <Suspense fallback={<PageSpinner />}>402 <Suspense fallback={<PageSpinner />}>
394 <Show403 <Show
@@ -399,8 +408,8 @@ function ExamDetailContent() {
399 </p>408 </p>
400 }409 }
401 >410 >
402- <div class="overflow-hidden rounded-lg border border-border/70 bg-background/60">411+ <div class="data-table-wrap">
403- <Table>412+ <Table class="data-table">
404 <TableHeader>413 <TableHeader>
405 <TableRow>414 <TableRow>
406 <TableHead>{t("events.userId")}</TableHead>415 <TableHead>{t("events.userId")}</TableHead>
@@ -415,7 +424,7 @@ function ExamDetailContent() {
415 <TableBody>424 <TableBody>
416 <For each={results() ?? []}>425 <For each={results() ?? []}>
417 {(row) => (426 {(row) => (
418- <TableRow class="h-12">427+ <TableRow>
419 <TableCell class="font-medium">{personLabel(row.user)}</TableCell>428 <TableCell class="font-medium">{personLabel(row.user)}</TableCell>
420 <TableCell>429 <TableCell>
421 <ExamResultBadge mark={row.mark} />430 <ExamResultBadge mark={row.mark} />
@@ -426,7 +435,7 @@ function ExamDetailContent() {
426 type="button"435 type="button"
427 variant="ghost"436 variant="ghost"
428 size="sm"437 size="sm"
429- class="rounded-md"438+ class="h-7 rounded-sm"
430 onClick={() => {439 onClick={() => {
431 const rowUserId = personId(row.user);440 const rowUserId = personId(row.user);
432 setSheetUserId(sheetUserId() === rowUserId ? null : rowUserId);441 setSheetUserId(sheetUserId() === rowUserId ? null : rowUserId);
@@ -441,7 +450,7 @@ function ExamDetailContent() {
441 type="button"450 type="button"
442 variant="ghost"451 variant="ghost"
443 size="sm"452 size="sm"
444- class="text-destructive hover:bg-destructive/10 hover:text-destructive"453+ class="h-7 rounded-sm text-destructive hover:bg-destructive/10 hover:text-destructive"
445 onClick={() => setRemoveUserId(personId(row.user))}454 onClick={() => setRemoveUserId(personId(row.user))}
446 >455 >
447 <IconTrash class="h-4 w-4" />456 <IconTrash class="h-4 w-4" />
src/pages/exams-page.tsxmodified+20 -13
@@ -80,15 +80,22 @@ function ExamsContent() {
80 80
81 return (81 return (
82 <div class="space-y-6">82 <div class="space-y-6">
83- <PageHeader83+ <div class="space-y-2">
84- accent="rose"84+ <div class="flex flex-wrap items-center gap-1 text-xs text-muted-foreground">
85- eyebrow={t("nav.exams")}85+ <span>{t("nav.group.classes")}</span>
86- title={t("exams.title")}86+ <span>/</span>
87- description={t("exams.subtitle")}87+ <span>{t("nav.exams")}</span>
88- />88+ </div>
89+ <PageHeader
90+ accent="rose"
91+ eyebrow={t("nav.exams")}
92+ title={t("exams.title")}
93+ description={t("exams.subtitle")}
94+ />
95+ </div>
89 96
90 <Show when={canCreate()}>97 <Show when={canCreate()}>
91- <p class="rounded-md border bg-muted/30 px-4 py-3 text-sm text-muted-foreground">98+ <p class="data-shell px-4 py-3 text-sm text-muted-foreground">
92 {t("exams.mustBelongCourse")}{" "}99 {t("exams.mustBelongCourse")}{" "}
93 <Link to="/courses" class="font-medium text-primary underline-offset-4 hover:underline">100 <Link to="/courses" class="font-medium text-primary underline-offset-4 hover:underline">
94 {t("nav.courses")}101 {t("nav.courses")}
@@ -109,7 +116,7 @@ function ExamsContent() {
109 </div>116 </div>
110 }117 }
111 >118 >
112- <div class="space-y-4">119+ <div class="space-y-3">
113 <For each={courseSections()}>120 <For each={courseSections()}>
114 {(section) => {121 {(section) => {
115 const isOpen = () => openCourse() === section.id;122 const isOpen = () => openCourse() === section.id;
@@ -120,11 +127,11 @@ function ExamsContent() {
120 return section.exams.slice(start, start + EXAM_PAGE_SIZE);127 return section.exams.slice(start, start + EXAM_PAGE_SIZE);
121 };128 };
122 return (129 return (
123- <section class="surface-card overflow-hidden">130+ <section class="data-shell overflow-hidden">
124 <button131 <button
125 type="button"132 type="button"
126 onClick={() => toggleCourse(section.id)}133 onClick={() => toggleCourse(section.id)}
127- class="flex w-full items-center justify-between gap-3 bg-gradient-to-r from-rose-500/10 via-transparent to-transparent px-5 py-4 text-left transition-colors hover:bg-muted/30"134+ class="flex w-full items-center justify-between gap-3 bg-muted/35 px-4 py-3 text-left transition-colors hover:bg-muted/60"
128 >135 >
129 <div class="flex items-center gap-3">136 <div class="flex items-center gap-3">
130 <IconChevronRight137 <IconChevronRight
@@ -132,11 +139,11 @@ function ExamsContent() {
132 />139 />
133 <h2 class="font-display text-base font-semibold">{section.title}</h2>140 <h2 class="font-display text-base font-semibold">{section.title}</h2>
134 </div>141 </div>
135- <Badge variant="outline" class="rounded-sm">{section.exams.length}</Badge>142+ <Badge variant="outline" class="mono rounded-sm">{section.exams.length}</Badge>
136 </button>143 </button>
137 <Show when={isOpen()}>144 <Show when={isOpen()}>
138- <div class="space-y-4 border-t border-border/50 px-5 pb-5 pt-4">145+ <div class="space-y-4 border-t border-border px-4 pb-4 pt-4">
139- <ul class="grid gap-4 sm:grid-cols-2 xl:grid-cols-3">146+ <ul class="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
140 <For each={pageItems()}>147 <For each={pageItems()}>
141 {(exam) => (148 {(exam) => (
142 <li>149 <li>