🛟 the unsaved-input guard covers every form panel
Browse files at this commitb507ba2a89bc29ad7e3ffeeca5d0e9c360fcc701Parent: 1747ea7- feat
- 🛟 the unsaved-input guard covers every form panel
29 changed files +37 -37
- src/components/builder/create-school-panel.tsx +1 -1
- src/components/builder/school-admin-access-panel.tsx +1 -1
- src/components/classes/blueprint-panel.tsx +1 -1
- src/components/courses/course-notes-panel.tsx +1 -1
- src/components/courses/course-subjects-panel.tsx +1 -1
- src/components/homework/course-homework-panel.tsx +1 -1
- src/components/homework/homework-submissions-panel.tsx +1 -1
- src/components/notes/note-card.tsx +1 -1
- src/components/sessions/course-sessions-panel.tsx +1 -1
- src/components/users/create-user-panel.tsx +1 -1
- src/pages/academic-years-page.tsx +2 -2
- src/pages/admin-user-detail-page.tsx +1 -1
- src/pages/appointments-page.tsx +3 -3
- src/pages/bank-question-detail-page.tsx +1 -1
- src/pages/builder-school-detail-page.tsx +1 -1
- src/pages/class-detail-page.tsx +2 -2
- src/pages/course-detail-page.tsx +1 -1
- src/pages/courses-page.tsx +1 -1
- src/pages/event-detail-page.tsx +1 -1
- src/pages/events-page.tsx +1 -1
- src/pages/exam-detail-page.tsx +2 -2
- src/pages/homework-page.tsx +1 -1
- src/pages/meal-detail-page.tsx +2 -2
- src/pages/payments-page.tsx +3 -3
- src/pages/profile-page.tsx +1 -1
- src/pages/question-bank-page.tsx +1 -1
- src/pages/staff-work-page.tsx +1 -1
- src/pages/terms-page.tsx +1 -1
- src/pages/whiteboards-page.tsx +1 -1
src/components/builder/create-school-panel.tsxmodified+1 -1
| @@ -68,7 +68,7 @@ export function CreateSchoolPanel(props: { open: boolean; onOpenChange: (open: b | ||
| 68 | 68 | }; |
| 69 | 69 | |
| 70 | 70 | return ( |
| 71 | - <SidePanel | |
| 71 | + <SidePanel guardUnsaved | |
| 72 | 72 | size="wide" |
| 73 | 73 | open={props.open} |
| 74 | 74 | onOpenChange={(open) => { |
src/components/builder/school-admin-access-panel.tsxmodified+1 -1
| @@ -56,7 +56,7 @@ export function SchoolAdminAccessPanel(props: { | ||
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | 58 | return ( |
| 59 | - <SidePanel | |
| 59 | + <SidePanel guardUnsaved | |
| 60 | 60 | open={props.mode != null} |
| 61 | 61 | onOpenChange={(open) => { |
| 62 | 62 | if (!open) { |
src/components/classes/blueprint-panel.tsxmodified+1 -1
| @@ -101,7 +101,7 @@ export function BlueprintPanel(props: { | ||
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | 103 | return ( |
| 104 | - <SidePanel | |
| 104 | + <SidePanel guardUnsaved | |
| 105 | 105 | open={props.open} |
| 106 | 106 | onOpenChange={props.onOpenChange} |
| 107 | 107 | title={editing() ? t("classBlueprints.edit") : t("classBlueprints.new")} |
src/components/courses/course-notes-panel.tsxmodified+1 -1
| @@ -67,7 +67,7 @@ export function CourseNotesPanel(props: { | ||
| 67 | 67 | </Show> |
| 68 | 68 | |
| 69 | 69 | <Show when={props.canManage}> |
| 70 | - <SidePanel open={props.createOpen} onOpenChange={props.onCreateOpenChange} title={t("courseNotes.new")}> | |
| 70 | + <SidePanel guardUnsaved open={props.createOpen} onOpenChange={props.onCreateOpenChange} title={t("courseNotes.new")}> | |
| 71 | 71 | <NoteForm |
| 72 | 72 | enableFiles |
| 73 | 73 | submitLabel={t("common.create")} |
src/components/courses/course-subjects-panel.tsxmodified+1 -1
| @@ -112,7 +112,7 @@ export function CourseSubjectsPanel(props: { courseId: string; canManage: boolea | ||
| 112 | 112 | <Show when={flash()}> |
| 113 | 113 | <Alert variant="success">{flash()}</Alert> |
| 114 | 114 | </Show> |
| 115 | - <SidePanel open={props.createOpen} onOpenChange={setPanelOpen} title={editing() ? t("subjects.edit") : t("subjects.add")} description={t("subjects.help")}> | |
| 115 | + <SidePanel guardUnsaved open={props.createOpen} onOpenChange={setPanelOpen} title={editing() ? t("subjects.edit") : t("subjects.add")} description={t("subjects.help")}> | |
| 116 | 116 | <form class="space-y-3" onSubmit={(event) => void save(event)}> |
| 117 | 117 | <div class="space-y-1.5"> |
| 118 | 118 | <Label for="subject-name">{t("subjects.name")}</Label> |
src/components/homework/course-homework-panel.tsxmodified+1 -1
| @@ -217,7 +217,7 @@ export function CourseHomeworkPanel(props: { | ||
| 217 | 217 | </Show> |
| 218 | 218 | </Suspense> |
| 219 | 219 | |
| 220 | - <SidePanel open={props.createOpen} onOpenChange={setPanelOpen} title={editing() ? t("homework.edit") : t("homework.add")} description={t("homework.help")}> | |
| 220 | + <SidePanel guardUnsaved open={props.createOpen} onOpenChange={setPanelOpen} title={editing() ? t("homework.edit") : t("homework.add")} description={t("homework.help")}> | |
| 221 | 221 | <form class="space-y-4" onSubmit={(event) => void save(event)}> |
| 222 | 222 | <Show when={error()}> |
| 223 | 223 | <Alert variant="destructive">{error()}</Alert> |
src/components/homework/homework-submissions-panel.tsxmodified+1 -1
| @@ -155,7 +155,7 @@ export function HomeworkSubmissionsPanel(props: { homeworkId: string; instanceId | ||
| 155 | 155 | <Show when={submissions.error}><Alert variant="destructive">{formatApiError(submissions.error, locale())}</Alert></Show> |
| 156 | 156 | <DataTable columns={columns()} data={submissions()?.items ?? []} filterColumn="user" enablePagination pageSize={10} empty={t("common.noResults")} /> |
| 157 | 157 | </Suspense> |
| 158 | - <SidePanel open={gradeTarget() != null} onOpenChange={(open) => !open && closeGrade()} title={t("homework.grade")} description={gradeTarget() ? studentLabel(gradeTarget()!.user) : ""}> | |
| 158 | + <SidePanel guardUnsaved open={gradeTarget() != null} onOpenChange={(open) => !open && closeGrade()} title={t("homework.grade")} description={gradeTarget() ? studentLabel(gradeTarget()!.user) : ""}> | |
| 159 | 159 | <form class="space-y-4" onSubmit={(event) => void saveGrade(event)}> |
| 160 | 160 | <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> |
| 161 | 161 | <div class="space-y-1.5"> |
src/components/notes/note-card.tsxmodified+1 -1
| @@ -75,7 +75,7 @@ export function NoteCard(props: { | ||
| 75 | 75 | {error() && <p class="mt-2 text-sm text-destructive-text">{error()}</p>} |
| 76 | 76 | </article> |
| 77 | 77 | |
| 78 | - <SidePanel open={editing()} onOpenChange={setEditing} title={t("common.edit")} description={props.note.title}> | |
| 78 | + <SidePanel guardUnsaved open={editing()} onOpenChange={setEditing} title={t("common.edit")} description={props.note.title}> | |
| 79 | 79 | <NoteForm |
| 80 | 80 | initial={props.note} |
| 81 | 81 | submitLabel={t("common.update")} |
src/components/sessions/course-sessions-panel.tsxmodified+1 -1
| @@ -265,7 +265,7 @@ export function CourseSessionsPanel(props: { | ||
| 265 | 265 | /> |
| 266 | 266 | </Suspense> |
| 267 | 267 | |
| 268 | - <SidePanel | |
| 268 | + <SidePanel guardUnsaved | |
| 269 | 269 | open={panelOpen()} |
| 270 | 270 | onOpenChange={(open) => { |
| 271 | 271 | if (!open) { |
src/components/users/create-user-panel.tsxmodified+1 -1
| @@ -74,7 +74,7 @@ export function CreateUserPanel(props: { | ||
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | 76 | return ( |
| 77 | - <SidePanel | |
| 77 | + <SidePanel guardUnsaved | |
| 78 | 78 | open={props.open} |
| 79 | 79 | onOpenChange={(open) => { if (!open) close(); }} |
| 80 | 80 | title={t("admin.createUser")} |
src/pages/academic-years-page.tsxmodified+2 -2
| @@ -255,7 +255,7 @@ function AcademicYearsContent() { | ||
| 255 | 255 | </Suspense> |
| 256 | 256 | </section> |
| 257 | 257 | |
| 258 | - <SidePanel | |
| 258 | + <SidePanel guardUnsaved | |
| 259 | 259 | open={panelOpen()} |
| 260 | 260 | onOpenChange={(open) => { |
| 261 | 261 | setPanelOpen(open); |
| @@ -347,7 +347,7 @@ function AcademicYearsContent() { | ||
| 347 | 347 | </form> |
| 348 | 348 | </SidePanel> |
| 349 | 349 | |
| 350 | - <SidePanel | |
| 350 | + <SidePanel guardUnsaved | |
| 351 | 351 | open={rolloverTarget() !== null} |
| 352 | 352 | onOpenChange={(open) => !open && setRolloverTarget(null)} |
| 353 | 353 | title={t("academicYears.rollover")} |
src/pages/admin-user-detail-page.tsxmodified+1 -1
| @@ -133,7 +133,7 @@ function AdminUserDetailContent() { | ||
| 133 | 133 | </div> |
| 134 | 134 | </section> |
| 135 | 135 | |
| 136 | - <SidePanel | |
| 136 | + <SidePanel guardUnsaved | |
| 137 | 137 | open={editing()} |
| 138 | 138 | onOpenChange={setEditing} |
| 139 | 139 | title={t("profile.edit")} |
src/pages/appointments-page.tsxmodified+3 -3
| @@ -369,7 +369,7 @@ function AppointmentsContent() { | ||
| 369 | 369 | |
| 370 | 370 | return ( |
| 371 | 371 | <div class="space-y-5"> |
| 372 | - <SidePanel open={showPublish()} onOpenChange={setShowPublish} title={t("appointments.publish")} description={t("appointments.publishSubtitle")}> | |
| 372 | + <SidePanel guardUnsaved open={showPublish()} onOpenChange={setShowPublish} title={t("appointments.publish")} description={t("appointments.publishSubtitle")}> | |
| 373 | 373 | <PublishSlotsForm |
| 374 | 374 | onCancel={() => setShowPublish(false)} |
| 375 | 375 | onSubmit={async (values) => { |
| @@ -387,7 +387,7 @@ function AppointmentsContent() { | ||
| 387 | 387 | /> |
| 388 | 388 | </SidePanel> |
| 389 | 389 | |
| 390 | - <SidePanel open={bookSlot() != null} onOpenChange={(o) => !o && setBookSlot(null)} title={t("appointments.book")} description={t("appointments.bookSubtitle")}> | |
| 390 | + <SidePanel guardUnsaved open={bookSlot() != null} onOpenChange={(o) => !o && setBookSlot(null)} title={t("appointments.book")} description={t("appointments.bookSubtitle")}> | |
| 391 | 391 | <Show when={bookSlot()}> |
| 392 | 392 | {(slot) => ( |
| 393 | 393 | <BookAppointmentForm |
| @@ -411,7 +411,7 @@ function AppointmentsContent() { | ||
| 411 | 411 | </Show> |
| 412 | 412 | </SidePanel> |
| 413 | 413 | |
| 414 | - <SidePanel open={reschedAppt() != null} onOpenChange={(o) => !o && setReschedAppt(null)} title={t("appointments.reschedule")} description={t("appointments.rescheduleSubtitle")}> | |
| 414 | + <SidePanel guardUnsaved open={reschedAppt() != null} onOpenChange={(o) => !o && setReschedAppt(null)} title={t("appointments.reschedule")} description={t("appointments.rescheduleSubtitle")}> | |
| 415 | 415 | <Show when={reschedAppt()}> |
| 416 | 416 | {(appt) => ( |
| 417 | 417 | <RescheduleForm |
src/pages/bank-question-detail-page.tsxmodified+1 -1
| @@ -196,7 +196,7 @@ function BankQuestionDetailContent() { | ||
| 196 | 196 | </Show> |
| 197 | 197 | </section> |
| 198 | 198 | |
| 199 | - <SidePanel open={editing()} onOpenChange={setEditing} title={t("bank.edit")} description={current().text} size="wide"> | |
| 199 | + <SidePanel guardUnsaved open={editing()} onOpenChange={setEditing} title={t("bank.edit")} description={current().text} size="wide"> | |
| 200 | 200 | <BankQuestionForm |
| 201 | 201 | initial={current()} |
| 202 | 202 | courses={manageableCourses()} |
src/pages/builder-school-detail-page.tsxmodified+1 -1
| @@ -188,7 +188,7 @@ function BuilderSchoolDetailContent() { | ||
| 188 | 188 | </Show> |
| 189 | 189 | </Suspense> |
| 190 | 190 | |
| 191 | - <SidePanel open={editOpen()} onOpenChange={setEditOpen} title={t("builder.editSchool")} description={t("builder.editSchoolHint")}> | |
| 191 | + <SidePanel guardUnsaved open={editOpen()} onOpenChange={setEditOpen} title={t("builder.editSchool")} description={t("builder.editSchoolHint")}> | |
| 192 | 192 | <form class="space-y-4" onSubmit={saveEdit}> |
| 193 | 193 | <Show when={editError()}> |
| 194 | 194 | <Alert variant="destructive">{editError()}</Alert> |
src/pages/class-detail-page.tsxmodified+2 -2
| @@ -312,7 +312,7 @@ function ClassDetailContent() { | ||
| 312 | 312 | </Tabs> |
| 313 | 313 | |
| 314 | 314 | {/* Edit class */} |
| 315 | - <SidePanel open={editing()} onOpenChange={setEditing} title={t("common.edit")} description={c().name}> | |
| 315 | + <SidePanel guardUnsaved open={editing()} onOpenChange={setEditing} title={t("common.edit")} description={c().name}> | |
| 316 | 316 | <form class="space-y-4" onSubmit={(e) => { e.preventDefault(); void wrap(async () => { await patchClassById(id(), { name: name().trim(), grade: grade().trim() || null, year: yearId() || null, teacher_id: teacherId() || null }); setEditing(false); await refresh(refetchClass); }, "common.saved"); }}> |
| 317 | 317 | <div class="space-y-3"> |
| 318 | 318 | <div class="space-y-1.5"><Label for="edit-class-name">{t("classGroups.className")}</Label><Input id="edit-class-name" maxlength={limits.latest?.course.max_class_name_len} value={name()} onInput={(e) => setName(e.currentTarget.value)} /></div> |
| @@ -333,7 +333,7 @@ function ClassDetailContent() { | ||
| 333 | 333 | </SidePanel> |
| 334 | 334 | |
| 335 | 335 | {/* Attach course */} |
| 336 | - <SidePanel open={showAttachCourse()} onOpenChange={setShowAttachCourse} title={t("classGroups.attachCourse")} description={t("classGroups.attachCourseHelp")}> | |
| 336 | + <SidePanel guardUnsaved open={showAttachCourse()} onOpenChange={setShowAttachCourse} title={t("classGroups.attachCourse")} description={t("classGroups.attachCourseHelp")}> | |
| 337 | 337 | <form class="space-y-3" onSubmit={(e) => { e.preventDefault(); const cid = attachCourseId(); if (!cid) return; void wrap(async () => { await postClassInstance(id(), { course_id: cid }); setAttachCourseId(""); setShowAttachCourse(false); await refresh(refetchCourses); }, "common.saved"); }}> |
| 338 | 338 | <div class="space-y-1.5"> |
| 339 | 339 | <Label for="class-attach-course">{t("classGroups.selectCourse")}</Label> |
src/pages/course-detail-page.tsxmodified+1 -1
| @@ -355,7 +355,7 @@ function CourseDetailContent() { | ||
| 355 | 355 | }} |
| 356 | 356 | /> |
| 357 | 357 | |
| 358 | - <SidePanel open={editing()} onOpenChange={setEditing} title={t("common.edit")} description={c().title}> | |
| 358 | + <SidePanel guardUnsaved open={editing()} onOpenChange={setEditing} title={t("common.edit")} description={c().title}> | |
| 359 | 359 | <form |
| 360 | 360 | class="space-y-4" |
| 361 | 361 | onSubmit={(e) => { |
src/pages/courses-page.tsxmodified+1 -1
| @@ -114,7 +114,7 @@ function CoursesContent() { | ||
| 114 | 114 | |
| 115 | 115 | return ( |
| 116 | 116 | <div class="space-y-6"> |
| 117 | - <SidePanel open={canCreate() && showForm()} onOpenChange={setShowForm} title={t("common.createItem", { item: kindInSentence() })} description={t("courses.subtitle", { item: kindLabel() })}> | |
| 117 | + <SidePanel guardUnsaved open={canCreate() && showForm()} onOpenChange={setShowForm} title={t("common.createItem", { item: kindInSentence() })} description={t("courses.subtitle", { item: kindLabel() })}> | |
| 118 | 118 | <form class="space-y-4" onSubmit={createCourse}> |
| 119 | 119 | <Show when={limits.error}><ErrorAlert message={formatApiError(limits.error)} onRetry={() => void refetchLimits()} /></Show> |
| 120 | 120 | <div class="flex items-center justify-between rounded-xl border border-border-line bg-surface-tint px-3 py-2 text-xs text-text-subtle"> |
src/pages/event-detail-page.tsxmodified+1 -1
| @@ -217,7 +217,7 @@ function EventDetailContent() { | ||
| 217 | 217 | }} |
| 218 | 218 | /> |
| 219 | 219 | |
| 220 | - <SidePanel | |
| 220 | + <SidePanel guardUnsaved | |
| 221 | 221 | open={editing()} |
| 222 | 222 | onOpenChange={setEditing} |
| 223 | 223 | title={t("common.edit")} |
src/pages/events-page.tsxmodified+1 -1
| @@ -160,7 +160,7 @@ function EventsContent() { | ||
| 160 | 160 | |
| 161 | 161 | return ( |
| 162 | 162 | <div class="space-y-6"> |
| 163 | - <SidePanel open={canCreate() && showForm()} onOpenChange={setShowForm} title={t("events.create")} description={t("events.subtitle")}> | |
| 163 | + <SidePanel guardUnsaved open={canCreate() && showForm()} onOpenChange={setShowForm} title={t("events.create")} description={t("events.subtitle")}> | |
| 164 | 164 | <EventForm |
| 165 | 165 | submitLabel={t("common.create")} |
| 166 | 166 | onCancel={() => setShowForm(false)} |
src/pages/exam-detail-page.tsxmodified+2 -2
| @@ -606,7 +606,7 @@ function ExamDetailContent() { | ||
| 606 | 606 | }} |
| 607 | 607 | /> |
| 608 | 608 | |
| 609 | - <SidePanel | |
| 609 | + <SidePanel guardUnsaved | |
| 610 | 610 | open={editing()} |
| 611 | 611 | onOpenChange={setEditing} |
| 612 | 612 | title={t("common.edit")} |
| @@ -742,7 +742,7 @@ function ExamDetailContent() { | ||
| 742 | 742 | </TabsContent> |
| 743 | 743 | </Tabs> |
| 744 | 744 | |
| 745 | - <SidePanel | |
| 745 | + <SidePanel guardUnsaved | |
| 746 | 746 | open={gradeOpen()} |
| 747 | 747 | onOpenChange={setGradeOpen} |
| 748 | 748 | title={t("exams.gradeStudent")} |
src/pages/homework-page.tsxmodified+1 -1
| @@ -210,7 +210,7 @@ function HomeworkContent() { | ||
| 210 | 210 | |
| 211 | 211 | return ( |
| 212 | 212 | <div class="space-y-6"> |
| 213 | - <SidePanel open={createOpen()} onOpenChange={(open) => { setCreateOpen(open); if (!open) resetForm(); }} title={t("homework.add")} description={t("homework.help")}> | |
| 213 | + <SidePanel guardUnsaved open={createOpen()} onOpenChange={(open) => { setCreateOpen(open); if (!open) resetForm(); }} title={t("homework.add")} description={t("homework.help")}> | |
| 214 | 214 | <form class="space-y-4" onSubmit={(event) => void save(event)}> |
| 215 | 215 | <Show when={error()}> |
| 216 | 216 | <Alert variant="destructive">{error()}</Alert> |
src/pages/meal-detail-page.tsxmodified+2 -2
| @@ -285,10 +285,10 @@ function MealDetailContent() { | ||
| 285 | 285 | <ConfirmDialog open={deleteMenuOpen()} onOpenChange={setDeleteMenuOpen} title={t("meals.deleteMenu")} variant="destructive" summary={`${current().date} · ${current().slot}`} onConfirm={() => run(async () => { await deleteMealMenuById(id()); void navigate({ to: "/meals" }); }, t("common.deleted"))} /> |
| 286 | 286 | <ConfirmDialog open={deleteDish() !== null} onOpenChange={(open) => !open && setDeleteDish(null)} title={t("meals.deleteDish")} variant="destructive" summary={deleteDish()?.name ?? ""} onConfirm={() => run(async () => { if (!deleteDish()) return; await deleteMealDishById(deleteDish()!.id); setDeleteDish(null); await refetchMenu(); }, t("common.deleted"))} /> |
| 287 | 287 | |
| 288 | - <SidePanel open={showMenuEdit()} onOpenChange={setShowMenuEdit} title={t("meals.editMenu")} description={`${current().date} · ${current().slot}`}> | |
| 288 | + <SidePanel guardUnsaved open={showMenuEdit()} onOpenChange={setShowMenuEdit} title={t("meals.editMenu")} description={`${current().date} · ${current().slot}`}> | |
| 289 | 289 | <form class="space-y-4" onSubmit={(e) => { e.preventDefault(); void run(async () => { await patchMealMenuById(id(), { capacity: capacity() ? Number(capacity()) : null }); setShowMenuEdit(false); await refetchMenu(); }); }}><div class="space-y-1.5"><Label for="menu-capacity">{t("meals.capacity")}</Label><Input id="menu-capacity" type="number" min={0} max={limits()?.meal.max_menu_capacity} value={capacity()} onInput={(e) => setCapacity(e.currentTarget.value)} /></div><Button type="submit" disabled={pending()}>{t("common.save")}</Button></form> |
| 290 | 290 | </SidePanel> |
| 291 | - <SidePanel open={showDishForm()} onOpenChange={setShowDishForm} title={editingDish() ? t("meals.editDish") : t("meals.addDish")} description={`${current().date} · ${current().slot}`}> | |
| 291 | + <SidePanel guardUnsaved open={showDishForm()} onOpenChange={setShowDishForm} title={editingDish() ? t("meals.editDish") : t("meals.addDish")} description={`${current().date} · ${current().slot}`}> | |
| 292 | 292 | <form class="space-y-4" onSubmit={(e) => { e.preventDefault(); void run(async () => { const body = { name: dishName().trim(), description: dishDescription().trim() || null, price_minor: Math.round(Number(dishPrice()) * 100), tags: dishTags() }; if (editingDish()) await patchMealDishById(editingDish()!.id, body); else await postMealDish(id(), body); setShowDishForm(false); await refetchMenu(); }); }}> |
| 293 | 293 | <div class="space-y-1.5"><Label for="dish-name">{t("meals.dishName")}</Label><Input id="dish-name" required maxlength={limits()?.meal.max_dish_name_len} value={dishName()} onInput={(e) => setDishName(e.currentTarget.value)} /></div> |
| 294 | 294 | <div class="space-y-1.5"><Label for="dish-description">{t("form.description")}</Label><Textarea id="dish-description" maxlength={limits()?.meal.max_dish_description_len} value={dishDescription()} onInput={(e) => setDishDescription(e.currentTarget.value)} /></div> |
src/pages/payments-page.tsxmodified+3 -3
| @@ -850,7 +850,7 @@ function PaymentsContent() { | ||
| 850 | 850 | </SidePanel> |
| 851 | 851 | |
| 852 | 852 | {/* ---------------- Collect payment panel ---------------- */} |
| 853 | - <SidePanel | |
| 853 | + <SidePanel guardUnsaved | |
| 854 | 854 | open={collectEntry() != null} |
| 855 | 855 | onOpenChange={(open) => { if (!open) setCollectEntry(null); }} |
| 856 | 856 | title={t("payments.collectFrom")} |
| @@ -889,7 +889,7 @@ function PaymentsContent() { | ||
| 889 | 889 | </SidePanel> |
| 890 | 890 | |
| 891 | 891 | {/* ---------------- Correction panel (refund / reverse) ---------------- */} |
| 892 | - <SidePanel | |
| 892 | + <SidePanel guardUnsaved | |
| 893 | 893 | open={lineAction() != null} |
| 894 | 894 | onOpenChange={(open) => { if (!open) setLineAction(null); }} |
| 895 | 895 | title={lineAction()?.kind === "refund" ? t("payments.recordRefund") : t("payments.reverse")} |
| @@ -917,7 +917,7 @@ function PaymentsContent() { | ||
| 917 | 917 | </SidePanel> |
| 918 | 918 | |
| 919 | 919 | {/* ---------------- Plan create / edit ---------------- */} |
| 920 | - <SidePanel open={panelOpen()} onOpenChange={(open) => { setPanelOpen(open); if (!open) resetPlanForm(); }} title={editing() ? t("payments.editPlan") : t("payments.createPlan")} description={t("payments.subtitle")}> | |
| 920 | + <SidePanel guardUnsaved open={panelOpen()} onOpenChange={(open) => { setPanelOpen(open); if (!open) resetPlanForm(); }} title={editing() ? t("payments.editPlan") : t("payments.createPlan")} description={t("payments.subtitle")}> | |
| 921 | 921 | <form class="space-y-4" onSubmit={savePlan}> |
| 922 | 922 | <Show when={error()}> |
| 923 | 923 | <Alert variant="destructive">{error()}</Alert> |
src/pages/profile-page.tsxmodified+1 -1
| @@ -220,7 +220,7 @@ function ProfileContent() { | ||
| 220 | 220 | courseTotal={p().stats.courses} |
| 221 | 221 | /> |
| 222 | 222 | |
| 223 | - <SidePanel open={editing()} onOpenChange={setEditing} title={t("profile.edit")}> | |
| 223 | + <SidePanel guardUnsaved open={editing()} onOpenChange={setEditing} title={t("profile.edit")}> | |
| 224 | 224 | <Show when={auth.user()}> |
| 225 | 225 | {(u) => ( |
| 226 | 226 | <ProfileForm |
src/pages/question-bank-page.tsxmodified+1 -1
| @@ -283,7 +283,7 @@ function QuestionBankContent() { | ||
| 283 | 283 | </TabsContent> |
| 284 | 284 | </Tabs> |
| 285 | 285 | |
| 286 | - <SidePanel | |
| 286 | + <SidePanel guardUnsaved | |
| 287 | 287 | open={createOpen() || editing() != null} |
| 288 | 288 | onOpenChange={(open) => { |
| 289 | 289 | if (!open) { |
src/pages/staff-work-page.tsxmodified+1 -1
| @@ -356,7 +356,7 @@ function StaffWorkContent() { | ||
| 356 | 356 | </Show> |
| 357 | 357 | </SidePanel> |
| 358 | 358 | |
| 359 | - <SidePanel | |
| 359 | + <SidePanel guardUnsaved | |
| 360 | 360 | open={editTarget() != null} |
| 361 | 361 | onOpenChange={(open) => { |
| 362 | 362 | if (!open) { |
src/pages/terms-page.tsxmodified+1 -1
| @@ -251,7 +251,7 @@ function TermsContent() { | ||
| 251 | 251 | </Suspense> |
| 252 | 252 | </section> |
| 253 | 253 | |
| 254 | - <SidePanel | |
| 254 | + <SidePanel guardUnsaved | |
| 255 | 255 | open={panelOpen()} |
| 256 | 256 | onOpenChange={(open) => { |
| 257 | 257 | setPanelOpen(open); |
src/pages/whiteboards-page.tsxmodified+1 -1
| @@ -254,7 +254,7 @@ function CreateBoardPanel(props: { | ||
| 254 | 254 | }; |
| 255 | 255 | |
| 256 | 256 | return ( |
| 257 | - <SidePanel open={props.open} onOpenChange={props.onOpenChange} title={t("whiteboard.create")}> | |
| 257 | + <SidePanel guardUnsaved open={props.open} onOpenChange={props.onOpenChange} title={t("whiteboard.create")}> | |
| 258 | 258 | <div class="space-y-4"> |
| 259 | 259 | <Show when={error()}> |
| 260 | 260 | <ErrorAlert message={error()} /> |