🐛 render form error alerts inside SidePanel instead of behind backdrop
Browse files at this commite7e95c71f0742371ccee34677ce27d522ed99a25Parent: e9b7072- fix
- 🐛 render form error alerts inside SidePanel instead of behind backdrop
4 changed files +13 -4
- src/components/sessions/course-sessions-panel.tsx +6 -1
- src/pages/events-page.tsx +3 -1
- src/pages/exams-page.tsx +1 -1
- src/pages/notes-page.tsx +3 -1
src/components/sessions/course-sessions-panel.tsxmodified+6 -1
| @@ -225,7 +225,9 @@ export function CourseSessionsPanel(props: { | |||
| 225 | <Show when={flash()}> | 225 | <Show when={flash()}> |
| 226 | <Alert variant="success">{flash()}</Alert> | 226 | <Alert variant="success">{flash()}</Alert> |
| 227 | </Show> | 227 | </Show> |
| 228 | - {error() && <Alert variant="destructive">{error()}</Alert>} | 228 | + <Show when={error() && !panelOpen()}> |
| 229 | + <Alert variant="destructive">{error()}</Alert> | ||
| 230 | + </Show> | ||
| 229 | 231 | ||
| 230 | <Suspense fallback={<PageSpinner />}> | 232 | <Suspense fallback={<PageSpinner />}> |
| 231 | <Show when={sessions.error}> | 233 | <Show when={sessions.error}> |
| @@ -248,6 +250,9 @@ export function CourseSessionsPanel(props: { | |||
| 248 | description={t("sessions.subtitle")} | 250 | description={t("sessions.subtitle")} |
| 249 | > | 251 | > |
| 250 | <form class="space-y-4" onSubmit={saveSession}> | 252 | <form class="space-y-4" onSubmit={saveSession}> |
| 253 | + <Show when={error()}> | ||
| 254 | + <Alert variant="destructive">{error()}</Alert> | ||
| 255 | + </Show> | ||
| 251 | <div class="space-y-1.5"> | 256 | <div class="space-y-1.5"> |
| 252 | <Label for="session-topic">{t("sessions.topic")}</Label> | 257 | <Label for="session-topic">{t("sessions.topic")}</Label> |
| 253 | <Input id="session-topic" value={topic()} maxlength={200} onInput={(e) => setTopic(e.currentTarget.value)} /> | 258 | <Input id="session-topic" value={topic()} maxlength={200} onInput={(e) => setTopic(e.currentTarget.value)} /> |
src/pages/events-page.tsxmodified+3 -1
| @@ -191,7 +191,9 @@ function EventsContent() { | |||
| 191 | <Show when={flash()}> | 191 | <Show when={flash()}> |
| 192 | <Alert variant="success">{flash()}</Alert> | 192 | <Alert variant="success">{flash()}</Alert> |
| 193 | </Show> | 193 | </Show> |
| 194 | - {error() && <p class="text-sm text-destructive">{error()}</p>} | 194 | + <Show when={error() && !showForm()}> |
| 195 | + <Alert variant="destructive">{error()}</Alert> | ||
| 196 | + </Show> | ||
| 195 | 197 | ||
| 196 | <section class="data-shell space-y-4 border-amber-500/15 bg-amber-500/[0.025] p-4"> | 198 | <section class="data-shell space-y-4 border-amber-500/15 bg-amber-500/[0.025] p-4"> |
| 197 | <Suspense fallback={<DataTableSkeleton columns={5} rows={8} />}> | 199 | <Suspense fallback={<DataTableSkeleton columns={5} rows={8} />}> |
src/pages/exams-page.tsxmodified+1 -1
| @@ -279,7 +279,7 @@ function ExamsContent() { | |||
| 279 | <Show when={flash()}> | 279 | <Show when={flash()}> |
| 280 | <Alert variant="success">{flash()}</Alert> | 280 | <Alert variant="success">{flash()}</Alert> |
| 281 | </Show> | 281 | </Show> |
| 282 | - <Show when={error()}> | 282 | + <Show when={error() && !createOpen()}> |
| 283 | <Alert variant="destructive">{error()}</Alert> | 283 | <Alert variant="destructive">{error()}</Alert> |
| 284 | </Show> | 284 | </Show> |
| 285 | <Suspense fallback={<DataTableSkeleton columns={6} rows={8} />}> | 285 | <Suspense fallback={<DataTableSkeleton columns={6} rows={8} />}> |
src/pages/notes-page.tsxmodified+3 -1
| @@ -143,7 +143,9 @@ function NotesContent() { | |||
| 143 | <Show when={flash()}> | 143 | <Show when={flash()}> |
| 144 | <Alert variant="success">{flash()}</Alert> | 144 | <Alert variant="success">{flash()}</Alert> |
| 145 | </Show> | 145 | </Show> |
| 146 | - {error() && <Alert variant="destructive">{error()}</Alert>} | 146 | + <Show when={error() && !createOpen() && !importOpen()}> |
| 147 | + <Alert variant="destructive">{error()}</Alert> | ||
| 148 | + </Show> | ||
| 147 | <Suspense fallback={<PageSpinner />}> | 149 | <Suspense fallback={<PageSpinner />}> |
| 148 | <Show when={list.error}> | 150 | <Show when={list.error}> |
| 149 | <Alert variant="destructive">{formatApiError(list.error)}</Alert> | 151 | <Alert variant="destructive">{formatApiError(list.error)}</Alert> |