forge
Explore
Log in

Don't you dare go Hollow

🔧 event/exam detail page header nesting, attendance disclosure

Browse files at this commit

3f5523c963bc31389e078ddb1fc0a94e188030b7Burak BoduroğluParent: a97ceab
  • fix
    • 🔧 event/exam detail page header nesting, attendance disclosure
Show full message
fix: 🔧 event/exam detail page header nesting, attendance disclosure
- event-detail: fixed PageHeader description, moved audience badge outside
  header, wrapped student attendance in SectionDisclosure
- exam-detail: fixed PageHeader nesting (badges were inside header tags),
  schedule disclosure default to closed
src/pages/event-detail-page.tsxmodified+34 -45
@@ -59,6 +59,7 @@ function EventDetailContent() {
5959 const [otherUserId, setOtherUserId] = createSignal("");
6060 const [editing, setEditing] = createSignal(false);
6161 const [deleteOpen, setDeleteOpen] = createSignal(false);
62+ const [studentAttendanceOpen, setStudentAttendanceOpen] = createSignal(false);
6263 const [attendanceOpen, setAttendanceOpen] = createSignal(false);
6364 const [error, setError] = createSignal("");
6465 const [pending, setPending] = createSignal(false);
@@ -116,48 +117,35 @@ function EventDetailContent() {
116117 accent="sky"
117118 eyebrow={t("events.title")}
118119 title={ev().title}
119- description={`${formatDateTime(ev().starts_at, locale())} → ${formatDateTime(ev().ends_at, locale())}`}
120+ description={`${formatDateTime(ev().starts_at, locale())} - ${formatDateTime(ev().ends_at, locale())}${ev().description ? ` - ${ev().description}` : ""}`}
120121 actions={
121122 <div class="detail-action-group">
122- <Link to="/events">
123- <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">
124- <IconChevronLeft class="h-4 w-4" />
125- {t("common.back")}
126- </Button>
127- </Link>
128- <Show when={canManage()}>
129- <div class="detail-action-divider">
130- <Button
131- type="button"
132- variant="outline"
133- size="sm"
134- class="flex-1 rounded-sm sm:flex-none"
135- onClick={() => setEditing(true)}
136- >
137- <IconEdit class="h-4 w-4" />
138- {t("common.edit")}
123+ <Link to="/events">
124+ <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">
125+ <IconChevronLeft class="h-4 w-4" />
126+ {t("common.back")}
139127 </Button>
140- <Button
141- type="button"
142- variant="destructive"
143- size="sm"
144- class="flex-1 rounded-sm sm:flex-none"
145- disabled={pending()}
146- onClick={() => setDeleteOpen(true)}
147- >
148- <IconTrash class="h-4 w-4" />
149- {t("common.delete")}
150- </Button>
151- </div>
152- </Show>
153- </div>
128+ </Link>
129+ <Show when={canManage()}>
130+ <div class="detail-action-divider">
131+ <Button type="button" variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none" onClick={() => setEditing(true)}>
132+ <IconEdit class="h-4 w-4" />
133+ {t("common.edit")}
134+ </Button>
135+ <Button type="button" variant="destructive" size="sm" class="flex-1 rounded-sm sm:flex-none" disabled={pending()} onClick={() => setDeleteOpen(true)}>
136+ <IconTrash class="h-4 w-4" />
137+ {t("common.delete")}
138+ </Button>
139+ </div>
140+ </Show>
141+ </div>
154142 }
155- >
156- <p class="mt-3 max-w-2xl whitespace-pre-wrap text-sm text-muted-foreground">
157- {ev().description || "—"}
158- </p>
159- <p class="mt-2 text-xs font-medium text-muted-foreground">{audienceLabel(ev().audience, t)}</p>
160- </PageHeader>
143+ />
144+ <div class="flex flex-wrap gap-2">
145+ <span class="inline-flex items-center rounded-sm border border-border px-2.5 py-0.5 text-xs font-semibold text-muted-foreground">
146+ {audienceLabel(ev().audience, t)}
147+ </span>
148+ </div>
161149 </div>
162150
163151 <ConfirmDialog
@@ -201,12 +189,13 @@ function EventDetailContent() {
201189 </SidePanel>
202190
203191 <Show when={isTeacherPlus()}>
204- <section class="data-shell p-4">
205- <div>
206- <h2 class="font-display text-lg font-semibold">{t("events.studentAttendance")}</h2>
207- <p class="mt-1 text-sm text-muted-foreground">{t("events.studentAttendanceHelp")}</p>
208- </div>
209- <div class="mt-4 grid gap-3">
192+ <SectionDisclosure
193+ open={studentAttendanceOpen()}
194+ onToggle={() => setStudentAttendanceOpen((open) => !open)}
195+ title={t("events.studentAttendance")}
196+ description={t("events.studentAttendanceHelp")}
197+ >
198+ <div class="grid gap-3">
210199 <UserSearchSelect
211200 id="other-user"
212201 label={t("events.attendee")}
@@ -245,7 +234,7 @@ function EventDetailContent() {
245234 {t("events.saveStudentAttendance")}
246235 </Button>
247236 </div>
248- </section>
237+ </SectionDisclosure>
249238 </Show>
250239
251240 <Show when={flash()}>
src/pages/exam-detail-page.tsxmodified+36 -50
@@ -84,7 +84,7 @@ function ExamDetailContent() {
8484 const [sheetUserId, setSheetUserId] = createSignal<string | null>(null);
8585 const [gradeOpen, setGradeOpen] = createSignal(false);
8686 const [openSections, setOpenSections] = createSignal({
87- schedule: true,
87+ schedule: false,
8888 ownResult: false,
8989 answerSheet: false,
9090 statistics: false,
@@ -272,57 +272,44 @@ function ExamDetailContent() {
272272 description={ex().description || "—"}
273273 actions={
274274 <div class="detail-action-group">
275- <Link to="/exams">
276- <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">
277- <IconChevronLeft class="h-4 w-4" />
278- {t("common.back")}
279- </Button>
280- </Link>
281- <Show when={isStudent() && !isDraft() && !isFinished() && !isUpcoming() && isSittable()}>
282- <Link to="/exam-room/$id" params={{ id: id() }}>
283- <Button size="sm" class="flex-1 rounded-sm sm:flex-none">
284- <IconExam class="h-4 w-4" />
285- {t("attempt.openRoom")}
275+ <Link to="/exams">
276+ <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">
277+ <IconChevronLeft class="h-4 w-4" />
278+ {t("common.back")}
286279 </Button>
287280 </Link>
288- </Show>
289- <Show when={hasCourseManagementRights() && !isDraft() && !isUpcoming() && isSittable()}>
290- <Link to="/exams/$id/live" params={{ id: id() }}>
291- <Button variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none">
292- <IconEye class="h-4 w-4" />
293- {isFinished() ? t("exams.finalState") : t("exams.liveMonitor")}
294- </Button>
295- </Link>
296- </Show>
297- <Show when={canManage()}>
298- <div class="detail-action-divider">
299- <Button
300- type="button"
301- variant="outline"
302- size="sm"
303- class="flex-1 rounded-sm sm:flex-none"
304- onClick={() => setEditing(true)}
305- >
306- <IconEdit class="h-4 w-4" />
307- {t("common.edit")}
308- </Button>
309- <Button
310- type="button"
311- variant="destructive"
312- size="sm"
313- class="flex-1 rounded-sm sm:flex-none"
314- disabled={pending()}
315- onClick={() => setDeleteOpen(true)}
316- >
317- <IconTrash class="h-4 w-4" />
318- {t("common.delete")}
319- </Button>
320- </div>
321- </Show>
322- </div>
281+ <Show when={isStudent() && !isDraft() && !isFinished() && !isUpcoming() && isSittable()}>
282+ <Link to="/exam-room/$id" params={{ id: id() }}>
283+ <Button size="sm" class="flex-1 rounded-sm sm:flex-none">
284+ <IconExam class="h-4 w-4" />
285+ {t("attempt.openRoom")}
286+ </Button>
287+ </Link>
288+ </Show>
289+ <Show when={hasCourseManagementRights() && !isDraft() && !isUpcoming() && isSittable()}>
290+ <Link to="/exams/$id/live" params={{ id: id() }}>
291+ <Button variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none">
292+ <IconEye class="h-4 w-4" />
293+ {isFinished() ? t("exams.finalState") : t("exams.liveMonitor")}
294+ </Button>
295+ </Link>
296+ </Show>
297+ <Show when={canManage()}>
298+ <div class="detail-action-divider">
299+ <Button type="button" variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none" onClick={() => setEditing(true)}>
300+ <IconEdit class="h-4 w-4" />
301+ {t("common.edit")}
302+ </Button>
303+ <Button type="button" variant="destructive" size="sm" class="flex-1 rounded-sm sm:flex-none" disabled={pending()} onClick={() => setDeleteOpen(true)}>
304+ <IconTrash class="h-4 w-4" />
305+ {t("common.delete")}
306+ </Button>
307+ </div>
308+ </Show>
309+ </div>
323310 }
324- >
325- <div class="flex flex-wrap items-center gap-2 pt-1">
311+ />
312+ <div class="flex flex-wrap items-center gap-2">
326313 <Badge
327314 variant="outline"
328315 class={cn(
@@ -367,7 +354,6 @@ function ExamDetailContent() {
367354 <Badge variant="secondary" class="rounded-sm">{t("exams.draft")}</Badge>
368355 </Show>
369356 </div>
370- </PageHeader>
371357 </div>
372358
373359 <ConfirmDialog