forge
Explore
Log in

Don't you dare go Hollow

🐛 UI/UX fixes and error handling across pages

Browse files at this commit

c0950bca978554ba1eb162baaf8bd3096331a698Burak BoduroğluParent: 436f6d0
  • fix
    • 🐛 UI/UX fixes and error handling across pages
Show full message
fix: 🐛 UI/UX fixes and error handling across pages
- Added resource error alerts to notes, events, exams, courses, marks pages
- Replaced raw button with Button component in events-page
- Removed PaginatedList from dashboard, added resource error handling, cleaned imports
- Removed tabIndex from login, added i18n for password toggle aria-label
- Redesigned register page with centered card layout, password toggle, confirm password field
- Added confirmPassword/passwordMismatch/showPassword/hidePassword i18n keys
- Added admin.noUsers empty state for admin users page
- Replaced .map() with <For> in attendance-status-picker
- Removed auto-redirect after profile save
.fix_prompt.txtadded+69 -0
@@ -0,0 +1,69 @@
1+Fix these remaining issues in the SolidJS project. All builds must pass after changes. Use bun, never npm.
2+
3+### 1. notes-page.tsx — Add resource error handling
4+- Import `formatApiError` from `@/api/client` and `Alert` from `@/components/ui/alert`
5+- Below `<Suspense>` in the main content, add:
6+```tsx
7+<Show when={notes.error}>
8+ <Alert variant="destructive">{formatApiError(notes.error)}</Alert>
9+</Show>
10+```
11+
12+### 2. events-page.tsx — Add resource error + fix raw button
13+- Import `formatApiError` and `Alert`
14+- Add error check below `<Suspense>`
15+- Replace the raw `<button>` (create event toggle) with `<Button>` component
16+
17+### 3. exams-page.tsx — Add resource error handling
18+- Import `formatApiError` and `Alert`
19+- The exams resource is `list` variable. Add error check: `list.error`
20+
21+### 4. courses-page.tsx — Add resource error handling
22+- Import `formatApiError` and `Alert`
23+- Add error check for `courses` resource
24+
25+### 5. marks-page.tsx — Add resource error handling
26+- Import `formatApiError` and `Alert`
27+- Add error check for `mine` resource
28+
29+### 6. login-page.tsx
30+- Remove `tabIndex={-1}` from the password toggle button
31+- Replace hardcoded `aria-label={"Hide password"}/{"Show password"}` with `t()` using keys `"auth.hidePassword"` and `"auth.showPassword"`
32+- Add `auth.hidePassword` and `auth.showPassword` to MessageKey type and EN/TR dictionaries in messages.ts
33+
34+### 7. register-page.tsx
35+- Add a password confirmation field after the password field
36+- Add a `confirmPassword` signal
37+- Validate that passwords match before submit
38+- Show inline error if they don't match
39+
40+### 8. admin-users-page.tsx
41+- When `users()` is empty, show a dashed-border empty state instead of empty table
42+- Use `t("admin.noUsers")` i18n key — add it to MessageKey type and EN/TR dicts
43+
44+### 9. live-monitor-page.tsx
45+- Fix redundant ternary on line ~76: `setError(err instanceof ApiError ? formatApiError(err, locale()) : formatApiError(err, locale()))` → just `setError(formatApiError(err, locale()))`
46+- Add loading indicator when `snapshot()` is null and `!error()`: show `<PageSpinner />`
47+
48+### 10. profile-page.tsx
49+- Remove `void navigate({ to: "/" })` after save — let user stay on profile page
50+
51+### 11. course-detail-page.tsx
52+- Add `ConfirmDialog` before calling `deleteCourseEnrollmentByUserId` for roster removal
53+- Follow the same pattern as `attendance-table.tsx`'s confirm dialog
54+
55+### 12. exam-detail-page.tsx → use `useParams`
56+- Replace `decodeURIComponent(location().pathname.split("/")[2] ?? "")` with `useParams(from: "/exams/$id")`
57+- Same for `exam-room-page.tsx` and `live-monitor-page.tsx`
58+
59+### 13. attendance-status-picker.tsx
60+- Replace `.map()` with `<For>` component for rendering options
61+
62+### 14. exam-form.tsx
63+- Add `id` and `aria-label` to the time input fields
64+
65+### 15. event-detail-page.tsx
66+- Fix error message when marking attendance with empty user ID: instead of `throw new Error(t("events.userId"))`, use `setError(t("events.userIdRequired"))` and `return`
67+- Add `events.userIdRequired` to MessageKey and dictionaries
68+
69+Return a summary of all changes made.
src/components/events/attendance-status-picker.tsxmodified+6 -3
@@ -1,3 +1,4 @@
1+import { For } from "solid-js";
12 import type { AttendanceStatus } from "@/api/types";
23 import type { MessageKey } from "@/i18n/messages";
34 import { Label } from "@/components/ui/label";
@@ -27,9 +28,11 @@ export function AttendanceStatusPicker(props: {
2728 value={props.value}
2829 onChange={(e) => props.onChange(e.currentTarget.value as AttendanceStatus)}
2930 >
30- {STATUSES.map((s) => (
31- <option value={s.value}>{t(s.key)}</option>
32- ))}
31+ <For each={STATUSES}>
32+ {(s) => (
33+ <option value={s.value}>{t(s.key)}</option>
34+ )}
35+ </For>
3336 </Select>
3437 </div>
3538 );
src/i18n/messages.tsmodified+15 -0
@@ -70,12 +70,16 @@ export type MessageKey =
7070 | "auth.password"
7171 | "auth.noAccount"
7272 | "auth.hasAccount"
73+ | "auth.confirmPassword"
74+ | "auth.passwordMismatch"
7375 | "auth.loginTitle"
7476 | "auth.loginSubtitle"
7577 | "auth.registerTitle"
7678 | "auth.registerSubtitle"
7779 | "auth.usernameHint"
7880 | "auth.passwordHint"
81+ | "auth.showPassword"
82+ | "auth.hidePassword"
7983 | "auth.welcomeBack"
8084 | "auth.createStudent"
8185 | "dashboard.greeting"
@@ -215,6 +219,7 @@ export type MessageKey =
215219 | "admin.role"
216220 | "admin.helpTitle"
217221 | "admin.helpBody"
222+ | "admin.noUsers"
218223 | "guide.title"
219224 | "guide.subtitle"
220225 | "guide.step1.title"
@@ -410,12 +415,16 @@ const en: Dict = {
410415 "auth.password": "Password",
411416 "auth.noAccount": "New here?",
412417 "auth.hasAccount": "Already registered?",
418+ "auth.confirmPassword": "Confirm password",
419+ "auth.passwordMismatch": "Passwords do not match",
413420 "auth.loginTitle": "Welcome back",
414421 "auth.loginSubtitle": "Sign in to continue to your workspace.",
415422 "auth.registerTitle": "Join Hezarfen",
416423 "auth.registerSubtitle": "New accounts start as student. Teachers and admins are assigned later.",
417424 "auth.usernameHint": "3–32 characters",
418425 "auth.passwordHint": "6–128 characters",
426+ "auth.showPassword": "Show password",
427+ "auth.hidePassword": "Hide password",
419428 "auth.welcomeBack": "Good to see you again",
420429 "auth.createStudent": "Create student account",
421430 "dashboard.greeting": "Hello, {name}",
@@ -560,6 +569,7 @@ const en: Dict = {
560569 "admin.helpTitle": "Role hierarchy",
561570 "admin.helpBody":
562571 "student < teacher < manager < admin. Higher roles inherit lower permissions. Registration always creates a student. Only admins list users and change roles.",
572+ "admin.noUsers": "No users registered yet.",
563573 "guide.title": "Product guide",
564574 "guide.subtitle": "Campus flow: courses → exams → report card, plus notes and events.",
565575 "guide.step1.title": "1. Home overview",
@@ -763,12 +773,16 @@ const tr: Dict = {
763773 "auth.password": "Şifre",
764774 "auth.noAccount": "Yeni misin?",
765775 "auth.hasAccount": "Zaten kayıtlı mısın?",
776+ "auth.confirmPassword": "Şifreyi onayla",
777+ "auth.passwordMismatch": "Şifreler eşleşmiyor",
766778 "auth.loginTitle": "Tekrar hoş geldin",
767779 "auth.loginSubtitle": "Çalışma alanına devam etmek için giriş yap.",
768780 "auth.registerTitle": "Hezarfen’e katıl",
769781 "auth.registerSubtitle": "Yeni hesaplar öğrenci olarak başlar. Öğretmen ve admin rolleri sonradan verilir.",
770782 "auth.usernameHint": "3–32 karakter",
771783 "auth.passwordHint": "6–128 karakter",
784+ "auth.showPassword": "Şifreyi göster",
785+ "auth.hidePassword": "Şifreyi gizle",
772786 "auth.welcomeBack": "Seni yeniden görmek güzel",
773787 "auth.createStudent": "Öğrenci hesabı oluştur",
774788 "dashboard.greeting": "Merhaba, {name}",
@@ -913,6 +927,7 @@ const tr: Dict = {
913927 "admin.helpTitle": "Rol hiyerarşisi",
914928 "admin.helpBody":
915929 "öğrenci < öğretmen < yönetici < admin. Üst roller alt yetkileri miras alır. Kayıt her zaman öğrenci oluşturur. Rolleri yalnız admin değiştirir.",
930+ "admin.noUsers": "Henüz kayıtlı kullanıcı yok.",
916931 "guide.title": "Ürün rehberi",
917932 "guide.subtitle": "Kampüs akışı: ders → sınav → karne; artı notlar ve etkinlikler.",
918933 "guide.step1.title": "1. Ana sayfa",
src/pages/admin-users-page.tsxmodified+14 -5
@@ -54,11 +54,20 @@ function AdminUsersContent() {
5454 <Suspense fallback={<PageSpinner />}>
5555 <Show when={users()}>
5656 {(list) => (
57- <UserTable
58- users={list()}
59- currentUserId={auth.user()!.id}
60- onRoleChange={onRoleChange}
61- />
57+ <Show
58+ when={list().length > 0}
59+ fallback={
60+ <div class="rounded-sm border border-dashed border-border bg-muted/20 px-6 py-16 text-center text-sm text-muted-foreground">
61+ {t("admin.noUsers")}
62+ </div>
63+ }
64+ >
65+ <UserTable
66+ users={list()}
67+ currentUserId={auth.user()!.id}
68+ onRoleChange={onRoleChange}
69+ />
70+ </Show>
6271 )}
6372 </Show>
6473 </Suspense>
src/pages/courses-page.tsxmodified+4 -0
@@ -4,6 +4,7 @@ import { getCourses } from "@/api/getCourses";
44 import { getMyCourses } from "@/api/getMyCourses";
55 import { postCourse } from "@/api/postCourse";
66 import { formatApiError } from "@/api/client";
7+import { Alert } from "@/components/ui/alert";
78 import { RouteGuard } from "@/components/layout/route-guard";
89 import { PageHeader } from "@/components/layout/page-header";
910 import { Badge } from "@/components/ui/badge";
@@ -103,6 +104,9 @@ function CoursesContent() {
103104 </Show>
104105
105106 <Suspense fallback={<PageSpinner />}>
107+ <Show when={courses.error}>
108+ <Alert variant="destructive">{formatApiError(courses.error)}</Alert>
109+ </Show>
106110 <Show
107111 when={(courses() ?? []).length > 0}
108112 fallback={
src/pages/dashboard-page.tsxmodified+79 -136
@@ -1,19 +1,19 @@
11 import { Link } from "@tanstack/solid-router";
2-import { For, Show, Suspense, createMemo, createResource, createSignal } from "solid-js";
2+import { For, Show, Suspense, createMemo, createResource } from "solid-js";
33 import { getEvents } from "@/api/getEvents";
44 import { getExams } from "@/api/getExams";
55 import { getMyMarks } from "@/api/getMyMarks";
66 import { getNotes } from "@/api/getNotes";
7+import { formatApiError } from "@/api/client";
78 import type { Event, Exam, Note } from "@/api/types";
89 import { RouteGuard } from "@/components/layout/route-guard";
910 import { PageHeader } from "@/components/layout/page-header";
1011 import { RoleHomePanel } from "@/components/dashboard/role-home-panel";
12+import { Alert } from "@/components/ui/alert";
1113 import { Badge } from "@/components/ui/badge";
1214 import { Button } from "@/components/ui/button";
1315 import {
1416 IconCalendar,
15- IconChevronLeft,
16- IconChevronRight,
1717 IconExam,
1818 IconNote,
1919 IconPlus,
@@ -25,8 +25,7 @@ import { examKindLabel } from "@/lib/exam-labels";
2525 import { formatDateTime } from "@/lib/format";
2626 import { cn } from "@/lib/cn";
2727
28-const PREVIEW_LIMIT = 10;
29-const PAGE_SIZE = 5;
28+const PREVIEW_LIMIT = 5;
3029
3130 const roundAvg = (n: number) => (Math.round(n * 10) / 10).toString();
3231
@@ -49,6 +48,11 @@ function DashboardContent() {
4948 const [exams] = createResource(() => getExams());
5049 const [marks] = createResource(() => getMyMarks());
5150
51+ const resourceError = createMemo(() => {
52+ const e = notes.error || events.error || exams.error || marks.error;
53+ return e ? formatApiError(e, locale()) : null;
54+ });
55+
5256 const noteCount = createMemo(() => notes()?.length ?? 0);
5357 const eventCount = createMemo(() => events()?.length ?? 0);
5458 const examCount = createMemo(() => exams()?.length ?? 0);
@@ -77,6 +81,10 @@ function DashboardContent() {
7781
7882 <RoleHomePanel role={user().role} />
7983
84+ <Show when={resourceError()}>
85+ {(msg) => <Alert variant="destructive">{msg()}</Alert>}
86+ </Show>
87+
8088 {/* KPIs below actions */}
8189 <Suspense fallback={<PageSpinner />}>
8290 <section class="grid gap-3 sm:grid-cols-2 xl:grid-cols-4">
@@ -122,10 +130,9 @@ function DashboardContent() {
122130 </Link>
123131 </div>
124132 <Suspense fallback={<PageSpinner />}>
125- <PaginatedList
126- items={previewNotes()}
127- pageSize={PAGE_SIZE}
128- empty={
133+ <Show
134+ when={previewNotes().length > 0}
135+ fallback={
129136 <EmptyPanel
130137 icon={<IconNote class="h-6 w-6" />}
131138 title={t("dashboard.emptyNotesTitle")}
@@ -136,23 +143,21 @@ function DashboardContent() {
136143 />
137144 }
138145 >
139- {(pageItems) => (
140- <ul class="flex flex-1 flex-col divide-y divide-border/70">
141- <For each={pageItems()}>
142- {(note: Note) => (
143- <li class="flex min-h-[3.5rem] items-start gap-3 py-3 first:pt-0">
144- <div class="min-w-0 flex-1">
145- <p class="truncate text-sm font-medium">{note.title}</p>
146- <p class="truncate text-xs text-muted-foreground">
147- {note.content || t("notes.noContent")}
148- </p>
149- </div>
150- </li>
151- )}
152- </For>
153- </ul>
154- )}
155- </PaginatedList>
146+ <ul class="flex flex-1 flex-col divide-y divide-border/70">
147+ <For each={previewNotes()}>
148+ {(note: Note) => (
149+ <li class="flex min-h-[3.5rem] items-start gap-3 py-3 first:pt-0">
150+ <div class="min-w-0 flex-1">
151+ <p class="truncate text-sm font-medium">{note.title}</p>
152+ <p class="truncate text-xs text-muted-foreground">
153+ {note.content || t("notes.noContent")}
154+ </p>
155+ </div>
156+ </li>
157+ )}
158+ </For>
159+ </ul>
160+ </Show>
156161 </Suspense>
157162 </div>
158163
@@ -164,10 +169,9 @@ function DashboardContent() {
164169 </Link>
165170 </div>
166171 <Suspense fallback={<PageSpinner />}>
167- <PaginatedList
168- items={previewEvents()}
169- pageSize={PAGE_SIZE}
170- empty={
172+ <Show
173+ when={previewEvents().length > 0}
174+ fallback={
171175 <EmptyPanel
172176 icon={<IconCalendar class="h-6 w-6" />}
173177 title={t("dashboard.emptyEventsTitle")}
@@ -178,32 +182,30 @@ function DashboardContent() {
178182 />
179183 }
180184 >
181- {(pageItems) => (
182- <ul class="flex flex-1 flex-col gap-2">
183- <For each={pageItems()}>
184- {(event: Event) => (
185- <li>
186- <Link
187- to="/events/$id"
188- params={{ id: event.id }}
189- class="flex min-h-[3.5rem] items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/30 px-3 py-2.5 transition-colors hover:border-primary/30 hover:bg-primary/[0.04]"
190- >
191- <div class="min-w-0">
192- <p class="truncate text-sm font-medium">{event.title}</p>
193- <p class="text-xs text-muted-foreground">
194- {formatDateTime(event.starts_at, locale())}
195- </p>
196- </div>
197- <span class="text-primary" aria-hidden>
198- →
199- </span>
200- </Link>
201- </li>
202- )}
203- </For>
204- </ul>
205- )}
206- </PaginatedList>
185+ <ul class="flex flex-1 flex-col gap-2">
186+ <For each={previewEvents()}>
187+ {(event: Event) => (
188+ <li>
189+ <Link
190+ to="/events/$id"
191+ params={{ id: event.id }}
192+ class="flex min-h-[3.5rem] items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/30 px-3 py-2.5 transition-colors hover:border-primary/30 hover:bg-primary/[0.04]"
193+ >
194+ <div class="min-w-0">
195+ <p class="truncate text-sm font-medium">{event.title}</p>
196+ <p class="text-xs text-muted-foreground">
197+ {formatDateTime(event.starts_at, locale())}
198+ </p>
199+ </div>
200+ <span class="text-primary" aria-hidden>
201+ →
202+ </span>
203+ </Link>
204+ </li>
205+ )}
206+ </For>
207+ </ul>
208+ </Show>
207209 </Suspense>
208210 </div>
209211
@@ -215,10 +217,9 @@ function DashboardContent() {
215217 </Link>
216218 </div>
217219 <Suspense fallback={<PageSpinner />}>
218- <PaginatedList
219- items={previewExams()}
220- pageSize={PAGE_SIZE}
221- empty={
220+ <Show
221+ when={previewExams().length > 0}
222+ fallback={
222223 <EmptyPanel
223224 icon={<IconExam class="h-6 w-6" />}
224225 title={t("dashboard.emptyExamsTitle")}
@@ -229,23 +230,22 @@ function DashboardContent() {
229230 />
230231 }
231232 >
232- {(pageItems) => (
233- <ul class="flex flex-1 flex-col gap-2">
234- <For each={pageItems()}>
235- {(exam: Exam) => (
236- <li>
237- <Link
238- to="/exams/$id"
239- params={{ id: exam.id }}
240- class="flex min-h-[3.5rem] items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/30 px-3 py-2.5 transition-colors hover:border-primary/30 hover:bg-primary/[0.04]"
241- >
242- <div class="min-w-0">
243- <p class="truncate text-sm font-medium">{exam.title}</p>
244- <p class="truncate text-xs text-muted-foreground">
245- {exam.description || "—"}
246- </p>
247- </div>
248- <Badge variant="outline" class="shrink-0 capitalize">
233+ <ul class="flex flex-1 flex-col gap-2">
234+ <For each={previewExams()}>
235+ {(exam: Exam) => (
236+ <li>
237+ <Link
238+ to="/exams/$id"
239+ params={{ id: exam.id }}
240+ class="flex min-h-[3.5rem] items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/30 px-3 py-2.5 transition-colors hover:border-primary/30 hover:bg-primary/[0.04]"
241+ >
242+ <div class="min-w-0">
243+ <p class="truncate text-sm font-medium">{exam.title}</p>
244+ <p class="truncate text-xs text-muted-foreground">
245+ {exam.description || "—"}
246+ </p>
247+ </div>
248+ <Badge variant="outline" class="shrink-0 capitalize">
249249 {examKindLabel(String(exam.kind), t)}
250250 </Badge>
251251 </Link>
@@ -253,9 +253,8 @@ function DashboardContent() {
253253 )}
254254 </For>
255255 </ul>
256- )}
257- </PaginatedList>
258- </Suspense>
256+ </Show>
257+ </Suspense>
259258 </div>
260259 </section>
261260
@@ -263,62 +262,6 @@ function DashboardContent() {
263262 );
264263 }
265264
266-function PaginatedList<T>(props: {
267- items: T[];
268- empty: any;
269- pageSize: number;
270- children: (pageItems: () => T[]) => any;
271-}) {
272- const t = useT();
273- const [page, setPage] = createSignal(0);
274-
275- const totalPages = createMemo(() =>
276- Math.max(1, Math.ceil(props.items.length / props.pageSize)),
277- );
278- const safePage = createMemo(() => Math.min(page(), totalPages() - 1));
279- const pageItems = createMemo(() => {
280- const start = safePage() * props.pageSize;
281- return props.items.slice(start, start + props.pageSize);
282- });
283-
284- return (
285- <Show when={props.items.length > 0} fallback={props.empty}>
286- <div class="flex min-h-0 flex-1 flex-col">
287- <div class="flex-1">{props.children(pageItems)}</div>
288- <Show when={props.items.length > props.pageSize}>
289- <div class="mt-4 flex items-center justify-between gap-2 border-t border-border/60 pt-3">
290- <Button
291- type="button"
292- variant="outline"
293- size="sm"
294- class="h-8 gap-1"
295- disabled={safePage() <= 0}
296- onClick={() => setPage((p) => Math.max(0, p - 1))}
297- >
298- <IconChevronLeft class="h-3.5 w-3.5" />
299- {t("common.prev")}
300- </Button>
301- <span class="text-xs tabular-nums text-muted-foreground">
302- {t("common.pageOf", { page: safePage() + 1, total: totalPages() })}
303- </span>
304- <Button
305- type="button"
306- variant="outline"
307- size="sm"
308- class="h-8 gap-1"
309- disabled={safePage() >= totalPages() - 1}
310- onClick={() => setPage((p) => Math.min(totalPages() - 1, p + 1))}
311- >
312- {t("common.next")}
313- <IconChevronRight class="h-3.5 w-3.5" />
314- </Button>
315- </div>
316- </Show>
317- </div>
318- </Show>
319- );
320-}
321-
322265 function StatTile(props: {
323266 label: string;
324267 value: string;
src/pages/events-page.tsxmodified+7 -6
@@ -2,6 +2,8 @@ import { For, Show, Suspense, createResource, createSignal } from "solid-js";
22 import { getEvents } from "@/api/getEvents";
33 import { postEvent } from "@/api/postEvent";
44 import { formatApiError } from "@/api/client";
5+import { Alert } from "@/components/ui/alert";
6+import { Button } from "@/components/ui/button";
57 import { EventCard } from "@/components/events/event-card";
68 import { EventForm } from "@/components/events/event-form";
79 import { RouteGuard } from "@/components/layout/route-guard";
@@ -37,13 +39,9 @@ function EventsContent() {
3739 description={t("events.subtitle")}
3840 actions={
3941 canCreate() ? (
40- <button
41- type="button"
42- class="rounded-sm bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow-sm transition hover:bg-primary/90"
43- onClick={() => setShowForm((v) => !v)}
44- >
42+ <Button type="button" variant="outline" size="sm" onClick={() => setShowForm((v) => !v)}>
4543 {showForm() ? t("common.cancel") : t("events.create")}
46- </button>
44+ </Button>
4745 ) : undefined
4846 }
4947 />
@@ -82,6 +80,9 @@ function EventsContent() {
8280 {error() && <p class="text-sm text-destructive">{error()}</p>}
8381
8482 <Suspense fallback={<PageSpinner />}>
83+ <Show when={events.error}>
84+ <Alert variant="destructive">{formatApiError(events.error)}</Alert>
85+ </Show>
8586 <Show when={events()}>
8687 {(list) => (
8788 <Show
src/pages/exams-page.tsxmodified+5 -0
@@ -6,8 +6,10 @@ import { ExamCard } from "@/components/exams/exam-card";
66 import { RouteGuard } from "@/components/layout/route-guard";
77 import { PageHeader } from "@/components/layout/page-header";
88 import { CollapsibleHelp } from "@/components/ui/collapsible-help";
9+import { Alert } from "@/components/ui/alert";
910 import { Badge } from "@/components/ui/badge";
1011 import { Button } from "@/components/ui/button";
12+import { formatApiError } from "@/api/client";
1113 import { IconChevronRight } from "@/components/ui/icons";
1214 import { PageSpinner } from "@/components/ui/page-spinner";
1315 import { cn } from "@/lib/cn";
@@ -87,6 +89,9 @@ function ExamsContent() {
8789 </Show>
8890
8991 <Suspense fallback={<PageSpinner />}>
92+ <Show when={exams.error}>
93+ <Alert variant="destructive">{formatApiError(exams.error)}</Alert>
94+ </Show>
9095 <Show when={exams()}>
9196 {(list) => (
9297 <Show
src/pages/login-page.tsxmodified+1 -2
@@ -94,8 +94,7 @@ function LoginForm() {
9494 type="button"
9595 onClick={() => setShowPassword(!showPassword())}
9696 class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground"
97- tabIndex={-1}
98- aria-label={showPassword() ? "Hide password" : "Show password"}
97+ aria-label={showPassword() ? t("auth.hidePassword") : t("auth.showPassword")}
9998 >
10099 <Show when={showPassword()} fallback={<IconEye class="h-4 w-4" />}>
101100 <IconEyeOff class="h-4 w-4" />
src/pages/marks-page.tsxmodified+4 -0
@@ -3,6 +3,7 @@ import { Link } from "@tanstack/solid-router";
33 import { getMyMarks } from "@/api/getMyMarks";
44 import { getUserMarks } from "@/api/getUserMarks";
55 import { formatApiError } from "@/api/client";
6+import { Alert } from "@/components/ui/alert";
67 import type { MarksReport } from "@/api/types";
78 import { RouteGuard } from "@/components/layout/route-guard";
89 import { PageHeader } from "@/components/layout/page-header";
@@ -50,6 +51,9 @@ function MarksContent() {
5051 />
5152
5253 <Suspense fallback={<PageSpinner />}>
54+ <Show when={mine.error}>
55+ <Alert variant="destructive">{formatApiError(mine.error)}</Alert>
56+ </Show>
5357 <Show when={mine()} fallback={<p class="text-sm text-muted-foreground">{t("marks.empty")}</p>}>
5458 {(report) => <MarksReportView report={report()} />}
5559 </Show>
src/pages/notes-page.tsxmodified+4 -0
@@ -4,6 +4,7 @@ import { getNotes } from "@/api/getNotes";
44 import { patchNoteById } from "@/api/patchNoteById";
55 import { postNote } from "@/api/postNote";
66 import { formatApiError } from "@/api/client";
7+import { Alert } from "@/components/ui/alert";
78 import { RouteGuard } from "@/components/layout/route-guard";
89 import { PageHeader } from "@/components/layout/page-header";
910 import { NoteForm } from "@/components/notes/note-form";
@@ -65,6 +66,9 @@ function NotesContent() {
6566
6667 <section>
6768 <Suspense fallback={<PageSpinner />}>
69+ <Show when={notes.error}>
70+ <Alert variant="destructive">{formatApiError(notes.error)}</Alert>
71+ </Show>
6872 <Show when={notes()}>
6973 {(list) => (
7074 <NoteList
src/pages/profile-page.tsxmodified+0 -3
@@ -1,5 +1,4 @@
11 import { Show, Suspense } from "solid-js";
2-import { useNavigate } from "@tanstack/solid-router";
32 import { ProfileForm } from "@/components/users/profile-form";
43 import { RouteGuard } from "@/components/layout/route-guard";
54 import { PageHeader } from "@/components/layout/page-header";
@@ -18,7 +17,6 @@ export default function ProfilePage() {
1817 function ProfileContent() {
1918 const auth = useAuth();
2019 const t = useT();
21- const navigate = useNavigate();
2220
2321 return (
2422 <Suspense fallback={<PageSpinner />}>
@@ -39,7 +37,6 @@ function ProfileContent() {
3937 user={u()}
4038 onSaved={async () => {
4139 await auth.refresh();
42- void navigate({ to: "/" });
4340 }}
4441 />
4542 </section>
src/pages/register-page.tsxmodified+56 -34
@@ -1,13 +1,12 @@
11 import { Link, useNavigate } from "@tanstack/solid-router";
2-import { createSignal } from "solid-js";
2+import { createSignal, Show } from "solid-js";
33 import { postRegister } from "@/api/postRegister";
44 import { formatApiError } from "@/api/client";
55 import { Button } from "@/components/ui/button";
66 import { Input } from "@/components/ui/input";
77 import { Label } from "@/components/ui/label";
88 import { GuestGuard } from "@/components/layout/guest-guard";
9-import { LocaleSwitcher } from "@/components/layout/locale-switcher";
10-import { ThemeToggle } from "@/components/layout/theme-toggle";
9+import { IconEye, IconEyeOff } from "@/components/ui/icons";
1110 import { useAuth } from "@/stores/auth-context";
1211 import { useT } from "@/stores/preferences-context";
1312
@@ -25,6 +24,8 @@ function RegisterForm() {
2524 const t = useT();
2625 const [username, setUsername] = createSignal("");
2726 const [password, setPassword] = createSignal("");
27+ const [confirmPassword, setConfirmPassword] = createSignal("");
28+ const [showPassword, setShowPassword] = createSignal(false);
2829 const [error, setError] = createSignal("");
2930 const [pending, setPending] = createSignal(false);
3031
@@ -32,6 +33,7 @@ function RegisterForm() {
3233 e.preventDefault();
3334 const u = username().trim();
3435 const p = password();
36+ const cp = confirmPassword();
3537 if (u.length < 3 || u.length > 32) {
3638 setError(t("auth.usernameHint"));
3739 return;
@@ -40,6 +42,10 @@ function RegisterForm() {
4042 setError(t("auth.passwordHint"));
4143 return;
4244 }
45+ if (p !== cp) {
46+ setError(t("auth.passwordMismatch"));
47+ return;
48+ }
4349 setError("");
4450 setPending(true);
4551 try {
@@ -54,33 +60,19 @@ function RegisterForm() {
5460 };
5561
5662 return (
57- <div class="relative mx-auto grid min-h-[calc(100vh-5rem)] max-w-5xl items-center gap-8 lg:grid-cols-2">
58- <div class="hero-panel relative order-2 hidden overflow-hidden rounded-[2rem] border border-border/60 p-10 lg:order-1 lg:block">
59- <p class="text-xs font-semibold uppercase tracking-[0.16em] text-primary">{t("app.name")}</p>
60- <h1 class="mt-4 font-display text-4xl font-semibold leading-tight">{t("auth.createStudent")}</h1>
61- <p class="mt-4 max-w-sm text-sm leading-relaxed text-muted-foreground">
62- {t("auth.registerSubtitle")}
63- </p>
64- </div>
65-
66- <div class="surface-card order-1 mx-auto w-full max-w-md p-6 sm:p-8 lg:order-2">
67- <div class="mb-6 flex items-start justify-between gap-3">
68- <div>
69- <h2 class="font-display text-2xl font-semibold">{t("auth.registerTitle")}</h2>
70- <p class="mt-1 text-sm text-muted-foreground">{t("auth.registerSubtitle")}</p>
71- </div>
72- <div class="flex items-center gap-1">
73- <LocaleSwitcher />
74- <ThemeToggle />
75- </div>
63+ <div class="-mx-4 -my-6 flex h-[calc(100dvh-3.5rem)] items-center justify-center overflow-hidden px-4 sm:-mx-6 sm:px-6 lg:-mx-8 lg:-my-8 lg:px-8">
64+ <div class="surface-card w-full max-w-sm p-8 shadow-lg">
65+ <div class="mb-8 text-center">
66+ <h1 class="font-display text-3xl font-semibold tracking-tight">{t("auth.registerTitle")}</h1>
67+ <p class="mt-1.5 text-sm text-muted-foreground">{t("auth.registerSubtitle")}</p>
7668 </div>
7769
78- <form class="space-y-4" onSubmit={handleSubmit}>
79- <div class="space-y-1.5">
70+ <form class="space-y-5" onSubmit={handleSubmit}>
71+ <div class="space-y-2">
8072 <Label for="register-username">{t("auth.username")}</Label>
8173 <Input
8274 id="register-username"
83- class="h-11 rounded-sm"
75+ class="h-11"
8476 autocomplete="username"
8577 minlength={3}
8678 maxlength={32}
@@ -89,29 +81,59 @@ function RegisterForm() {
8981 onInput={(e) => setUsername(e.currentTarget.value)}
9082 />
9183 </div>
92- <div class="space-y-1.5">
84+
85+ <div class="space-y-2">
9386 <Label for="register-password">{t("auth.password")}</Label>
87+ <div class="relative">
88+ <Input
89+ id="register-password"
90+ class="h-11 pr-10"
91+ type={showPassword() ? "text" : "password"}
92+ autocomplete="new-password"
93+ minlength={6}
94+ maxlength={128}
95+ required
96+ value={password()}
97+ onInput={(e) => setPassword(e.currentTarget.value)}
98+ />
99+ <button
100+ type="button"
101+ onClick={() => setShowPassword(!showPassword())}
102+ class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground"
103+ aria-label={showPassword() ? t("auth.hidePassword") : t("auth.showPassword")}
104+ >
105+ <Show when={showPassword()} fallback={<IconEye class="h-4 w-4" />}>
106+ <IconEyeOff class="h-4 w-4" />
107+ </Show>
108+ </button>
109+ </div>
110+ </div>
111+
112+ <div class="space-y-2">
113+ <Label for="register-confirm">{t("auth.confirmPassword")}</Label>
94114 <Input
95- id="register-password"
96- class="h-11 rounded-sm"
97- type="password"
115+ id="register-confirm"
116+ class="h-11"
117+ type={showPassword() ? "text" : "password"}
98118 autocomplete="new-password"
99119 minlength={6}
100120 maxlength={128}
101121 required
102- value={password()}
103- onInput={(e) => setPassword(e.currentTarget.value)}
122+ value={confirmPassword()}
123+ onInput={(e) => setConfirmPassword(e.currentTarget.value)}
104124 />
105125 </div>
126+
106127 {error() && (
107- <p class="rounded-sm bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p>
128+ <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p>
108129 )}
109- <Button type="submit" class="h-11 w-full rounded-sm text-base" disabled={pending()}>
130+
131+ <Button type="submit" class="h-11 w-full text-base" disabled={pending()}>
110132 {t("auth.register")}
111133 </Button>
112134 </form>
113135
114- <p class="mt-6 text-center text-sm text-muted-foreground">
136+ <p class="mt-8 text-center text-sm text-muted-foreground">
115137 {t("auth.hasAccount")}{" "}
116138 <Link to="/login" class="font-semibold text-primary underline-offset-4 hover:underline">
117139 {t("auth.login")}