forge
Explore
Log in

Don't you dare go Hollow

🗺️ add comprehensive sitemap detailing app routes and access roles

Browse files at this commit

58b098f9b8df005fcc2a5a5e8dd40b225ad9d270Burak BoduroğluParent: f8b967c
  • feat
    • 🗺️ add comprehensive sitemap detailing app routes and access roles
Show full message
feat: 🗺️ add comprehensive sitemap detailing app routes and access roles
docs/frontend/sitemap.mdadded+159 -0
@@ -0,0 +1,159 @@
1+# Sitemap
2+
3+Every route in the app, how it is reached, and who may enter it.
4+
5+**Sources of truth** — this file is written by hand from them, so update it in the
6+same commit when either changes:
7+
8+- `src/routes/router.tsx` — the route table (paths, params, redirects)
9+- `src/components/layout/nav-items.ts` — sidebar grouping and per-role visibility
10+- `src/pages/*.tsx` — the `<RouteGuard>` each page wraps itself in
11+
12+Role rank (`src/lib/roles.ts`): `parent (-1) < student (0) < teacher (1) < manager (2) < admin (3)`.
13+`minRole` is inclusive-upward, `maxRole` inclusive-downward, `exactRole` matches one role only.
14+
15+## Entry flow
16+
17+```mermaid
18+flowchart LR
19+ Visit(["Open app"]) --> Guard{"Session?"}
20+ Guard -- "no" --> Login["/login"]
21+ Guard -- "yes" --> Home["/ — Dashboard"]
22+ Login -- "no account" --> Register["/register"]
23+ Register --> Login
24+ Login --> Home
25+```
26+
27+`RouteGuard` sends any unauthenticated visitor to `/login`; `guest-guard.tsx` does
28+the reverse for `/login` and `/register`. Neither auth page is in the sidebar.
29+
30+## Main sitemap
31+
32+Grouped exactly as the sidebar groups them. Bracketed labels are the role gate —
33+unmarked entries are visible to every signed-in role except `parent` (see
34+[Parent visibility](#parent-visibility)).
35+
36+```mermaid
37+flowchart TD
38+ Home["/ — Dashboard"]
39+
40+ Home --> Classes["Dersler"]
41+ Home --> Planning["Planlama"]
42+ Home --> Workspace["Çalışma alanı"]
43+ Home --> Students["Öğrenciler"]
44+ Home --> Services["Hizmetler"]
45+ Home --> Community["Topluluk"]
46+ Home --> School["Okul"]
47+
48+ Classes --> C1["/courses"]
49+ Classes --> C2["/homework"]
50+ Classes --> C3["/exams"]
51+ Classes --> C4["/question-bank<br/>teacher+"]
52+ Classes --> C5["/marks<br/>student only"]
53+
54+ Planning --> P1["/events"]
55+ Planning --> P2["/calendar"]
56+ Planning --> P3["/appointments"]
57+
58+ Workspace --> W1["/notes"]
59+ Workspace --> W2["/whiteboards<br/>student+"]
60+ Workspace --> W3["/pomodoro<br/>student only"]
61+
62+ Students --> S1["/students<br/>parent only"]
63+ Students --> S2["/management/classes<br/>teacher+"]
64+ Students --> S3["/management/student-marks<br/>teacher+"]
65+ Students --> S4["/management/student-attendance<br/>teacher+"]
66+ Students --> S5["/management/pomodoros<br/>teacher+"]
67+
68+ Services --> V1["/meals"]
69+ Services --> V2["/payments<br/>parent + student"]
70+
71+ Community --> M1["/messages"]
72+ Community --> M2["/questions<br/>student+"]
73+ Community --> M3["/work<br/>teacher..manager"]
74+
75+ School --> K1["/management/staff-work<br/>manager+"]
76+ School --> K2["/management/settings<br/>manager+"]
77+ School --> K3["/management/terms<br/>manager+"]
78+ School --> K4["/management/payments<br/>manager+"]
79+ School --> K5["/admin/users<br/>admin"]
80+```
81+
82+### Primary strip
83+
84+`PRIMARY_BY_ROLE` lifts a few of the above into the top strip / mobile tab bar
85+instead of the grouped sidebar:
86+
87+| Role | Primary items |
88+| --- | --- |
89+| student | `/` · `/courses` · `/calendar` · `/marks` |
90+| teacher, manager, admin | `/` · `/courses` · `/calendar` |
91+| parent | `/` · `/students` · `/calendar` |
92+
93+## Detail and nested routes
94+
95+Reached by drilling into a list, never from the sidebar.
96+
97+```mermaid
98+flowchart LR
99+ A["/events"] --> A1["/events/$id"]
100+ B["/homework"] --> B1["/homework/$id"]
101+ C["/exams"] --> C1["/exams/$id"]
102+ C1 --> C2["/exams/$id/live<br/>teacher+"]
103+ C1 --> C3["/exam-room/$id<br/>student only"]
104+ D["/question-bank<br/>teacher+"] --> D1["/question-bank/$id<br/>teacher+"]
105+ E["/courses"] --> E1["/courses/$id"]
106+ F["/questions<br/>student+"] --> F1["/questions/$id<br/>student+"]
107+ G["/meals"] --> G1["/meals/$id"]
108+ H["/management/classes<br/>teacher+"] --> H1["/management/classes/$id"]
109+ I["/admin/users<br/>admin"] --> I1["/admin/users/$id<br/>admin"]
110+ J["/whiteboards<br/>student+"] --> J1["/whiteboards/$id<br/>student+"]
111+ K["/management/payments<br/>manager+"] --> K1["/management/payments/$userId<br/>manager+"]
112+```
113+
114+`/management/payments/$userId` renders the same `PaymentsPage` component as the
115+list route — the param only deep-links a selected student.
116+
117+## Redirects
118+
119+| From | To | Why |
120+| --- | --- | --- |
121+| `/studies` | `/courses?kind=study` | Courses page filters by `kind` |
122+| `/clubs` | `/courses?kind=club` | same |
123+| `/attendance` | `/marks?tab=attendance` | attendance is a tab on the marks page |
124+
125+All three are `beforeLoad` redirects with no component of their own.
126+
127+## Route guards at a glance
128+
129+Route-level enforcement only — the sidebar hides more than this table blocks.
130+
131+| Guard | Routes |
132+| --- | --- |
133+| `admin` | `/admin/users`, `/admin/users/$id` |
134+| `manager+` | `/management/settings`, `/management/terms`, `/management/staff-work`, `/management/payments`, `/management/payments/$userId` |
135+| `teacher+` | `/question-bank`, `/question-bank/$id`, `/management/student-marks`, `/management/student-attendance`, `/management/pomodoros`, `/exams/$id/live` |
136+| `teacher..manager` | `/work` |
137+| `student+` | `/questions`, `/questions/$id`, `/whiteboards`, `/whiteboards/$id` |
138+| `student` only | `/marks`, `/pomodoro`, `/exam-room/$id` |
139+| `parent` only | `/students` |
140+| signed-in, no role gate | `/`, `/notes`, `/events`, `/events/$id`, `/homework`, `/homework/$id`, `/exams`, `/exams/$id`, `/courses`, `/courses/$id`, `/management/classes`, `/management/classes/$id`, `/calendar`, `/appointments`, `/meals`, `/meals/$id`, `/messages`, `/payments`, `/guide` |
141+
142+### Parent visibility
143+
144+`itemVisible()` in `nav-items.ts` ends with an allowlist: a `parent` sees an
145+otherwise-ungated item only when its path is `/`, `/calendar`, `/appointments`,
146+`/meals` or `/messages`. Every other ungated route above is hidden from a parent's
147+sidebar but has no `RouteGuard`, so it stays reachable by typing the URL — the
148+data those pages show is scoped by the backend, not by the router.
149+
150+The same gap applies to `/payments` (the personal statement page): the sidebar
151+shows it at `maxRole: "student"` (parent and student), while the route itself is
152+ungated.
153+
154+## Not in the sitemap
155+
156+- `/guide` — the in-app help page, reached from the account dropdown at the foot
157+ of the sidebar (`sidebar-account.tsx`), not from a nav group.
158+- `/login`, `/register` — pre-auth, covered in [Entry flow](#entry-flow).
159+- 404 — `notFoundComponent` on the root route, links back to `/`.