forge
Explore
Log in

Don't you dare go Hollow

🐛 stabilize app providers and event attendance

Browse files at this commit

36e9dc2d8fe1efae390168912590d1ebc765dbf4Burak BoduroğluParent: f3c5b9d
  • fix
    • 🐛 stabilize app providers and event attendance
Show full message
fix: 🐛 stabilize app providers and event attendance

- keep preferences and auth providers inside the router root route

- use a context-free router pending fallback

- remove student self-attendance controls from event detail

- filter event attendance user search to students only

- refresh event and exam copy for student-only attendance and education items
src/app.tsxmodified+1 -17
@@ -1,22 +1,6 @@
11 import { RouterProvider } from "@tanstack/solid-router";
2-import { Suspense, lazy } from "solid-js";
3-import { AuthProvider } from "@/stores/auth-context";
4-import { PreferencesProvider } from "@/stores/preferences-context";
52 import { router } from "@/routes/router";
63
7-const RouterDevtools = import.meta.env.DEV ? lazy(() => import("./router-devtools")) : undefined;
8-
94 export function App() {
10- return (
11- <PreferencesProvider>
12- <AuthProvider>
13- <RouterProvider router={router} />
14- {RouterDevtools ? (
15- <Suspense>
16- <RouterDevtools />
17- </Suspense>
18- ) : null}
19- </AuthProvider>
20- </PreferencesProvider>
21- );
5+ return <RouterProvider router={router} />;
226 }
src/i18n/messages.tsmodified+32 -32
@@ -703,12 +703,12 @@ const en: Dict = {
703703 "dashboard.continueGuide": "Guide",
704704 "dashboard.portal.sections": "Sections",
705705 "dashboard.portal.coursesDesc": "Browse courses, study sessions, and materials.",
706- "dashboard.portal.examsDesc": "Upcoming exams, deadlines, and results.",
707- "dashboard.portal.eventsDesc": "Sessions, meetups, and attendance.",
706+ "dashboard.portal.examsDesc": "Course exams, deadlines, and results.",
707+ "dashboard.portal.eventsDesc": "Events with student attendance records.",
708708 "dashboard.portal.marksDesc": "Your grades and overall report card.",
709709 "dashboard.portal.notesDesc": "Private scratchpad for quick ideas.",
710710 "dashboard.portal.usersDesc": "Manage user accounts and roles.",
711- "dashboard.portal.attendanceDesc": "Mark and review attendance records.",
711+ "dashboard.portal.attendanceDesc": "Review student attendance records.",
712712 "dashboard.portal.workDesc": "Track your work hours and shifts.",
713713 "dashboard.portal.studentMarksDesc": "View and grade student results.",
714714 "dashboard.portal.settingsDesc": "System preferences and configuration.",
@@ -732,7 +732,7 @@ const en: Dict = {
732732 "notes.helpBody":
733733 "Notes are private to you only. Title max 200 characters, content max 10,000. Delete and update open a confirmation dialog with a short summary before they run.",
734734 "events.title": "Events",
735- "events.subtitle": "Sessions, meetups, and attendance in one list.",
735+ "events.subtitle": "Events and student attendance records in one list.",
736736 "events.create": "Create event",
737737 "events.empty": "No events yet.",
738738 "events.starts": "Starts",
@@ -741,17 +741,17 @@ const en: Dict = {
741741 "events.markOther": "Mark another person",
742742 "events.myAttendance": "My attendance",
743743 "events.myAttendanceHelp": "Choose your event status and save it.",
744- "events.studentAttendance": "Participant attendance",
745- "events.studentAttendanceHelp": "Select a user, choose a status, then save the record.",
744+ "events.studentAttendance": "Student attendance",
745+ "events.studentAttendanceHelp": "Select a student, choose a status, then save the record.",
746746 "events.saveStudentAttendance": "Save attendance",
747747 "events.attendance": "Attendance roster",
748748 "events.attendanceRecords": "Attendance records",
749- "events.attendanceRecordsHelp": "Saved event attendance, including who recorded each row.",
749+ "events.attendanceRecordsHelp": "Saved student attendance for this event, including who recorded each row.",
750750 "events.noAttendance": "No attendance rows yet.",
751- "events.attendee": "Attendee",
752- "events.selectAttendee": "Search user",
753- "events.noAttendees": "No users found",
754- "events.userId": "User id",
751+ "events.attendee": "Student",
752+ "events.selectAttendee": "Search student",
753+ "events.noAttendees": "No students found",
754+ "events.userId": "Student id",
755755 "events.status": "Status",
756756 "events.audience": "Audience",
757757 "events.audience.school": "Whole school",
@@ -765,13 +765,13 @@ const en: Dict = {
765765 "events.audienceCapacityInvalid": "Capacity must be at least 1.",
766766 "events.helpTitle": "About events",
767767 "events.helpBody":
768- "Students mark themselves present / absent / late / excused with the big status buttons, then save attendance. Teachers create events and can mark others by user id. Managers can edit any event.",
768+ "Teachers and managers record attendance for students only. Managers can edit any event.",
769769 "events.clearStart": "Will clear start time",
770770 "events.clearEnd": "Will clear end time",
771771 "events.upcoming": "Upcoming",
772772 "events.past": "Past",
773773 "exams.title": "Exams",
774- "exams.subtitle": "All exams across courses — create them under a course.",
774+ "exams.subtitle": "All exams across courses and study sessions — create them under an education item.",
775775 "exams.create": "Create exam",
776776 "exams.searchPlaceholder": "Search exams…",
777777 "exams.selectCourse": "Select course",
@@ -858,7 +858,7 @@ const en: Dict = {
858858 "attempt.absent": "No-show",
859859 "exams.helpTitle": "About exams",
860860 "exams.helpBody":
861- "Exams belong to a course. Teachers add them from the course page with a kind; weighting is defined by the exam kind. Students only see their own mark (or “not graded yet”). Weighted averages appear on the report card.",
861+ "Exams belong to an education item. Teachers add them from that detail page with a kind; weighting is defined by the exam kind. Students only see their own mark (or “not graded yet”). Weighted averages appear on the report card.",
862862 "admin.title": "People & roles",
863863 "admin.subtitle": "Promote or demote accounts. You can’t change your own role.",
864864 "admin.username": "Username",
@@ -879,13 +879,13 @@ const en: Dict = {
879879 "Private scratchpad. Create, edit, delete — delete/update ask for confirmation with a short summary.",
880880 "guide.step3.title": "3. Events & attendance",
881881 "guide.step3.body":
882- "Open an event, pick present/absent/late/excused, save attendance. Teachers can mark others.",
882+ "Teachers and managers open an event, select a student, then save present/absent/late/excused attendance.",
883883 "guide.step4.title": "4. Education",
884884 "guide.step4.body":
885885 "Teachers create a course or study session, enroll students, then add exams by kind inside it.",
886886 "guide.step5.title": "5. Exams",
887887 "guide.step5.body":
888- "List all exams here. New exams are created from a course page (not from this list).",
888+ "List all exams here. New exams are created from an education detail page, not from this list.",
889889 "guide.step6.title": "6. Report card",
890890 "guide.step6.body":
891891 "Your weighted course averages and overall average. Teachers can look up any student.",
@@ -1256,12 +1256,12 @@ const tr: Dict = {
12561256 "dashboard.continueGuide": "Rehber",
12571257 "dashboard.portal.sections": "Bölümler",
12581258 "dashboard.portal.coursesDesc": "Dersleri, etütleri ve materyalleri görüntüle.",
1259- "dashboard.portal.examsDesc": "Sınavlar, son teslim tarihleri ve sonuçlar.",
1260- "dashboard.portal.eventsDesc": "Oturumlar, etkinlikler ve yoklama.",
1259+ "dashboard.portal.examsDesc": "Ders/etüt sınavları, tarihler ve sonuçlar.",
1260+ "dashboard.portal.eventsDesc": "Öğrenci yoklamalı etkinlikler.",
12611261 "dashboard.portal.marksDesc": "Notların ve genel karnen.",
12621262 "dashboard.portal.notesDesc": "Hızlı fikirler için özel not defteri.",
12631263 "dashboard.portal.usersDesc": "Kullanıcı hesaplarını ve rollerini yönet.",
1264- "dashboard.portal.attendanceDesc": "Yoklama kayıtlarını işaretle ve incele.",
1264+ "dashboard.portal.attendanceDesc": "Öğrenci yoklama kayıtlarını incele.",
12651265 "dashboard.portal.workDesc": "Çalışma saatlerini ve mesainizi takip edin.",
12661266 "dashboard.portal.studentMarksDesc": "Öğrenci sonuçlarını görüntüle ve notlandır.",
12671267 "dashboard.portal.settingsDesc": "Sistem tercihleri ve yapılandırma.",
@@ -1285,7 +1285,7 @@ const tr: Dict = {
12851285 "notes.helpBody":
12861286 "Notlar yalnızca sana aittir. Başlık en fazla 200, içerik 10.000 karakter. Silme ve güncelleme özetli onay penceresi ister.",
12871287 "events.title": "Etkinlikler",
1288- "events.subtitle": "Oturumlar, buluşmalar ve yoklama tek listede.",
1288+ "events.subtitle": "Etkinlikler ve öğrenci yoklama kayıtları tek listede.",
12891289 "events.create": "Etkinlik oluştur",
12901290 "events.empty": "Henüz etkinlik yok.",
12911291 "events.starts": "Başlangıç",
@@ -1294,17 +1294,17 @@ const tr: Dict = {
12941294 "events.markOther": "Başkasını işaretle",
12951295 "events.myAttendance": "Katılım durumum",
12961296 "events.myAttendanceHelp": "Etkinlik durumunu seç ve kaydet.",
1297- "events.studentAttendance": "Katılımcı yoklaması",
1298- "events.studentAttendanceHelp": "Kullanıcıyı seç, durumunu belirle, kaydı kaydet.",
1297+ "events.studentAttendance": "Öğrenci yoklaması",
1298+ "events.studentAttendanceHelp": "Öğrenciyi seç, durumunu belirle, kaydı kaydet.",
12991299 "events.saveStudentAttendance": "Yoklamayı kaydet",
13001300 "events.attendance": "Yoklama listesi",
13011301 "events.attendanceRecords": "Yoklama kayıtları",
1302- "events.attendanceRecordsHelp": "Kaydedilmiş etkinlik yoklaması ve kaydı kimin girdiği.",
1302+ "events.attendanceRecordsHelp": "Bu etkinlik için kaydedilmiş öğrenci yoklaması ve kaydı kimin girdiği.",
13031303 "events.noAttendance": "Henüz yoklama kaydı yok.",
1304- "events.attendee": "Katılımcı",
1305- "events.selectAttendee": "Kullanıcı ara",
1306- "events.noAttendees": "Kullanıcı bulunamadı",
1307- "events.userId": "Kullanıcı id",
1304+ "events.attendee": "Öğrenci",
1305+ "events.selectAttendee": "Öğrenci ara",
1306+ "events.noAttendees": "Öğrenci bulunamadı",
1307+ "events.userId": "Öğrenci id",
13081308 "events.status": "Durum",
13091309 "events.audience": "Hedef kitle",
13101310 "events.audience.school": "Tüm okul",
@@ -1318,13 +1318,13 @@ const tr: Dict = {
13181318 "events.audienceCapacityInvalid": "Kapasite en az 1 olmalı.",
13191319 "events.helpTitle": "Etkinlikler hakkında",
13201320 "events.helpBody":
1321- "Öğrenciler büyük durum butonlarıyla var/yok/geç/mazeretli seçip yoklamayı kaydeder. Öğretmenler etkinlik oluşturur ve başkasını işaretleyebilir. Yöneticiler her etkinliği düzenleyebilir.",
1321+ "Öğretmenler ve yöneticiler yalnız öğrenciler için yoklama kaydeder. Yöneticiler her etkinliği düzenleyebilir.",
13221322 "events.clearStart": "Başlangıç saati temizlenecek",
13231323 "events.clearEnd": "Bitiş saati temizlenecek",
13241324 "events.upcoming": "Yaklaşan",
13251325 "events.past": "Geçmiş",
13261326 "exams.title": "Sınavlar",
1327- "exams.subtitle": "Tüm derslerin sınavları — yeni sınav ders içinden eklenir.",
1327+ "exams.subtitle": "Tüm ders ve etüt sınavları — yeni sınav eğitim kaydı içinden eklenir.",
13281328 "exams.create": "Sınav oluştur",
13291329 "exams.searchPlaceholder": "Sınav ara…",
13301330 "exams.selectCourse": "Ders seç",
@@ -1411,7 +1411,7 @@ const tr: Dict = {
14111411 "attempt.absent": "Katılmadı",
14121412 "exams.helpTitle": "Sınavlar hakkında",
14131413 "exams.helpBody":
1414- "Sınavlar bir derse aittir. Öğretmenler ders sayfasından tür seçerek ekler; ağırlık sınav türünde tanımlıdır. Öğrenciler yalnızca kendi notunu görür. Ağırlıklı ortalamalar Karnem’dedir.",
1414+ "Sınavlar bir eğitim kaydına aittir. Öğretmenler detay sayfasından tür seçerek ekler; ağırlık sınav türünde tanımlıdır. Öğrenciler yalnızca kendi notunu görür. Ağırlıklı ortalamalar Karnem’dedir.",
14151415 "admin.title": "Kişiler ve roller",
14161416 "admin.subtitle": "Hesapları yükselt / düşür. Kendi rolünü değiştiremezsin.",
14171417 "admin.username": "Kullanıcı adı",
@@ -1432,13 +1432,13 @@ const tr: Dict = {
14321432 "Özel defter. Oluştur, düzenle, sil — silme/güncelleme özetli onay ister.",
14331433 "guide.step3.title": "3. Etkinlik ve yoklama",
14341434 "guide.step3.body":
1435- "Etkinliği aç, var/yok/geç/mazeretli seç, yoklamayı kaydet. Öğretmen başkasını işaretleyebilir.",
1435+ "Öğretmenler ve yöneticiler etkinliği açar, öğrenciyi seçer ve var/yok/geç/mazeretli yoklama kaydeder.",
14361436 "guide.step4.title": "4. Eğitim",
14371437 "guide.step4.body":
14381438 "Öğretmen ders veya etüt oluşturur, öğrenci kaydeder, içine türe göre sınav ekler.",
14391439 "guide.step5.title": "5. Sınavlar",
14401440 "guide.step5.body":
1441- "Tüm sınavlar burada listelenir. Yeni sınav bu listeden değil, ders sayfasından eklenir.",
1441+ "Tüm sınavlar burada listelenir. Yeni sınav bu listeden değil, eğitim detayından eklenir.",
14421442 "guide.step6.title": "6. Karnem",
14431443 "guide.step6.body":
14441444 "Ders ortalamaları ve genel ortalama. Öğretmen herhangi bir öğrencinin karnesine bakabilir.",
src/pages/event-detail-page.tsxmodified+31 -55
@@ -195,77 +195,53 @@ function EventDetailContent() {
195195 />
196196 </SidePanel>
197197
198- <div class="grid gap-4 lg:grid-cols-2">
198+ <Show when={isTeacherPlus()}>
199199 <section class="data-shell p-4">
200200 <div>
201- <h2 class="font-display text-lg font-semibold">{t("events.myAttendance")}</h2>
202- <p class="mt-1 text-sm text-muted-foreground">{t("events.myAttendanceHelp")}</p>
201+ <h2 class="font-display text-lg font-semibold">{t("events.studentAttendance")}</h2>
202+ <p class="mt-1 text-sm text-muted-foreground">{t("events.studentAttendanceHelp")}</p>
203203 </div>
204- <div class="mt-4 space-y-3">
205- <AttendanceStatusPicker value={status()} onChange={setStatus} label={t("events.status")} />
204+ <div class="mt-4 grid gap-3">
205+ <UserSearchSelect
206+ id="other-user"
207+ label={t("events.attendee")}
208+ value={otherUserId()}
209+ placeholder={t("events.selectAttendee")}
210+ emptyMessage={t("events.noAttendees")}
211+ role="student"
212+ onChange={setOtherUserId}
213+ />
214+ <AttendanceStatusPicker
215+ id="other-status"
216+ value={status()}
217+ onChange={setStatus}
218+ label={t("events.status")}
219+ />
206220 <Button
207221 type="button"
208222 class="w-full rounded-sm sm:w-auto"
209223 disabled={pending()}
210224 onClick={() =>
211225 void wrap(async () => {
212- await postEventAttendance(id(), { status: status() });
226+ const uid = otherUserId().trim();
227+ if (!uid) {
228+ setError(t("events.userIdRequired"));
229+ return;
230+ }
231+ await postEventAttendance(id(), {
232+ status: status(),
233+ user_id: uid,
234+ });
235+ setOtherUserId("");
213236 if (attendanceOpen()) await refetchAttendance();
214237 })
215238 }
216239 >
217- {t("common.saveAttendance")}
240+ {t("events.saveStudentAttendance")}
218241 </Button>
219242 </div>
220243 </section>
221-
222- <Show when={isTeacherPlus()}>
223- <section class="data-shell p-4">
224- <div>
225- <h2 class="font-display text-lg font-semibold">{t("events.studentAttendance")}</h2>
226- <p class="mt-1 text-sm text-muted-foreground">{t("events.studentAttendanceHelp")}</p>
227- </div>
228- <div class="mt-4 grid gap-3">
229- <UserSearchSelect
230- id="other-user"
231- label={t("events.attendee")}
232- value={otherUserId()}
233- placeholder={t("events.selectAttendee")}
234- emptyMessage={t("events.noAttendees")}
235- onChange={setOtherUserId}
236- />
237- <AttendanceStatusPicker
238- id="other-status"
239- value={status()}
240- onChange={setStatus}
241- label={t("events.status")}
242- />
243- <Button
244- type="button"
245- class="w-full rounded-sm sm:w-auto"
246- disabled={pending()}
247- onClick={() =>
248- void wrap(async () => {
249- const uid = otherUserId().trim();
250- if (!uid) {
251- setError(t("events.userIdRequired"));
252- return;
253- }
254- await postEventAttendance(id(), {
255- status: status(),
256- user_id: uid,
257- });
258- setOtherUserId("");
259- if (attendanceOpen()) await refetchAttendance();
260- })
261- }
262- >
263- {t("events.saveStudentAttendance")}
264- </Button>
265- </div>
266- </section>
267- </Show>
268- </div>
244+ </Show>
269245
270246 {error() && (
271247 <p class="rounded-sm bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p>
src/routes/router.tsxmodified+21 -4
@@ -12,6 +12,10 @@ import { ApiError } from "@/api/client";
1212 import { Suspense, createRenderEffect, createRoot, lazy, type Component } from "solid-js";
1313 import { AppShell } from "@/components/layout/app-shell";
1414 import { PageSpinner } from "@/components/ui/page-spinner";
15+import { AuthProvider } from "@/stores/auth-context";
16+import { PreferencesProvider } from "@/stores/preferences-context";
17+
18+const RouterDevtools = import.meta.env.DEV ? lazy(() => import("@/router-devtools")) : undefined;
1519
1620 function lazyRoute(loader: () => Promise<{ default: Component }>): Component {
1721 const Page = lazy(loader);
@@ -50,9 +54,18 @@ const GuidePage = lazyRoute(() => import("@/pages/guide-page"));
5054
5155 function RootComponent() {
5256 return (
53- <AppShell>
54- <Outlet />
55- </AppShell>
57+ <PreferencesProvider>
58+ <AuthProvider>
59+ <AppShell>
60+ <Outlet />
61+ </AppShell>
62+ {RouterDevtools ? (
63+ <Suspense>
64+ <RouterDevtools />
65+ </Suspense>
66+ ) : null}
67+ </AuthProvider>
68+ </PreferencesProvider>
5669 );
5770 }
5871
@@ -354,9 +367,13 @@ const routeTree = rootRoute.addChildren([
354367 guideRoute,
355368 ]);
356369
370+function RouterPending() {
371+ return <div class="min-h-screen bg-background" />;
372+}
373+
357374 export const router = createRouter({
358375 routeTree,
359- defaultPendingComponent: PageSpinner,
376+ defaultPendingComponent: RouterPending,
360377 defaultPreload: "intent",
361378 scrollRestoration: true,
362379 });