🔧 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 | const [otherUserId, setOtherUserId] = createSignal(""); | 59 | const [otherUserId, setOtherUserId] = createSignal(""); |
| 60 | const [editing, setEditing] = createSignal(false); | 60 | const [editing, setEditing] = createSignal(false); |
| 61 | const [deleteOpen, setDeleteOpen] = createSignal(false); | 61 | const [deleteOpen, setDeleteOpen] = createSignal(false); |
| 62 | + const [studentAttendanceOpen, setStudentAttendanceOpen] = createSignal(false); | ||
| 62 | const [attendanceOpen, setAttendanceOpen] = createSignal(false); | 63 | const [attendanceOpen, setAttendanceOpen] = createSignal(false); |
| 63 | const [error, setError] = createSignal(""); | 64 | const [error, setError] = createSignal(""); |
| 64 | const [pending, setPending] = createSignal(false); | 65 | const [pending, setPending] = createSignal(false); |
| @@ -116,48 +117,35 @@ function EventDetailContent() { | |||
| 116 | accent="sky" | 117 | accent="sky" |
| 117 | eyebrow={t("events.title")} | 118 | eyebrow={t("events.title")} |
| 118 | title={ev().title} | 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 | actions={ | 121 | actions={ |
| 121 | <div class="detail-action-group"> | 122 | <div class="detail-action-group"> |
| 122 | - <Link to="/events"> | 123 | + <Link to="/events"> |
| 123 | - <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto"> | 124 | + <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto"> |
| 124 | - <IconChevronLeft class="h-4 w-4" /> | 125 | + <IconChevronLeft class="h-4 w-4" /> |
| 125 | - {t("common.back")} | 126 | + {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")} | ||
| 139 | </Button> | 127 | </Button> |
| 140 | - <Button | 128 | + </Link> |
| 141 | - type="button" | 129 | + <Show when={canManage()}> |
| 142 | - variant="destructive" | 130 | + <div class="detail-action-divider"> |
| 143 | - size="sm" | 131 | + <Button type="button" variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none" onClick={() => setEditing(true)}> |
| 144 | - class="flex-1 rounded-sm sm:flex-none" | 132 | + <IconEdit class="h-4 w-4" /> |
| 145 | - disabled={pending()} | 133 | + {t("common.edit")} |
| 146 | - onClick={() => setDeleteOpen(true)} | 134 | + </Button> |
| 147 | - > | 135 | + <Button type="button" variant="destructive" size="sm" class="flex-1 rounded-sm sm:flex-none" disabled={pending()} onClick={() => setDeleteOpen(true)}> |
| 148 | - <IconTrash class="h-4 w-4" /> | 136 | + <IconTrash class="h-4 w-4" /> |
| 149 | - {t("common.delete")} | 137 | + {t("common.delete")} |
| 150 | - </Button> | 138 | + </Button> |
| 151 | - </div> | 139 | + </div> |
| 152 | - </Show> | 140 | + </Show> |
| 153 | - </div> | 141 | + </div> |
| 154 | } | 142 | } |
| 155 | - > | 143 | + /> |
| 156 | - <p class="mt-3 max-w-2xl whitespace-pre-wrap text-sm text-muted-foreground"> | 144 | + <div class="flex flex-wrap gap-2"> |
| 157 | - {ev().description || "—"} | 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"> |
| 158 | - </p> | 146 | + {audienceLabel(ev().audience, t)} |
| 159 | - <p class="mt-2 text-xs font-medium text-muted-foreground">{audienceLabel(ev().audience, t)}</p> | 147 | + </span> |
| 160 | - </PageHeader> | 148 | + </div> |
| 161 | </div> | 149 | </div> |
| 162 | 150 | ||
| 163 | <ConfirmDialog | 151 | <ConfirmDialog |
| @@ -201,12 +189,13 @@ function EventDetailContent() { | |||
| 201 | </SidePanel> | 189 | </SidePanel> |
| 202 | 190 | ||
| 203 | <Show when={isTeacherPlus()}> | 191 | <Show when={isTeacherPlus()}> |
| 204 | - <section class="data-shell p-4"> | 192 | + <SectionDisclosure |
| 205 | - <div> | 193 | + open={studentAttendanceOpen()} |
| 206 | - <h2 class="font-display text-lg font-semibold">{t("events.studentAttendance")}</h2> | 194 | + onToggle={() => setStudentAttendanceOpen((open) => !open)} |
| 207 | - <p class="mt-1 text-sm text-muted-foreground">{t("events.studentAttendanceHelp")}</p> | 195 | + title={t("events.studentAttendance")} |
| 208 | - </div> | 196 | + description={t("events.studentAttendanceHelp")} |
| 209 | - <div class="mt-4 grid gap-3"> | 197 | + > |
| 198 | + <div class="grid gap-3"> | ||
| 210 | <UserSearchSelect | 199 | <UserSearchSelect |
| 211 | id="other-user" | 200 | id="other-user" |
| 212 | label={t("events.attendee")} | 201 | label={t("events.attendee")} |
| @@ -245,7 +234,7 @@ function EventDetailContent() { | |||
| 245 | {t("events.saveStudentAttendance")} | 234 | {t("events.saveStudentAttendance")} |
| 246 | </Button> | 235 | </Button> |
| 247 | </div> | 236 | </div> |
| 248 | - </section> | 237 | + </SectionDisclosure> |
| 249 | </Show> | 238 | </Show> |
| 250 | 239 | ||
| 251 | <Show when={flash()}> | 240 | <Show when={flash()}> |
src/pages/exam-detail-page.tsxmodified+36 -50
| @@ -84,7 +84,7 @@ function ExamDetailContent() { | |||
| 84 | const [sheetUserId, setSheetUserId] = createSignal<string | null>(null); | 84 | const [sheetUserId, setSheetUserId] = createSignal<string | null>(null); |
| 85 | const [gradeOpen, setGradeOpen] = createSignal(false); | 85 | const [gradeOpen, setGradeOpen] = createSignal(false); |
| 86 | const [openSections, setOpenSections] = createSignal({ | 86 | const [openSections, setOpenSections] = createSignal({ |
| 87 | - schedule: true, | 87 | + schedule: false, |
| 88 | ownResult: false, | 88 | ownResult: false, |
| 89 | answerSheet: false, | 89 | answerSheet: false, |
| 90 | statistics: false, | 90 | statistics: false, |
| @@ -272,57 +272,44 @@ function ExamDetailContent() { | |||
| 272 | description={ex().description || "—"} | 272 | description={ex().description || "—"} |
| 273 | actions={ | 273 | actions={ |
| 274 | <div class="detail-action-group"> | 274 | <div class="detail-action-group"> |
| 275 | - <Link to="/exams"> | 275 | + <Link to="/exams"> |
| 276 | - <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto"> | 276 | + <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto"> |
| 277 | - <IconChevronLeft class="h-4 w-4" /> | 277 | + <IconChevronLeft class="h-4 w-4" /> |
| 278 | - {t("common.back")} | 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")} | ||
| 286 | </Button> | 279 | </Button> |
| 287 | </Link> | 280 | </Link> |
| 288 | - </Show> | 281 | + <Show when={isStudent() && !isDraft() && !isFinished() && !isUpcoming() && isSittable()}> |
| 289 | - <Show when={hasCourseManagementRights() && !isDraft() && !isUpcoming() && isSittable()}> | 282 | + <Link to="/exam-room/$id" params={{ id: id() }}> |
| 290 | - <Link to="/exams/$id/live" params={{ id: id() }}> | 283 | + <Button size="sm" class="flex-1 rounded-sm sm:flex-none"> |
| 291 | - <Button variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none"> | 284 | + <IconExam class="h-4 w-4" /> |
| 292 | - <IconEye class="h-4 w-4" /> | 285 | + {t("attempt.openRoom")} |
| 293 | - {isFinished() ? t("exams.finalState") : t("exams.liveMonitor")} | 286 | + </Button> |
| 294 | - </Button> | 287 | + </Link> |
| 295 | - </Link> | 288 | + </Show> |
| 296 | - </Show> | 289 | + <Show when={hasCourseManagementRights() && !isDraft() && !isUpcoming() && isSittable()}> |
| 297 | - <Show when={canManage()}> | 290 | + <Link to="/exams/$id/live" params={{ id: id() }}> |
| 298 | - <div class="detail-action-divider"> | 291 | + <Button variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none"> |
| 299 | - <Button | 292 | + <IconEye class="h-4 w-4" /> |
| 300 | - type="button" | 293 | + {isFinished() ? t("exams.finalState") : t("exams.liveMonitor")} |
| 301 | - variant="outline" | 294 | + </Button> |
| 302 | - size="sm" | 295 | + </Link> |
| 303 | - class="flex-1 rounded-sm sm:flex-none" | 296 | + </Show> |
| 304 | - onClick={() => setEditing(true)} | 297 | + <Show when={canManage()}> |
| 305 | - > | 298 | + <div class="detail-action-divider"> |
| 306 | - <IconEdit class="h-4 w-4" /> | 299 | + <Button type="button" variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none" onClick={() => setEditing(true)}> |
| 307 | - {t("common.edit")} | 300 | + <IconEdit class="h-4 w-4" /> |
| 308 | - </Button> | 301 | + {t("common.edit")} |
| 309 | - <Button | 302 | + </Button> |
| 310 | - type="button" | 303 | + <Button type="button" variant="destructive" size="sm" class="flex-1 rounded-sm sm:flex-none" disabled={pending()} onClick={() => setDeleteOpen(true)}> |
| 311 | - variant="destructive" | 304 | + <IconTrash class="h-4 w-4" /> |
| 312 | - size="sm" | 305 | + {t("common.delete")} |
| 313 | - class="flex-1 rounded-sm sm:flex-none" | 306 | + </Button> |
| 314 | - disabled={pending()} | 307 | + </div> |
| 315 | - onClick={() => setDeleteOpen(true)} | 308 | + </Show> |
| 316 | - > | 309 | + </div> |
| 317 | - <IconTrash class="h-4 w-4" /> | ||
| 318 | - {t("common.delete")} | ||
| 319 | - </Button> | ||
| 320 | - </div> | ||
| 321 | - </Show> | ||
| 322 | - </div> | ||
| 323 | } | 310 | } |
| 324 | - > | 311 | + /> |
| 325 | - <div class="flex flex-wrap items-center gap-2 pt-1"> | 312 | + <div class="flex flex-wrap items-center gap-2"> |
| 326 | <Badge | 313 | <Badge |
| 327 | variant="outline" | 314 | variant="outline" |
| 328 | class={cn( | 315 | class={cn( |
| @@ -367,7 +354,6 @@ function ExamDetailContent() { | |||
| 367 | <Badge variant="secondary" class="rounded-sm">{t("exams.draft")}</Badge> | 354 | <Badge variant="secondary" class="rounded-sm">{t("exams.draft")}</Badge> |
| 368 | </Show> | 355 | </Show> |
| 369 | </div> | 356 | </div> |
| 370 | - </PageHeader> | ||
| 371 | </div> | 357 | </div> |
| 372 | 358 | ||
| 373 | <ConfirmDialog | 359 | <ConfirmDialog |