🔧 event/exam detail page header nesting, attendance disclosure
Browse files at this commit3f5523c963bc31389e078ddb1fc0a94e188030b7Parent: a97ceab- fix
- 🔧 event/exam detail page header nesting, attendance disclosure
2 changed files +70 -95
- src/pages/event-detail-page.tsx +34 -45
- src/pages/exam-detail-page.tsx +36 -50
src/pages/event-detail-page.tsxmodified+34 -45
| @@ -59,6 +59,7 @@ function EventDetailContent() { | ||
| 59 | 59 | const [otherUserId, setOtherUserId] = createSignal(""); |
| 60 | 60 | const [editing, setEditing] = createSignal(false); |
| 61 | 61 | const [deleteOpen, setDeleteOpen] = createSignal(false); |
| 62 | + const [studentAttendanceOpen, setStudentAttendanceOpen] = createSignal(false); | |
| 62 | 63 | const [attendanceOpen, setAttendanceOpen] = createSignal(false); |
| 63 | 64 | const [error, setError] = createSignal(""); |
| 64 | 65 | const [pending, setPending] = createSignal(false); |
| @@ -116,48 +117,35 @@ function EventDetailContent() { | ||
| 116 | 117 | accent="sky" |
| 117 | 118 | eyebrow={t("events.title")} |
| 118 | 119 | 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}` : ""}`} | |
| 120 | 121 | actions={ |
| 121 | 122 | <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")} | |
| 139 | 127 | </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> | |
| 154 | 142 | } |
| 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> | |
| 161 | 149 | </div> |
| 162 | 150 | |
| 163 | 151 | <ConfirmDialog |
| @@ -201,12 +189,13 @@ function EventDetailContent() { | ||
| 201 | 189 | </SidePanel> |
| 202 | 190 | |
| 203 | 191 | <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"> | |
| 210 | 199 | <UserSearchSelect |
| 211 | 200 | id="other-user" |
| 212 | 201 | label={t("events.attendee")} |
| @@ -245,7 +234,7 @@ function EventDetailContent() { | ||
| 245 | 234 | {t("events.saveStudentAttendance")} |
| 246 | 235 | </Button> |
| 247 | 236 | </div> |
| 248 | - </section> | |
| 237 | + </SectionDisclosure> | |
| 249 | 238 | </Show> |
| 250 | 239 | |
| 251 | 240 | <Show when={flash()}> |
src/pages/exam-detail-page.tsxmodified+36 -50
| @@ -84,7 +84,7 @@ function ExamDetailContent() { | ||
| 84 | 84 | const [sheetUserId, setSheetUserId] = createSignal<string | null>(null); |
| 85 | 85 | const [gradeOpen, setGradeOpen] = createSignal(false); |
| 86 | 86 | const [openSections, setOpenSections] = createSignal({ |
| 87 | - schedule: true, | |
| 87 | + schedule: false, | |
| 88 | 88 | ownResult: false, |
| 89 | 89 | answerSheet: false, |
| 90 | 90 | statistics: false, |
| @@ -272,57 +272,44 @@ function ExamDetailContent() { | ||
| 272 | 272 | description={ex().description || "—"} |
| 273 | 273 | actions={ |
| 274 | 274 | <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")} | |
| 286 | 279 | </Button> |
| 287 | 280 | </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> | |
| 323 | 310 | } |
| 324 | - > | |
| 325 | - <div class="flex flex-wrap items-center gap-2 pt-1"> | |
| 311 | + /> | |
| 312 | + <div class="flex flex-wrap items-center gap-2"> | |
| 326 | 313 | <Badge |
| 327 | 314 | variant="outline" |
| 328 | 315 | class={cn( |
| @@ -367,7 +354,6 @@ function ExamDetailContent() { | ||
| 367 | 354 | <Badge variant="secondary" class="rounded-sm">{t("exams.draft")}</Badge> |
| 368 | 355 | </Show> |
| 369 | 356 | </div> |
| 370 | - </PageHeader> | |
| 371 | 357 | </div> |
| 372 | 358 | |
| 373 | 359 | <ConfirmDialog |