From 7fe966e6a8f5dd9e37c199599c7d134fffc2b802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Sun, 13 Sep 2026 12:13:45 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=8D=BD=EF=B8=8F=20staff=20meal=20d?= =?UTF-8?q?etail=20no=20longer=20crashes,=20board=20roster=20shows=20names?= =?UTF-8?q?=20-=20meal=20detail=20passed=20""=20as=20the=20student=20id=20?= =?UTF-8?q?before=20one=20was=20chosen;=20Solid=20=20=20still=20fetches=20?= =?UTF-8?q?on=20an=20empty=20string,=20so=20/meals/profiles/=20404'd=20and?= =?UTF-8?q?=20the=20error=20=20=20boundary=20replaced=20the=20whole=20page?= =?UTF-8?q?=20for=20managers=20and=20admins;=20it=20is=20null=20now=20-=20?= =?UTF-8?q?whiteboard=20roster=20resolved=20names=20only=20from=20the=20ad?= =?UTF-8?q?min-only=20/users=20list,=20so=20=20=20teachers=20and=20student?= =?UTF-8?q?s=20saw=20raw=20participant=20ids;=20below=20admin=20each=20ros?= =?UTF-8?q?ter=20id=20=20=20is=20resolved=20through=20its=20public=20profi?= =?UTF-8?q?le=20(parents=20keep=20the=20id=20on=20a=20403)=20-=20coverage?= =?UTF-8?q?=20doc=20maps=20the=20exam=20room,=20live=20monitor,=20whiteboa?= =?UTF-8?q?rd=20canvas,=20meal=20=20=20detail,=20user=20profile=20and=20lo?= =?UTF-8?q?gin=20captures,=20and=20the=20aligned=20brand=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/ui/figma-migration-coverage.md | 16 ++++++++++------ src/pages/meal-detail-page.tsx | 6 ++++-- src/pages/whiteboard-page.tsx | 28 +++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/docs/ui/figma-migration-coverage.md b/docs/ui/figma-migration-coverage.md index 742f5e9..3be06ab 100644 --- a/docs/ui/figma-migration-coverage.md +++ b/docs/ui/figma-migration-coverage.md @@ -39,6 +39,10 @@ badge). Each screen overrides only its open group and active row. When the nav tree changes in code, update the sidebar component, not individual screens. `Web / Switch` (Off/On) backs module and review toggles. +Color variables `brand/default`, `brand/hover`, `brand/accent`, `text/link` +and `border/focus` carry the app's values (#00ADD8 brand, #046B86 light +focus ring), so Figma and the app no longer differ on the brand color. + The shell matches the app too: `Web / Sidebar / *` is full height with the `Brand / Logo Mark` row on top and the account row at the bottom, and `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. | Route | Figma coverage | Migration rule | |---|---|---| | `/` | Admin, teacher, student, parent dashboards | Restyle role branches; keep read-only, API-backed data | -| `/login` | SYS-01 | Visual migration; keep current auth contract | +| `/login` | SYS-01 Giriş | Captured from the running app; the earlier e-mail/SSO design lives on the `90 Arşiv` page | | `/courses`, `/courses/:id` | Teacher/student classes and mobile lessons | Reuse current course/enrollment behavior | | `/homework`, `/homework/:id` | Teacher/student homework | Reuse DataTable, submissions, files, and role gates | | `/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. | `/questions`, `/questions/:id` | TCH-15 Soru Havuzu, STU-13 Soru Detayı | Captured from the running app | | `/notes` | STU-12 Defter | Captured from the running app | | `/guide`, `/profile/me`, `/register` | SYS-08 Rehber, SYS-09 Profilim, SYS-10 Kayıt Ol | Captured from the running app | +| `/exam-room/:id` | STU-14 Sınav Odası | Captured from the running app (attempt in progress) | +| `/exams/:id/live` | TCH-16 Canlı Sınav İzleme | Captured from the running app | +| `/whiteboards/:id` | TCH-17 Tahta Çizim Ekranı | Captured from the running app | +| `/meals/:id` | ADM-28 Yemek Menüsü Detayı | Captured from the running app (staff view) | +| `/profile/:userId` | ADM-29 Kullanıcı Profili | Captured from the running app | | `/builder/login` | BLD-01 Operatör Girişi | Builder session only; linked from the SYS-01/login footer | | `/builder` | BLD-02 Okullar, BLD-02a Yeni Okul | Create, suspend/activate, delete | | `/builder/schools/:slug` | BLD-03 Okul Detayı, BLD-03a Okula Gir | Module switchboard, password reset, enter as admin | @@ -128,12 +137,7 @@ false actions: Keep the current UI and behavior until a specific design is added: -- `/profile/:userId` (another user's profile) -- `/exam-room/:id` -- `/exams/:id/live` -- `/whiteboards/:id` live canvas details beyond the list concept - `/students/attendance`, `/students/exams`, `/students/study` parent tab routes -- `/meals/:id` detailed account/service/management tabs - `/studies`, `/clubs`, and `/attendance` redirect aliases ## Asset policy diff --git a/src/pages/meal-detail-page.tsx b/src/pages/meal-detail-page.tsx index 642f48e..d1fe688 100644 --- a/src/pages/meal-detail-page.tsx +++ b/src/pages/meal-detail-page.tsx @@ -95,7 +95,9 @@ function MealDetailContent() { createEffect(() => { if (isParent() && !selectedStudent() && children()?.items[0]) setSelectedStudent(children()!.items[0].id); }); - const targetId = () => isStudent() ? auth.user()!.id : isParent() ? selectedStudent() : lookupStudent(); + // null, not "", until a student is chosen: createResource still fetches on an + // empty-string source, and `/meals/profiles/` 404s the whole page for staff. + const targetId = () => (isStudent() ? auth.user()!.id : isParent() ? selectedStudent() : lookupStudent()) || null; const canBook = () => (isStudent() || isParent()) && !!targetId(); const [bookings, { refetch: refetchBookings }] = createResource(() => canBook(), async (enabled) => enabled ? getMyMealBookings({ limit: 100 }) : null); @@ -229,7 +231,7 @@ function MealDetailContent() {

{activeBooking() ? t("meals.booked") : t("meals.notBooked")}

{cutoffClosed() ? t("meals.cutoffPassed") : t("meals.bookingHelp")}

- void run(async () => { await postMealBooking(id(), isParent() ? targetId() : undefined); await Promise.all([refetchBookings(), refetchBalance(), refetchLedger()]); }, t("meals.booked"))}>{t("meals.book")}}> + void run(async () => { await postMealBooking(id(), isParent() ? targetId() ?? undefined : undefined); await Promise.all([refetchBookings(), refetchBalance(), refetchLedger()]); }, t("meals.booked"))}>{t("meals.book")}}>
diff --git a/src/pages/whiteboard-page.tsx b/src/pages/whiteboard-page.tsx index d1e2a05..74c7c56 100644 --- a/src/pages/whiteboard-page.tsx +++ b/src/pages/whiteboard-page.tsx @@ -9,7 +9,7 @@ import { postBoardClear, postBoardClose, } from "@/api/boards"; -import { getUsers } from "@/api/users"; +import { getUserProfile, getUsers } from "@/api/users"; import { formatApiError } from "@/api/client"; import type { MessageKey } from "@/i18n/messages"; import { WhiteboardRoom, type BoardLiveState } from "@/components/whiteboard/whiteboard-room-ws"; @@ -116,12 +116,13 @@ function WhiteboardContent() { if (me) return [me.name, me.surname].filter(Boolean).join(" ") || me.username; } const u = (users() ?? []).find((x) => x.id === userId); - if (!u) return userId; + if (!u) return profiles.latest?.get(userId)?.name ?? userId; return [u.name, u.surname].filter(Boolean).join(" ") || u.username; }; const roleOf = (userId: string) => { const u = (users() ?? []).find((x) => x.id === userId); - return u ? t(`role.${u.role}` as MessageKey) : ""; + const role = u?.role ?? profiles.latest?.get(userId)?.role ?? (userId === meId() ? auth.user()?.role : undefined); + return role ? t(`role.${role}` as MessageKey) : ""; }; const roster = () => { const creator = live().creator; @@ -130,6 +131,27 @@ function WhiteboardContent() { }; const isParticipant = () => roster().includes(meId()); + // Below admin, resolve each roster id through its public profile — any + // signed-in account may read one (a parent only their linked students; the + // rest 403 and keep the id). The roster is small and capped by the backend. + const [profiles] = createResource( + () => (isAdmin() ? null : roster().filter((userId) => userId !== meId()).sort().join(",") || null), + async (key) => { + const entries = await Promise.all( + key.split(",").map(async (userId) => { + try { + const p = await getUserProfile(userId); + return [userId, { name: p.display_name || p.username, role: p.role }] as const; + } catch { + return null; + } + }), + ); + return new Map(entries.filter((entry) => entry !== null)); + }, + ); + + const [error, setError] = createSignal(""); const [busy, setBusy] = createSignal(false); const [clearOpen, setClearOpen] = createSignal(false);