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 @@
1 import { RouterProvider } from "@tanstack/solid-router";1 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";
5 import { router } from "@/routes/router";2 import { router } from "@/routes/router";
6 3
7-const RouterDevtools = import.meta.env.DEV ? lazy(() => import("./router-devtools")) : undefined;
8-
9 export function App() {4 export function App() {
10- return (5+ return <RouterProvider router={router} />;
11- <PreferencesProvider>
12- <AuthProvider>
13- <RouterProvider router={router} />
14- {RouterDevtools ? (
15- <Suspense>
16- <RouterDevtools />
17- </Suspense>
18- ) : null}
19- </AuthProvider>
20- </PreferencesProvider>
21- );
22 }6 }
src/i18n/messages.tsmodified+32 -32
@@ -703,12 +703,12 @@ const en: Dict = {
703 "dashboard.continueGuide": "Guide",703 "dashboard.continueGuide": "Guide",
704 "dashboard.portal.sections": "Sections",704 "dashboard.portal.sections": "Sections",
705 "dashboard.portal.coursesDesc": "Browse courses, study sessions, and materials.",705 "dashboard.portal.coursesDesc": "Browse courses, study sessions, and materials.",
706- "dashboard.portal.examsDesc": "Upcoming exams, deadlines, and results.",706+ "dashboard.portal.examsDesc": "Course exams, deadlines, and results.",
707- "dashboard.portal.eventsDesc": "Sessions, meetups, and attendance.",707+ "dashboard.portal.eventsDesc": "Events with student attendance records.",
708 "dashboard.portal.marksDesc": "Your grades and overall report card.",708 "dashboard.portal.marksDesc": "Your grades and overall report card.",
709 "dashboard.portal.notesDesc": "Private scratchpad for quick ideas.",709 "dashboard.portal.notesDesc": "Private scratchpad for quick ideas.",
710 "dashboard.portal.usersDesc": "Manage user accounts and roles.",710 "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.",
712 "dashboard.portal.workDesc": "Track your work hours and shifts.",712 "dashboard.portal.workDesc": "Track your work hours and shifts.",
713 "dashboard.portal.studentMarksDesc": "View and grade student results.",713 "dashboard.portal.studentMarksDesc": "View and grade student results.",
714 "dashboard.portal.settingsDesc": "System preferences and configuration.",714 "dashboard.portal.settingsDesc": "System preferences and configuration.",
@@ -732,7 +732,7 @@ const en: Dict = {
732 "notes.helpBody":732 "notes.helpBody":
733 "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.",733 "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.",
734 "events.title": "Events",734 "events.title": "Events",
735- "events.subtitle": "Sessions, meetups, and attendance in one list.",735+ "events.subtitle": "Events and student attendance records in one list.",
736 "events.create": "Create event",736 "events.create": "Create event",
737 "events.empty": "No events yet.",737 "events.empty": "No events yet.",
738 "events.starts": "Starts",738 "events.starts": "Starts",
@@ -741,17 +741,17 @@ const en: Dict = {
741 "events.markOther": "Mark another person",741 "events.markOther": "Mark another person",
742 "events.myAttendance": "My attendance",742 "events.myAttendance": "My attendance",
743 "events.myAttendanceHelp": "Choose your event status and save it.",743 "events.myAttendanceHelp": "Choose your event status and save it.",
744- "events.studentAttendance": "Participant attendance",744+ "events.studentAttendance": "Student attendance",
745- "events.studentAttendanceHelp": "Select a user, choose a status, then save the record.",745+ "events.studentAttendanceHelp": "Select a student, choose a status, then save the record.",
746 "events.saveStudentAttendance": "Save attendance",746 "events.saveStudentAttendance": "Save attendance",
747 "events.attendance": "Attendance roster",747 "events.attendance": "Attendance roster",
748 "events.attendanceRecords": "Attendance records",748 "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.",
750 "events.noAttendance": "No attendance rows yet.",750 "events.noAttendance": "No attendance rows yet.",
751- "events.attendee": "Attendee",751+ "events.attendee": "Student",
752- "events.selectAttendee": "Search user",752+ "events.selectAttendee": "Search student",
753- "events.noAttendees": "No users found",753+ "events.noAttendees": "No students found",
754- "events.userId": "User id",754+ "events.userId": "Student id",
755 "events.status": "Status",755 "events.status": "Status",
756 "events.audience": "Audience",756 "events.audience": "Audience",
757 "events.audience.school": "Whole school",757 "events.audience.school": "Whole school",
@@ -765,13 +765,13 @@ const en: Dict = {
765 "events.audienceCapacityInvalid": "Capacity must be at least 1.",765 "events.audienceCapacityInvalid": "Capacity must be at least 1.",
766 "events.helpTitle": "About events",766 "events.helpTitle": "About events",
767 "events.helpBody":767 "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.",
769 "events.clearStart": "Will clear start time",769 "events.clearStart": "Will clear start time",
770 "events.clearEnd": "Will clear end time",770 "events.clearEnd": "Will clear end time",
771 "events.upcoming": "Upcoming",771 "events.upcoming": "Upcoming",
772 "events.past": "Past",772 "events.past": "Past",
773 "exams.title": "Exams",773 "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.",
775 "exams.create": "Create exam",775 "exams.create": "Create exam",
776 "exams.searchPlaceholder": "Search exams…",776 "exams.searchPlaceholder": "Search exams…",
777 "exams.selectCourse": "Select course",777 "exams.selectCourse": "Select course",
@@ -858,7 +858,7 @@ const en: Dict = {
858 "attempt.absent": "No-show",858 "attempt.absent": "No-show",
859 "exams.helpTitle": "About exams",859 "exams.helpTitle": "About exams",
860 "exams.helpBody":860 "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.",
862 "admin.title": "People & roles",862 "admin.title": "People & roles",
863 "admin.subtitle": "Promote or demote accounts. You can’t change your own role.",863 "admin.subtitle": "Promote or demote accounts. You can’t change your own role.",
864 "admin.username": "Username",864 "admin.username": "Username",
@@ -879,13 +879,13 @@ const en: Dict = {
879 "Private scratchpad. Create, edit, delete — delete/update ask for confirmation with a short summary.",879 "Private scratchpad. Create, edit, delete — delete/update ask for confirmation with a short summary.",
880 "guide.step3.title": "3. Events & attendance",880 "guide.step3.title": "3. Events & attendance",
881 "guide.step3.body":881 "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.",
883 "guide.step4.title": "4. Education",883 "guide.step4.title": "4. Education",
884 "guide.step4.body":884 "guide.step4.body":
885 "Teachers create a course or study session, enroll students, then add exams by kind inside it.",885 "Teachers create a course or study session, enroll students, then add exams by kind inside it.",
886 "guide.step5.title": "5. Exams",886 "guide.step5.title": "5. Exams",
887 "guide.step5.body":887 "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.",
889 "guide.step6.title": "6. Report card",889 "guide.step6.title": "6. Report card",
890 "guide.step6.body":890 "guide.step6.body":
891 "Your weighted course averages and overall average. Teachers can look up any student.",891 "Your weighted course averages and overall average. Teachers can look up any student.",
@@ -1256,12 +1256,12 @@ const tr: Dict = {
1256 "dashboard.continueGuide": "Rehber",1256 "dashboard.continueGuide": "Rehber",
1257 "dashboard.portal.sections": "Bölümler",1257 "dashboard.portal.sections": "Bölümler",
1258 "dashboard.portal.coursesDesc": "Dersleri, etütleri ve materyalleri görüntüle.",1258 "dashboard.portal.coursesDesc": "Dersleri, etütleri ve materyalleri görüntüle.",
1259- "dashboard.portal.examsDesc": "Sınavlar, son teslim tarihleri ve sonuçlar.",1259+ "dashboard.portal.examsDesc": "Ders/etüt sınavları, tarihler ve sonuçlar.",
1260- "dashboard.portal.eventsDesc": "Oturumlar, etkinlikler ve yoklama.",1260+ "dashboard.portal.eventsDesc": "Öğrenci yoklamalı etkinlikler.",
1261 "dashboard.portal.marksDesc": "Notların ve genel karnen.",1261 "dashboard.portal.marksDesc": "Notların ve genel karnen.",
1262 "dashboard.portal.notesDesc": "Hızlı fikirler için özel not defteri.",1262 "dashboard.portal.notesDesc": "Hızlı fikirler için özel not defteri.",
1263 "dashboard.portal.usersDesc": "Kullanıcı hesaplarını ve rollerini yönet.",1263 "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.",
1265 "dashboard.portal.workDesc": "Çalışma saatlerini ve mesainizi takip edin.",1265 "dashboard.portal.workDesc": "Çalışma saatlerini ve mesainizi takip edin.",
1266 "dashboard.portal.studentMarksDesc": "Öğrenci sonuçlarını görüntüle ve notlandır.",1266 "dashboard.portal.studentMarksDesc": "Öğrenci sonuçlarını görüntüle ve notlandır.",
1267 "dashboard.portal.settingsDesc": "Sistem tercihleri ve yapılandırma.",1267 "dashboard.portal.settingsDesc": "Sistem tercihleri ve yapılandırma.",
@@ -1285,7 +1285,7 @@ const tr: Dict = {
1285 "notes.helpBody":1285 "notes.helpBody":
1286 "Notlar yalnızca sana aittir. Başlık en fazla 200, içerik 10.000 karakter. Silme ve güncelleme özetli onay penceresi ister.",1286 "Notlar yalnızca sana aittir. Başlık en fazla 200, içerik 10.000 karakter. Silme ve güncelleme özetli onay penceresi ister.",
1287 "events.title": "Etkinlikler",1287 "events.title": "Etkinlikler",
1288- "events.subtitle": "Oturumlar, buluşmalar ve yoklama tek listede.",1288+ "events.subtitle": "Etkinlikler ve öğrenci yoklama kayıtları tek listede.",
1289 "events.create": "Etkinlik oluştur",1289 "events.create": "Etkinlik oluştur",
1290 "events.empty": "Henüz etkinlik yok.",1290 "events.empty": "Henüz etkinlik yok.",
1291 "events.starts": "Başlangıç",1291 "events.starts": "Başlangıç",
@@ -1294,17 +1294,17 @@ const tr: Dict = {
1294 "events.markOther": "Başkasını işaretle",1294 "events.markOther": "Başkasını işaretle",
1295 "events.myAttendance": "Katılım durumum",1295 "events.myAttendance": "Katılım durumum",
1296 "events.myAttendanceHelp": "Etkinlik durumunu seç ve kaydet.",1296 "events.myAttendanceHelp": "Etkinlik durumunu seç ve kaydet.",
1297- "events.studentAttendance": "Katılımcı yoklaması",1297+ "events.studentAttendance": "Öğrenci yoklaması",
1298- "events.studentAttendanceHelp": "Kullanıcıyı seç, durumunu belirle, kaydı kaydet.",1298+ "events.studentAttendanceHelp": "Öğrenciyi seç, durumunu belirle, kaydı kaydet.",
1299 "events.saveStudentAttendance": "Yoklamayı kaydet",1299 "events.saveStudentAttendance": "Yoklamayı kaydet",
1300 "events.attendance": "Yoklama listesi",1300 "events.attendance": "Yoklama listesi",
1301 "events.attendanceRecords": "Yoklama kayıtları",1301 "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.",
1303 "events.noAttendance": "Henüz yoklama kaydı yok.",1303 "events.noAttendance": "Henüz yoklama kaydı yok.",
1304- "events.attendee": "Katılımcı",1304+ "events.attendee": "Öğrenci",
1305- "events.selectAttendee": "Kullanıcı ara",1305+ "events.selectAttendee": "Öğrenci ara",
1306- "events.noAttendees": "Kullanıcı bulunamadı",1306+ "events.noAttendees": "Öğrenci bulunamadı",
1307- "events.userId": "Kullanıcı id",1307+ "events.userId": "Öğrenci id",
1308 "events.status": "Durum",1308 "events.status": "Durum",
1309 "events.audience": "Hedef kitle",1309 "events.audience": "Hedef kitle",
1310 "events.audience.school": "Tüm okul",1310 "events.audience.school": "Tüm okul",
@@ -1318,13 +1318,13 @@ const tr: Dict = {
1318 "events.audienceCapacityInvalid": "Kapasite en az 1 olmalı.",1318 "events.audienceCapacityInvalid": "Kapasite en az 1 olmalı.",
1319 "events.helpTitle": "Etkinlikler hakkında",1319 "events.helpTitle": "Etkinlikler hakkında",
1320 "events.helpBody":1320 "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.",
1322 "events.clearStart": "Başlangıç saati temizlenecek",1322 "events.clearStart": "Başlangıç saati temizlenecek",
1323 "events.clearEnd": "Bitiş saati temizlenecek",1323 "events.clearEnd": "Bitiş saati temizlenecek",
1324 "events.upcoming": "Yaklaşan",1324 "events.upcoming": "Yaklaşan",
1325 "events.past": "Geçmiş",1325 "events.past": "Geçmiş",
1326 "exams.title": "Sınavlar",1326 "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.",
1328 "exams.create": "Sınav oluştur",1328 "exams.create": "Sınav oluştur",
1329 "exams.searchPlaceholder": "Sınav ara…",1329 "exams.searchPlaceholder": "Sınav ara…",
1330 "exams.selectCourse": "Ders seç",1330 "exams.selectCourse": "Ders seç",
@@ -1411,7 +1411,7 @@ const tr: Dict = {
1411 "attempt.absent": "Katılmadı",1411 "attempt.absent": "Katılmadı",
1412 "exams.helpTitle": "Sınavlar hakkında",1412 "exams.helpTitle": "Sınavlar hakkında",
1413 "exams.helpBody":1413 "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.",
1415 "admin.title": "Kişiler ve roller",1415 "admin.title": "Kişiler ve roller",
1416 "admin.subtitle": "Hesapları yükselt / düşür. Kendi rolünü değiştiremezsin.",1416 "admin.subtitle": "Hesapları yükselt / düşür. Kendi rolünü değiştiremezsin.",
1417 "admin.username": "Kullanıcı adı",1417 "admin.username": "Kullanıcı adı",
@@ -1432,13 +1432,13 @@ const tr: Dict = {
1432 "Özel defter. Oluştur, düzenle, sil — silme/güncelleme özetli onay ister.",1432 "Özel defter. Oluştur, düzenle, sil — silme/güncelleme özetli onay ister.",
1433 "guide.step3.title": "3. Etkinlik ve yoklama",1433 "guide.step3.title": "3. Etkinlik ve yoklama",
1434 "guide.step3.body":1434 "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.",
1436 "guide.step4.title": "4. Eğitim",1436 "guide.step4.title": "4. Eğitim",
1437 "guide.step4.body":1437 "guide.step4.body":
1438 "Öğretmen ders veya etüt oluşturur, öğrenci kaydeder, içine türe göre sınav ekler.",1438 "Öğretmen ders veya etüt oluşturur, öğrenci kaydeder, içine türe göre sınav ekler.",
1439 "guide.step5.title": "5. Sınavlar",1439 "guide.step5.title": "5. Sınavlar",
1440 "guide.step5.body":1440 "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.",
1442 "guide.step6.title": "6. Karnem",1442 "guide.step6.title": "6. Karnem",
1443 "guide.step6.body":1443 "guide.step6.body":
1444 "Ders ortalamaları ve genel ortalama. Öğretmen herhangi bir öğrencinin karnesine bakabilir.",1444 "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() {
195 />195 />
196 </SidePanel>196 </SidePanel>
197 197
198- <div class="grid gap-4 lg:grid-cols-2">198+ <Show when={isTeacherPlus()}>
199 <section class="data-shell p-4">199 <section class="data-shell p-4">
200 <div>200 <div>
201- <h2 class="font-display text-lg font-semibold">{t("events.myAttendance")}</h2>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.myAttendanceHelp")}</p>202+ <p class="mt-1 text-sm text-muted-foreground">{t("events.studentAttendanceHelp")}</p>
203 </div>203 </div>
204- <div class="mt-4 space-y-3">204+ <div class="mt-4 grid gap-3">
205- <AttendanceStatusPicker value={status()} onChange={setStatus} label={t("events.status")} />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+ />
206 <Button220 <Button
207 type="button"221 type="button"
208 class="w-full rounded-sm sm:w-auto"222 class="w-full rounded-sm sm:w-auto"
209 disabled={pending()}223 disabled={pending()}
210 onClick={() =>224 onClick={() =>
211 void wrap(async () => {225 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("");
213 if (attendanceOpen()) await refetchAttendance();236 if (attendanceOpen()) await refetchAttendance();
214 })237 })
215 }238 }
216 >239 >
217- {t("common.saveAttendance")}240+ {t("events.saveStudentAttendance")}
218 </Button>241 </Button>
219 </div>242 </div>
220 </section>243 </section>
221-244+ </Show>
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>
269 245
270 {error() && (246 {error() && (
271 <p class="rounded-sm bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p>247 <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";
12 import { Suspense, createRenderEffect, createRoot, lazy, type Component } from "solid-js";12 import { Suspense, createRenderEffect, createRoot, lazy, type Component } from "solid-js";
13 import { AppShell } from "@/components/layout/app-shell";13 import { AppShell } from "@/components/layout/app-shell";
14 import { PageSpinner } from "@/components/ui/page-spinner";14 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;
15 19
16 function lazyRoute(loader: () => Promise<{ default: Component }>): Component {20 function lazyRoute(loader: () => Promise<{ default: Component }>): Component {
17 const Page = lazy(loader);21 const Page = lazy(loader);
@@ -50,9 +54,18 @@ const GuidePage = lazyRoute(() => import("@/pages/guide-page"));
50 54
51 function RootComponent() {55 function RootComponent() {
52 return (56 return (
53- <AppShell>57+ <PreferencesProvider>
54- <Outlet />58+ <AuthProvider>
55- </AppShell>59+ <AppShell>
60+ <Outlet />
61+ </AppShell>
62+ {RouterDevtools ? (
63+ <Suspense>
64+ <RouterDevtools />
65+ </Suspense>
66+ ) : null}
67+ </AuthProvider>
68+ </PreferencesProvider>
56 );69 );
57 }70 }
58 71
@@ -354,9 +367,13 @@ const routeTree = rootRoute.addChildren([
354 guideRoute,367 guideRoute,
355 ]);368 ]);
356 369
370+function RouterPending() {
371+ return <div class="min-h-screen bg-background" />;
372+}
373+
357 export const router = createRouter({374 export const router = createRouter({
358 routeTree,375 routeTree,
359- defaultPendingComponent: PageSpinner,376+ defaultPendingComponent: RouterPending,
360 defaultPreload: "intent",377 defaultPreload: "intent",
361 scrollRestoration: true,378 scrollRestoration: true,
362 });379 });