forge
Explore
Log in

Don't you dare go Hollow

🍽️ staff meal detail no longer crashes, board roster shows names

Browse files at this commit

7fe966e6a8f5dd9e37c199599c7d134fffc2b802Burak BoduroğluParent: d19a43d
  • fix
    • 🍽️ staff meal detail no longer crashes, board roster shows names
Show full message
fix: 🍽️ staff meal detail no longer crashes, board roster shows names
- meal detail passed "" as the student id before one was chosen; Solid
  still fetches on an empty string, so /meals/profiles/ 404'd and the error
  boundary replaced the whole page for managers and admins; it is null now
- whiteboard roster resolved names only from the admin-only /users list, so
  teachers and students saw raw participant ids; below admin each roster id
  is resolved through its public profile (parents keep the id on a 403)
- coverage doc maps the exam room, live monitor, whiteboard canvas, meal
  detail, user profile and login captures, and the aligned brand variables
docs/ui/figma-migration-coverage.mdmodified+10 -6
@@ -39,6 +39,10 @@ badge). Each screen overrides only its open group and active row. When the
3939 nav tree changes in code, update the sidebar component, not individual
4040 screens. `Web / Switch` (Off/On) backs module and review toggles.
4141
42+Color variables `brand/default`, `brand/hover`, `brand/accent`, `text/link`
43+and `border/focus` carry the app's values (#00ADD8 brand, #046B86 light
44+focus ring), so Figma and the app no longer differ on the brand color.
45+
4246 The shell matches the app too: `Web / Sidebar / *` is full height with the
4347 `Brand / Logo Mark` row on top and the account row at the bottom, and
4448 `Web / Top Bar` is the 1180px content header (back, route label, command
@@ -69,7 +73,7 @@ were swapped for these component instances; their content is raw layers.
6973 | Route | Figma coverage | Migration rule |
7074 |---|---|---|
7175 | `/` | Admin, teacher, student, parent dashboards | Restyle role branches; keep read-only, API-backed data |
72-| `/login` | SYS-01 | Visual migration; keep current auth contract |
76+| `/login` | SYS-01 Giriş | Captured from the running app; the earlier e-mail/SSO design lives on the `90 Arşiv` page |
7377 | `/courses`, `/courses/:id` | Teacher/student classes and mobile lessons | Reuse current course/enrollment behavior |
7478 | `/homework`, `/homework/:id` | Teacher/student homework | Reuse DataTable, submissions, files, and role gates |
7579 | `/exams`, `/exams/:id` | Admin/teacher/student exams and results | Keep draft/publish, attempts, grading, and statistics gates |
@@ -100,6 +104,11 @@ were swapped for these component instances; their content is raw layers.
100104 | `/questions`, `/questions/:id` | TCH-15 Soru Havuzu, STU-13 Soru Detayı | Captured from the running app |
101105 | `/notes` | STU-12 Defter | Captured from the running app |
102106 | `/guide`, `/profile/me`, `/register` | SYS-08 Rehber, SYS-09 Profilim, SYS-10 Kayıt Ol | Captured from the running app |
107+| `/exam-room/:id` | STU-14 Sınav Odası | Captured from the running app (attempt in progress) |
108+| `/exams/:id/live` | TCH-16 Canlı Sınav İzleme | Captured from the running app |
109+| `/whiteboards/:id` | TCH-17 Tahta Çizim Ekranı | Captured from the running app |
110+| `/meals/:id` | ADM-28 Yemek Menüsü Detayı | Captured from the running app (staff view) |
111+| `/profile/:userId` | ADM-29 Kullanıcı Profili | Captured from the running app |
103112 | `/builder/login` | BLD-01 Operatör Girişi | Builder session only; linked from the SYS-01/login footer |
104113 | `/builder` | BLD-02 Okullar, BLD-02a Yeni Okul | Create, suspend/activate, delete |
105114 | `/builder/schools/:slug` | BLD-03 Okul Detayı, BLD-03a Okula Gir | Module switchboard, password reset, enter as admin |
@@ -128,12 +137,7 @@ false actions:
128137
129138 Keep the current UI and behavior until a specific design is added:
130139
131-- `/profile/:userId` (another user's profile)
132-- `/exam-room/:id`
133-- `/exams/:id/live`
134-- `/whiteboards/:id` live canvas details beyond the list concept
135140 - `/students/attendance`, `/students/exams`, `/students/study` parent tab routes
136-- `/meals/:id` detailed account/service/management tabs
137141 - `/studies`, `/clubs`, and `/attendance` redirect aliases
138142
139143 ## Asset policy
src/pages/meal-detail-page.tsxmodified+4 -2
@@ -95,7 +95,9 @@ function MealDetailContent() {
9595 createEffect(() => {
9696 if (isParent() && !selectedStudent() && children()?.items[0]) setSelectedStudent(children()!.items[0].id);
9797 });
98- const targetId = () => isStudent() ? auth.user()!.id : isParent() ? selectedStudent() : lookupStudent();
98+ // null, not "", until a student is chosen: createResource still fetches on an
99+ // empty-string source, and `/meals/profiles/` 404s the whole page for staff.
100+ const targetId = () => (isStudent() ? auth.user()!.id : isParent() ? selectedStudent() : lookupStudent()) || null;
99101 const canBook = () => (isStudent() || isParent()) && !!targetId();
100102
101103 const [bookings, { refetch: refetchBookings }] = createResource(() => canBook(), async (enabled) => enabled ? getMyMealBookings({ limit: 100 }) : null);
@@ -229,7 +231,7 @@ function MealDetailContent() {
229231 <Show when={canBook()}>
230232 <div class="data-shell flex flex-wrap items-center justify-between gap-3 p-4">
231233 <div><p class="font-semibold">{activeBooking() ? t("meals.booked") : t("meals.notBooked")}</p><p class="text-sm text-muted-foreground">{cutoffClosed() ? t("meals.cutoffPassed") : t("meals.bookingHelp")}</p></div>
232- <Show when={activeBooking()} fallback={<Button disabled={pending() || cutoffClosed()} onClick={() => void run(async () => { await postMealBooking(id(), isParent() ? targetId() : undefined); await Promise.all([refetchBookings(), refetchBalance(), refetchLedger()]); }, t("meals.booked"))}>{t("meals.book")}</Button>}><Button variant="destructive" disabled={pending() || cutoffClosed()} onClick={() => setCancelOpen(true)}>{t("meals.cancelBooking")}</Button></Show>
234+ <Show when={activeBooking()} fallback={<Button disabled={pending() || cutoffClosed()} onClick={() => void run(async () => { await postMealBooking(id(), isParent() ? targetId() ?? undefined : undefined); await Promise.all([refetchBookings(), refetchBalance(), refetchLedger()]); }, t("meals.booked"))}>{t("meals.book")}</Button>}><Button variant="destructive" disabled={pending() || cutoffClosed()} onClick={() => setCancelOpen(true)}>{t("meals.cancelBooking")}</Button></Show>
233235 </div>
234236 </Show>
235237 </TabsContent>
src/pages/whiteboard-page.tsxmodified+25 -3
@@ -9,7 +9,7 @@ import {
99 postBoardClear,
1010 postBoardClose,
1111 } from "@/api/boards";
12-import { getUsers } from "@/api/users";
12+import { getUserProfile, getUsers } from "@/api/users";
1313 import { formatApiError } from "@/api/client";
1414 import type { MessageKey } from "@/i18n/messages";
1515 import { WhiteboardRoom, type BoardLiveState } from "@/components/whiteboard/whiteboard-room-ws";
@@ -116,12 +116,13 @@ function WhiteboardContent() {
116116 if (me) return [me.name, me.surname].filter(Boolean).join(" ") || me.username;
117117 }
118118 const u = (users() ?? []).find((x) => x.id === userId);
119- if (!u) return userId;
119+ if (!u) return profiles.latest?.get(userId)?.name ?? userId;
120120 return [u.name, u.surname].filter(Boolean).join(" ") || u.username;
121121 };
122122 const roleOf = (userId: string) => {
123123 const u = (users() ?? []).find((x) => x.id === userId);
124- return u ? t(`role.${u.role}` as MessageKey) : "";
124+ const role = u?.role ?? profiles.latest?.get(userId)?.role ?? (userId === meId() ? auth.user()?.role : undefined);
125+ return role ? t(`role.${role}` as MessageKey) : "";
125126 };
126127 const roster = () => {
127128 const creator = live().creator;
@@ -130,6 +131,27 @@ function WhiteboardContent() {
130131 };
131132 const isParticipant = () => roster().includes(meId());
132133
134+ // Below admin, resolve each roster id through its public profile — any
135+ // signed-in account may read one (a parent only their linked students; the
136+ // rest 403 and keep the id). The roster is small and capped by the backend.
137+ const [profiles] = createResource(
138+ () => (isAdmin() ? null : roster().filter((userId) => userId !== meId()).sort().join(",") || null),
139+ async (key) => {
140+ const entries = await Promise.all(
141+ key.split(",").map(async (userId) => {
142+ try {
143+ const p = await getUserProfile(userId);
144+ return [userId, { name: p.display_name || p.username, role: p.role }] as const;
145+ } catch {
146+ return null;
147+ }
148+ }),
149+ );
150+ return new Map(entries.filter((entry) => entry !== null));
151+ },
152+ );
153+
154+
133155 const [error, setError] = createSignal("");
134156 const [busy, setBusy] = createSignal(false);
135157 const [clearOpen, setClearOpen] = createSignal(false);