🧭 rebuild the navigation tree from the Figma design
Browse files at this commit0691d474dd7dedf2d74eb7de2f6b30ef0a860b79Parent: 8e721b9- feat
- 🧭 rebuild the navigation tree from the Figma design
10 changed files +650 -234
- src/components/layout/app-shell.tsx +7 -1
- src/components/layout/command-palette.tsx +4 -0
- src/components/layout/mobile-nav-sheet.tsx +35 -13
- src/components/layout/nav-items.test.ts +121 -47
- src/components/layout/nav-items.ts +173 -116
- src/components/layout/side-nav.tsx +58 -47
- src/components/ui/icons.tsx +35 -0
- src/i18n/messages.ts +127 -10
- src/pages/coming-soon-page.tsx +58 -0
- src/routes/router.tsx +32 -0
src/components/layout/app-shell.tsxmodified+7 -1
| @@ -93,7 +93,11 @@ export function AppShell(props: ParentProps) { | ||
| 93 | 93 | </div> |
| 94 | 94 | |
| 95 | 95 | <div class="min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-1.5 py-2.5"> |
| 96 | - <SideNav collapsed={collapsed()} /> | |
| 96 | + <SideNav | |
| 97 | + collapsed={collapsed()} | |
| 98 | + onOpenCelebi={() => setCelebiOpen(true)} | |
| 99 | + onOpenProfile={() => setProfileOpen(true)} | |
| 100 | + /> | |
| 97 | 101 | </div> |
| 98 | 102 | |
| 99 | 103 | <SidebarAccount collapsed={collapsed()} onLogout={logout} /> |
| @@ -105,6 +109,8 @@ export function AppShell(props: ParentProps) { | ||
| 105 | 109 | open={mobileOpen()} |
| 106 | 110 | onClose={() => setMobileOpen(false)} |
| 107 | 111 | onLogout={logout} |
| 112 | + onOpenCelebi={() => setCelebiOpen(true)} | |
| 113 | + onOpenProfile={() => setProfileOpen(true)} | |
| 108 | 114 | /> |
| 109 | 115 | </Show> |
| 110 | 116 |
src/components/layout/command-palette.tsxmodified+4 -0
| @@ -205,6 +205,10 @@ export function CommandPalette(props: CommandPaletteProps) { | ||
| 205 | 205 | for (const group of visibleNavGroups(userRole, modules.enabled())) { |
| 206 | 206 | const groupName = t(group.labelKey); |
| 207 | 207 | for (const item of group.items) { |
| 208 | + // Çelebi and the account-settings entries open an existing shell | |
| 209 | + // surface rather than a route — the palette already offers both | |
| 210 | + // above, wired to the panel/dialog directly. | |
| 211 | + if (item.action) continue; | |
| 208 | 212 | list.push({ |
| 209 | 213 | id: `page-${item.to}`, |
| 210 | 214 | category: "pages", |
src/components/layout/mobile-nav-sheet.tsxmodified+35 -13
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | import { For, Show, createSignal } from "solid-js"; |
| 2 | 2 | import { Link, useRouterState } from "@tanstack/solid-router"; |
| 3 | -import { routeNavItem, sidebarNavGroups, type NavItem } from "@/components/layout/nav-items"; | |
| 3 | +import { routeNavItem, visibleNavGroups, type NavItem } from "@/components/layout/nav-items"; | |
| 4 | 4 | import { SidebarAccount } from "@/components/layout/sidebar-account"; |
| 5 | 5 | import { IconX } from "@/components/ui/icons"; |
| 6 | 6 | import { cn } from "@/lib/cn"; |
| @@ -27,6 +27,8 @@ export function MobileNavSheet(props: { | ||
| 27 | 27 | open: boolean; |
| 28 | 28 | onClose: () => void; |
| 29 | 29 | onLogout: () => void | Promise<void>; |
| 30 | + onOpenCelebi?: () => void; | |
| 31 | + onOpenProfile?: () => void; | |
| 30 | 32 | }) { |
| 31 | 33 | const auth = useAuth(); |
| 32 | 34 | const t = useT(); |
| @@ -36,9 +38,14 @@ export function MobileNavSheet(props: { | ||
| 36 | 38 | |
| 37 | 39 | // The primary destinations are already one tap away in the tab bar, so the |
| 38 | 40 | // sheet lists everything else. |
| 39 | - const groups = () => sidebarNavGroups(auth.user()?.role, modules.enabled()); | |
| 41 | + const groups = () => visibleNavGroups(auth.user()?.role, modules.enabled()); | |
| 40 | 42 | const current = () => routeNavItem(pathname(), auth.user()?.role); |
| 41 | 43 | const badgeFor = (item: NavItem) => (item.id === "messages" ? feed.unreadMessages().total : 0); |
| 44 | + const runAction = (item: NavItem) => { | |
| 45 | + props.onClose(); | |
| 46 | + if (item.action === "celebi") props.onOpenCelebi?.(); | |
| 47 | + if (item.action === "profile") props.onOpenProfile?.(); | |
| 48 | + }; | |
| 42 | 49 | |
| 43 | 50 | // Drag-to-dismiss. Only the grab area drives it, so a flick inside the list |
| 44 | 51 | // still scrolls the list. While dragging, the sheet follows the finger with |
| @@ -135,16 +142,12 @@ export function MobileNavSheet(props: { | ||
| 135 | 142 | <For each={group.items}> |
| 136 | 143 | {(item) => { |
| 137 | 144 | const active = () => current()?.id === item.id; |
| 138 | - return ( | |
| 139 | - <Link | |
| 140 | - to={item.to} | |
| 141 | - onClick={props.onClose} | |
| 142 | - aria-current={active() ? "page" : undefined} | |
| 143 | - class={cn( | |
| 144 | - "flex items-center gap-2.5 rounded-md px-3 py-1.5 transition-colors active:bg-muted", | |
| 145 | - active() ? "text-primary" : "text-foreground", | |
| 146 | - )} | |
| 147 | - > | |
| 145 | + const rowClass = cn( | |
| 146 | + "flex w-full items-center gap-2.5 rounded-md px-3 py-1.5 text-left transition-colors active:bg-muted", | |
| 147 | + active() ? "text-primary" : "text-foreground", | |
| 148 | + ); | |
| 149 | + const content = ( | |
| 150 | + <> | |
| 148 | 151 | <span |
| 149 | 152 | class={cn( |
| 150 | 153 | "inline-flex size-7 shrink-0 items-center justify-center rounded-md", |
| @@ -156,12 +159,31 @@ export function MobileNavSheet(props: { | ||
| 156 | 159 | <span class="min-w-0 flex-1 truncate text-[13px] font-medium"> |
| 157 | 160 | {t(item.labelKey)} |
| 158 | 161 | </span> |
| 162 | + <Show when={item.soon}> | |
| 163 | + <span class="shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground"> | |
| 164 | + {t("nav.soon")} | |
| 165 | + </span> | |
| 166 | + </Show> | |
| 159 | 167 | <Show when={badgeFor(item) > 0}> |
| 160 | 168 | <span class="flex h-5 min-w-5 items-center justify-center rounded-full bg-rose-500 px-1.5 text-[10px] font-bold text-white"> |
| 161 | 169 | {badgeFor(item) > 99 ? "99+" : badgeFor(item)} |
| 162 | 170 | </span> |
| 163 | 171 | </Show> |
| 164 | - </Link> | |
| 172 | + </> | |
| 173 | + ); | |
| 174 | + return ( | |
| 175 | + <Show | |
| 176 | + when={!item.action} | |
| 177 | + fallback={ | |
| 178 | + <button type="button" onClick={() => runAction(item)} class={rowClass}> | |
| 179 | + {content} | |
| 180 | + </button> | |
| 181 | + } | |
| 182 | + > | |
| 183 | + <Link to={item.to} onClick={props.onClose} aria-current={active() ? "page" : undefined} class={rowClass}> | |
| 184 | + {content} | |
| 185 | + </Link> | |
| 186 | + </Show> | |
| 165 | 187 | ); |
| 166 | 188 | }} |
| 167 | 189 | </For> |
src/components/layout/nav-items.test.tsmodified+121 -47
| @@ -1,70 +1,138 @@ | ||
| 1 | -import { moduleVisible, pathActive, primaryNavItems, primaryPathActive, routeLabelKey, routeNavItem, sidebarNavGroups, visibleNavItems } from "@/components/layout/nav-items"; | |
| 1 | +import { moduleVisible, pathActive, primaryNavItems, primaryPathActive, routeLabelKey, routeNavItem, visibleNavGroups, visibleNavItems } from "@/components/layout/nav-items"; | |
| 2 | 2 | |
| 3 | 3 | test.each([ |
| 4 | - ["student", ["/", "/courses", "/calendar", "/marks"]], | |
| 5 | - ["teacher", ["/", "/courses", "/calendar"]], | |
| 6 | - ["manager", ["/", "/courses", "/calendar"]], | |
| 7 | - ["admin", ["/", "/courses", "/calendar"]], | |
| 8 | - ["parent", ["/", "/students", "/calendar"]], | |
| 4 | + ["student", ["/", "/exams", "/marks"]], | |
| 5 | + ["teacher", ["/", "/management/classes", "/calendar"]], | |
| 6 | + ["manager", ["/", "/management/classes", "/exams"]], | |
| 7 | + ["admin", ["/", "/management/classes", "/exams"]], | |
| 8 | + ["parent", ["/", "/students", "/appointments"]], | |
| 9 | 9 | ] as const)("%s gets role-specific primary destinations", (role, expected) => { |
| 10 | 10 | expect(primaryNavItems(role).map((item) => item.to)).toEqual(expected); |
| 11 | 11 | }); |
| 12 | 12 | |
| 13 | 13 | test("invalid role destinations stay hidden", () => { |
| 14 | - expect(visibleNavItems("student").map((item) => item.to)).not.toContain("/school"); | |
| 15 | - expect(visibleNavItems("parent").map((item) => item.to)).not.toContain("/courses"); | |
| 16 | 14 | expect(visibleNavItems("teacher").map((item) => item.to)).not.toContain("/admin/users"); |
| 15 | + expect(visibleNavItems("student").map((item) => item.to)).not.toContain("/admin/users"); | |
| 16 | + expect(visibleNavItems("parent").map((item) => item.to)).not.toContain("/management/staff-work"); | |
| 17 | 17 | }); |
| 18 | 18 | |
| 19 | -test("student secondary navigation follows the academic, planning, workspace, services, community flow", () => { | |
| 19 | +test("admin's sidebar mirrors the Figma Operasyon / Yapay zekâ / Kurum tree", () => { | |
| 20 | 20 | expect( |
| 21 | - sidebarNavGroups("student").map((group) => ({ | |
| 21 | + visibleNavGroups("admin").map((group) => ({ | |
| 22 | 22 | id: group.id, |
| 23 | 23 | items: group.items.map((item) => item.id), |
| 24 | 24 | })), |
| 25 | 25 | ).toEqual([ |
| 26 | - { id: "classes", items: ["homework", "exams"] }, | |
| 27 | - { id: "planning", items: ["events", "appointments"] }, | |
| 28 | - { id: "workspace", items: ["notes", "whiteboards", "pomodoro"] }, | |
| 29 | - { id: "services", items: ["meals", "payment-statement"] }, | |
| 30 | - { id: "community", items: ["messages", "questions"] }, | |
| 26 | + { | |
| 27 | + id: "operations", | |
| 28 | + items: [ | |
| 29 | + "students-roster", | |
| 30 | + "teachers-roster", | |
| 31 | + "class-groups", | |
| 32 | + "schedule", | |
| 33 | + "student-attendance", | |
| 34 | + "exams", | |
| 35 | + "question-bank", | |
| 36 | + "mock-exams", | |
| 37 | + "optical-reading", | |
| 38 | + "payments-collection", | |
| 39 | + ], | |
| 40 | + }, | |
| 41 | + { id: "ai", items: ["hezarfen-zeka", "celebi", "sound-studio"] }, | |
| 42 | + { | |
| 43 | + id: "institution", | |
| 44 | + items: ["reports", "license-modules", "users", "data-protection", "school-meals", "staff-work", "settings"], | |
| 45 | + }, | |
| 31 | 46 | ]); |
| 32 | 47 | }); |
| 33 | 48 | |
| 34 | -test("parent's services group includes meals and payment-statement, consistent with every other role", () => { | |
| 35 | - const services = sidebarNavGroups("parent").find((group) => group.id === "services"); | |
| 36 | - expect(services?.items.map((item) => item.id)).toEqual(["meals", "payment-statement"]); | |
| 49 | +test("manager sees the same admin tree minus the admin-only entries", () => { | |
| 50 | + const institution = visibleNavGroups("manager").find((group) => group.id === "institution"); | |
| 51 | + expect(institution?.items.map((item) => item.id)).toEqual(["reports", "school-meals", "staff-work", "settings"]); | |
| 52 | + expect(institution?.items.map((item) => item.id)).not.toContain("license-modules"); | |
| 53 | + expect(institution?.items.map((item) => item.id)).not.toContain("users"); | |
| 54 | + expect(institution?.items.map((item) => item.id)).not.toContain("data-protection"); | |
| 37 | 55 | }); |
| 38 | 56 | |
| 39 | -test.each(["student", "parent", "teacher", "manager", "admin"] as const)( | |
| 40 | - "%s can reach every visible feature and appointments from the sidebar", | |
| 41 | - (role) => { | |
| 42 | - const paths = [ | |
| 43 | - ...primaryNavItems(role).map((item) => item.to), | |
| 44 | - ...sidebarNavGroups(role).flatMap((group) => group.items.map((item) => item.to)), | |
| 45 | - ]; | |
| 46 | - expect(new Set(paths)).toEqual(new Set(visibleNavItems(role).map((item) => item.to))); | |
| 47 | - expect(paths).toContain("/appointments"); | |
| 48 | - }, | |
| 49 | -); | |
| 57 | +test("teacher's sidebar mirrors the Figma Sınıfım / Yapay zekâ / Diğer tree", () => { | |
| 58 | + expect( | |
| 59 | + visibleNavGroups("teacher").map((group) => ({ | |
| 60 | + id: group.id, | |
| 61 | + items: group.items.map((item) => item.id), | |
| 62 | + })), | |
| 63 | + ).toEqual([ | |
| 64 | + { id: "my-classroom", items: ["my-classes", "my-schedule", "student-attendance", "homework", "exams", "whiteboards"] }, | |
| 65 | + { id: "ai", items: ["student-analysis", "pending-approvals", "question-generation", "sound-studio"] }, | |
| 66 | + { id: "other", items: ["parent-communication", "work", "settings-teacher"] }, | |
| 67 | + ]); | |
| 68 | +}); | |
| 69 | + | |
| 70 | +test("student's sidebar mirrors the Figma Çalışma / Yapay zekâ / Diğer tree", () => { | |
| 71 | + expect( | |
| 72 | + visibleNavGroups("student").map((group) => ({ | |
| 73 | + id: group.id, | |
| 74 | + items: group.items.map((item) => item.id), | |
| 75 | + })), | |
| 76 | + ).toEqual([ | |
| 77 | + { id: "study", items: ["study-plan", "topic-mastery", "exam-results", "my-homework", "whiteboards", "pomodoro"] }, | |
| 78 | + { id: "ai", items: ["celebi", "sound-studio"] }, | |
| 79 | + { id: "other", items: ["calendar", "settings-student"] }, | |
| 80 | + ]); | |
| 81 | +}); | |
| 82 | + | |
| 83 | +test("parent's sidebar mirrors the Figma Öğrencim / Kurum tree", () => { | |
| 84 | + expect( | |
| 85 | + visibleNavGroups("parent").map((group) => ({ | |
| 86 | + id: group.id, | |
| 87 | + items: group.items.map((item) => item.id), | |
| 88 | + })), | |
| 89 | + ).toEqual([ | |
| 90 | + { id: "my-student", items: ["progress-report", "absence", "child-exam-results", "child-study-plan"] }, | |
| 91 | + { id: "institution", items: ["payment-statement", "appointments", "settings-parent"] }, | |
| 92 | + ]); | |
| 93 | +}); | |
| 94 | + | |
| 95 | +test("appointments is a parent-only sidebar entry, matching the Figma parent screen", () => { | |
| 96 | + expect(visibleNavGroups("parent").flatMap((g) => g.items).map((i) => i.to)).toContain("/appointments"); | |
| 97 | + for (const role of ["student", "teacher", "manager", "admin"] as const) { | |
| 98 | + const paths = [...primaryNavItems(role).map((i) => i.to), ...visibleNavGroups(role).flatMap((g) => g.items.map((i) => i.to))]; | |
| 99 | + expect(paths).not.toContain("/appointments"); | |
| 100 | + } | |
| 101 | +}); | |
| 102 | + | |
| 103 | +test("entries with no backend yet are flagged soon and route to the shared placeholder", () => { | |
| 104 | + const hezarfenZeka = visibleNavGroups("admin") | |
| 105 | + .flatMap((g) => g.items) | |
| 106 | + .find((i) => i.id === "hezarfen-zeka"); | |
| 107 | + expect(hezarfenZeka?.soon).toBe(true); | |
| 108 | + expect(hezarfenZeka?.to).toBe("/coming-soon/hezarfen-zeka"); | |
| 109 | +}); | |
| 110 | + | |
| 111 | +test("Çelebi and account settings open an existing shell surface instead of navigating", () => { | |
| 112 | + const celebi = visibleNavGroups("student") | |
| 113 | + .flatMap((g) => g.items) | |
| 114 | + .find((i) => i.id === "celebi"); | |
| 115 | + expect(celebi?.action).toBe("celebi"); | |
| 116 | + const settings = visibleNavGroups("student") | |
| 117 | + .flatMap((g) => g.items) | |
| 118 | + .find((i) => i.id === "settings-student"); | |
| 119 | + expect(settings?.action).toBe("profile"); | |
| 120 | +}); | |
| 50 | 121 | |
| 51 | 122 | test("nested entity routes keep their primary destination active", () => { |
| 52 | - expect(pathActive("/courses/course-1", "/courses")).toBe(true); | |
| 53 | - expect(routeNavItem("/courses/course-1", "teacher")?.id).toBe("classes"); | |
| 123 | + expect(pathActive("/management/classes/class-1", "/management/classes")).toBe(true); | |
| 124 | + expect(routeNavItem("/management/classes/class-1", "teacher")?.id).toBe("my-classes"); | |
| 54 | 125 | expect(routeNavItem("/management/student-attendance", "teacher")?.id).toBe("student-attendance"); |
| 55 | 126 | expect(primaryPathActive("/exams/exam-1", primaryNavItems("student")[1]!)).toBe(true); |
| 56 | 127 | }); |
| 57 | 128 | |
| 58 | 129 | test.each([ |
| 59 | - ["/homework", "student", "homework"], | |
| 60 | - ["/events/event-1", "teacher", "events"], | |
| 130 | + ["/homework/hw-1", "student", "my-homework"], | |
| 131 | + ["/homework/hw-1", "teacher", "homework"], | |
| 61 | 132 | ["/management/student-attendance", "teacher", "student-attendance"], |
| 62 | 133 | ["/management/settings", "manager", "settings"], |
| 63 | 134 | ] as const)("sidebar resolves one active item for %s", (pathname, role, expected) => { |
| 64 | - const items = [ | |
| 65 | - ...primaryNavItems(role), | |
| 66 | - ...sidebarNavGroups(role).flatMap((group) => group.items), | |
| 67 | - ]; | |
| 135 | + const items = [...primaryNavItems(role), ...visibleNavGroups(role).flatMap((group) => group.items)]; | |
| 68 | 136 | const current = routeNavItem(pathname, role); |
| 69 | 137 | |
| 70 | 138 | expect(items.filter((item) => item.id === current?.id).map((item) => item.id)).toEqual([expected]); |
| @@ -79,12 +147,18 @@ test.each([ | ||
| 79 | 147 | ["/attendance", "nav.attendance"], |
| 80 | 148 | ["/studies", "courses.kind.study"], |
| 81 | 149 | ["/clubs", "courses.kind.club"], |
| 150 | + ["/courses", "nav.courses"], | |
| 151 | + ["/courses/course-1", "nav.courses"], | |
| 152 | + ["/notes", "nav.notes"], | |
| 153 | + ["/questions", "nav.questions"], | |
| 154 | + ["/events", "nav.events"], | |
| 155 | + ["/meals", "nav.meals"], | |
| 82 | 156 | ] as const)("%s has a header label", (pathname, expected) => { |
| 83 | 157 | expect(routeLabelKey(pathname, "student")).toBe(expected); |
| 84 | 158 | }); |
| 85 | 159 | |
| 86 | 160 | test("routes with a sidebar entry still take their nav label", () => { |
| 87 | - expect(routeLabelKey("/courses/course-1", "teacher")).toBe(routeNavItem("/courses/course-1", "teacher")?.labelKey); | |
| 161 | + expect(routeLabelKey("/homework/hw-1", "teacher")).toBe(routeNavItem("/homework/hw-1", "teacher")?.labelKey); | |
| 88 | 162 | }); |
| 89 | 163 | |
| 90 | 164 | test("a route rendered outside the shell has no label rather than a raw path", () => { |
| @@ -94,8 +168,8 @@ test("a route rendered outside the shell has no label rather than a raw path", ( | ||
| 94 | 168 | test("a page keeps its name for a viewer who may not open it", () => { |
| 95 | 169 | // /students is parent-only; an admin lands on the no-access screen, and the |
| 96 | 170 | // shell header must still say what page that is. |
| 97 | - expect(routeLabelKey("/students", "admin")).toBe("nav.children"); | |
| 98 | - expect(routeLabelKey("/students", "parent")).toBe("nav.children"); | |
| 171 | + expect(routeLabelKey("/students", "admin")).toBe("nav.progressReport"); | |
| 172 | + expect(routeLabelKey("/students", "parent")).toBe("nav.progressReport"); | |
| 99 | 173 | }); |
| 100 | 174 | |
| 101 | 175 | test("module gate fails open while the entitlement lookup is unknown", () => { |
| @@ -104,13 +178,13 @@ test("module gate fails open while the entitlement lookup is unknown", () => { | ||
| 104 | 178 | }); |
| 105 | 179 | |
| 106 | 180 | test("module gate hides nests the school did not buy", () => { |
| 107 | - const enabled = ["courses", "notes"]; | |
| 108 | - const primary = primaryNavItems("student", enabled).map((item) => item.to); | |
| 109 | - expect(primary).toContain("/courses"); | |
| 110 | - expect(primary).not.toContain("/marks"); | |
| 111 | - const sidebar = sidebarNavGroups("teacher", enabled).flatMap((group) => group.items.map((item) => item.to)); | |
| 112 | - expect(sidebar).not.toContain("/meals"); | |
| 113 | - expect(sidebar).not.toContain("/messages"); | |
| 181 | + const enabled = ["courses"]; | |
| 182 | + const teacherPaths = visibleNavGroups("teacher", enabled).flatMap((group) => group.items.map((item) => item.to)); | |
| 183 | + expect(teacherPaths).not.toContain("/homework"); | |
| 184 | + expect(teacherPaths).not.toContain("/exams"); | |
| 185 | + expect(teacherPaths).not.toContain("/whiteboards"); | |
| 186 | + expect(teacherPaths).toContain("/management/classes"); | |
| 187 | + expect(teacherPaths).toContain("/calendar"); | |
| 114 | 188 | }); |
| 115 | 189 | |
| 116 | 190 | test("ungated entries never drop on module filtering", () => { |
src/components/layout/nav-items.tsmodified+173 -116
| @@ -2,29 +2,32 @@ import type { Component } from "solid-js"; | ||
| 2 | 2 | import type { Role } from "@/api/client"; |
| 3 | 3 | import { |
| 4 | 4 | IconArchive, |
| 5 | - IconBook, | |
| 5 | + IconBotSquare, | |
| 6 | 6 | IconBriefcase, |
| 7 | - IconCalendar, | |
| 8 | 7 | IconCalendarDays, |
| 8 | + IconChalkboardTeacher, | |
| 9 | 9 | IconChart, |
| 10 | - IconClock, | |
| 10 | + IconChartPie, | |
| 11 | 11 | IconClipboardCheck, |
| 12 | + IconClock, | |
| 13 | + IconEdit, | |
| 12 | 14 | IconExam, |
| 13 | - IconGlobe, | |
| 14 | - IconGrid, | |
| 15 | - IconGuide, | |
| 16 | 15 | IconHelpCircle, |
| 17 | 16 | IconHomework, |
| 18 | 17 | IconHome, |
| 19 | 18 | IconMessage, |
| 20 | - IconEdit, | |
| 21 | - IconNote, | |
| 19 | + IconPackage, | |
| 22 | 20 | IconReportAnalytics, |
| 21 | + IconScan, | |
| 23 | 22 | IconSchool, |
| 24 | 23 | IconSettings, |
| 24 | + IconShieldCheck, | |
| 25 | + IconSparkles, | |
| 26 | + IconTarget, | |
| 25 | 27 | IconUserCog, |
| 26 | 28 | IconUsers, |
| 27 | 29 | IconUtensils, |
| 30 | + IconWaveform, | |
| 28 | 31 | } from "@/components/ui/icons"; |
| 29 | 32 | import type { MessageKey } from "@/i18n/messages"; |
| 30 | 33 | import { hasExactRole, roleInRange } from "@/lib/roles"; |
| @@ -40,6 +43,11 @@ export type NavItem = { | ||
| 40 | 43 | exact?: boolean; |
| 41 | 44 | /** Backend module nest behind this entry; hidden when the school did not buy it. */ |
| 42 | 45 | module?: string; |
| 46 | + /** No backend yet — routes to the shared placeholder and carries a "yakında" badge. */ | |
| 47 | + soon?: boolean; | |
| 48 | + /** Opens an existing shell surface instead of navigating (the Çelebi panel, | |
| 49 | + * the account settings dialog) — both already live elsewhere in the shell. */ | |
| 50 | + action?: "celebi" | "profile"; | |
| 43 | 51 | }; |
| 44 | 52 | |
| 45 | 53 | export type NavGroup = { |
| @@ -57,139 +65,190 @@ export const HOME_ITEM: NavItem = { | ||
| 57 | 65 | exact: true, |
| 58 | 66 | }; |
| 59 | 67 | |
| 60 | -const CLASSES_ITEM: NavItem = { | |
| 61 | - id: "classes", | |
| 62 | - to: "/courses", | |
| 63 | - labelKey: "nav.classes", | |
| 64 | - Icon: IconBook, | |
| 65 | - module: "courses", | |
| 66 | -}; | |
| 67 | - | |
| 68 | -const CALENDAR_ITEM: NavItem = { | |
| 69 | - id: "calendar", | |
| 70 | - to: "/calendar", | |
| 71 | - labelKey: "nav.calendar", | |
| 72 | - Icon: IconCalendarDays, | |
| 73 | -}; | |
| 74 | - | |
| 75 | -const CHILDREN_ITEM: NavItem = { | |
| 76 | - id: "children", | |
| 77 | - to: "/students", | |
| 78 | - labelKey: "nav.children", | |
| 79 | - Icon: IconUsers, | |
| 80 | - exactRole: "parent", | |
| 68 | +const CELEBI_ITEM: NavItem = { | |
| 69 | + id: "celebi", | |
| 70 | + to: "", | |
| 71 | + labelKey: "nav.celebi", | |
| 72 | + Icon: IconSparkles, | |
| 73 | + action: "celebi", | |
| 81 | 74 | }; |
| 82 | 75 | |
| 83 | -const PROGRESS_ITEM: NavItem = { | |
| 84 | - id: "progress", | |
| 85 | - to: "/marks", | |
| 86 | - labelKey: "nav.marks", | |
| 87 | - Icon: IconChart, | |
| 88 | - exactRole: "student", | |
| 89 | - module: "marks", | |
| 76 | +const SOUND_STUDIO_ITEM: NavItem = { | |
| 77 | + id: "sound-studio", | |
| 78 | + to: "/coming-soon/ses-atolyesi", | |
| 79 | + labelKey: "nav.soundStudio", | |
| 80 | + Icon: IconWaveform, | |
| 81 | + soon: true, | |
| 90 | 82 | }; |
| 91 | 83 | |
| 92 | -const MEALS_ITEM: NavItem = { | |
| 93 | - id: "meals", | |
| 94 | - to: "/meals", | |
| 95 | - labelKey: "nav.meals", | |
| 96 | - Icon: IconUtensils, | |
| 97 | - module: "meals", | |
| 98 | -}; | |
| 84 | +function settingsAction(id: string): NavItem { | |
| 85 | + return { id, to: "", labelKey: "nav.settings", Icon: IconSettings, action: "profile" }; | |
| 86 | +} | |
| 99 | 87 | |
| 100 | -const PRIMARY_BY_ROLE: Record<Role, NavItem[]> = { | |
| 101 | - student: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM, PROGRESS_ITEM], | |
| 102 | - teacher: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], | |
| 103 | - manager: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], | |
| 104 | - admin: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], | |
| 105 | - // Meals stays out of the primary strip so it lives under "Community" for | |
| 106 | - // every role consistently, same as teacher/manager/admin/student. | |
| 107 | - parent: [HOME_ITEM, CHILDREN_ITEM, CALENDAR_ITEM], | |
| 108 | -}; | |
| 88 | +// Admin and manager share one Figma information architecture (Operasyon / | |
| 89 | +// Yapay zekâ / Kurum) — manager just qualifies for fewer of its items, via | |
| 90 | +// the same minRole gates the rest of this file already uses. | |
| 91 | +const ADMIN_GROUPS: NavGroup[] = [ | |
| 92 | + { | |
| 93 | + id: "operations", | |
| 94 | + labelKey: "nav.group.operations", | |
| 95 | + Icon: IconSchool, | |
| 96 | + items: [ | |
| 97 | + { id: "students-roster", to: "/coming-soon/ogrenciler", labelKey: "nav.studentsRoster", Icon: IconUsers, soon: true, minRole: "manager" }, | |
| 98 | + { id: "teachers-roster", to: "/coming-soon/ogretmenler", labelKey: "nav.teachersRoster", Icon: IconChalkboardTeacher, soon: true, minRole: "manager" }, | |
| 99 | + { id: "class-groups", to: "/management/classes", labelKey: "nav.classGroups", Icon: IconSchool, minRole: "teacher" }, | |
| 100 | + { id: "schedule", to: "/calendar", labelKey: "nav.schedule", Icon: IconCalendarDays, minRole: "manager" }, | |
| 101 | + { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.attendance", Icon: IconClipboardCheck, minRole: "teacher", module: "attendance" }, | |
| 102 | + { id: "exams", to: "/exams", labelKey: "nav.exams", Icon: IconExam, minRole: "teacher", module: "exams" }, | |
| 103 | + { id: "question-bank", to: "/question-bank", labelKey: "nav.questionBank", Icon: IconArchive, minRole: "teacher", module: "bank_questions" }, | |
| 104 | + { id: "mock-exams", to: "/coming-soon/deneme-sinavlari", labelKey: "nav.mockExams", Icon: IconTarget, soon: true, minRole: "manager" }, | |
| 105 | + { id: "optical-reading", to: "/coming-soon/optik-okuma", labelKey: "nav.opticalReading", Icon: IconScan, soon: true, minRole: "manager" }, | |
| 106 | + { id: "payments-collection", to: "/management/payments", labelKey: "nav.payments", Icon: IconReportAnalytics, minRole: "manager", module: "payments" }, | |
| 107 | + ], | |
| 108 | + }, | |
| 109 | + { | |
| 110 | + id: "ai", | |
| 111 | + labelKey: "nav.group.ai", | |
| 112 | + Icon: IconSparkles, | |
| 113 | + items: [ | |
| 114 | + { id: "hezarfen-zeka", to: "/coming-soon/hezarfen-zeka", labelKey: "nav.hezarfenZeka", Icon: IconBotSquare, soon: true, minRole: "manager" }, | |
| 115 | + CELEBI_ITEM, | |
| 116 | + SOUND_STUDIO_ITEM, | |
| 117 | + ], | |
| 118 | + }, | |
| 119 | + { | |
| 120 | + id: "institution", | |
| 121 | + labelKey: "nav.group.institution", | |
| 122 | + Icon: IconUserCog, | |
| 123 | + items: [ | |
| 124 | + { id: "reports", to: "/coming-soon/raporlar", labelKey: "nav.reports", Icon: IconChartPie, soon: true, minRole: "manager" }, | |
| 125 | + { id: "license-modules", to: "/coming-soon/lisans-modulleri", labelKey: "nav.licenseModules", Icon: IconPackage, soon: true, minRole: "admin" }, | |
| 126 | + { id: "users", to: "/admin/users", labelKey: "nav.users", Icon: IconUserCog, minRole: "admin" }, | |
| 127 | + { id: "data-protection", to: "/coming-soon/kvkk-denetim", labelKey: "nav.dataProtection", Icon: IconShieldCheck, soon: true, minRole: "admin" }, | |
| 128 | + { id: "school-meals", to: "/meals", labelKey: "nav.schoolMeals", Icon: IconUtensils, minRole: "manager", module: "meals" }, | |
| 129 | + { id: "staff-work", to: "/management/staff-work", labelKey: "nav.staffWork", Icon: IconBriefcase, minRole: "manager", module: "work" }, | |
| 130 | + { id: "settings", to: "/management/settings", labelKey: "nav.settings", Icon: IconSettings, minRole: "manager" }, | |
| 131 | + ], | |
| 132 | + }, | |
| 133 | +]; | |
| 109 | 134 | |
| 110 | -const NAV_GROUPS: NavGroup[] = [ | |
| 135 | +const TEACHER_GROUPS: NavGroup[] = [ | |
| 111 | 136 | { |
| 112 | - id: "classes", | |
| 113 | - labelKey: "nav.group.classes", | |
| 137 | + id: "my-classroom", | |
| 138 | + labelKey: "nav.group.myClassroom", | |
| 114 | 139 | Icon: IconSchool, |
| 115 | 140 | items: [ |
| 116 | - CLASSES_ITEM, | |
| 141 | + { id: "my-classes", to: "/management/classes", labelKey: "nav.myClasses", Icon: IconSchool }, | |
| 142 | + { id: "my-schedule", to: "/calendar", labelKey: "nav.mySchedule", Icon: IconCalendarDays }, | |
| 143 | + { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.attendance", Icon: IconClipboardCheck, module: "attendance" }, | |
| 117 | 144 | { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework, module: "homework" }, |
| 118 | 145 | { id: "exams", to: "/exams", labelKey: "nav.exams", Icon: IconExam, module: "exams" }, |
| 119 | - { id: "question-bank", to: "/question-bank", labelKey: "nav.questionBank", Icon: IconArchive, minRole: "teacher", module: "bank_questions" }, | |
| 120 | - { id: "marks", to: "/marks", labelKey: "nav.marks", Icon: IconChart, exactRole: "student", module: "marks" }, | |
| 146 | + { id: "whiteboards", to: "/whiteboards", labelKey: "nav.whiteboards", Icon: IconEdit, module: "boards" }, | |
| 121 | 147 | ], |
| 122 | 148 | }, |
| 123 | 149 | { |
| 124 | - id: "planning", | |
| 125 | - labelKey: "nav.group.planning", | |
| 126 | - Icon: IconCalendarDays, | |
| 150 | + id: "ai", | |
| 151 | + labelKey: "nav.group.ai", | |
| 152 | + Icon: IconSparkles, | |
| 127 | 153 | items: [ |
| 128 | - { id: "events", to: "/events", labelKey: "nav.events", Icon: IconCalendar, module: "events" }, | |
| 129 | - CALENDAR_ITEM, | |
| 130 | - { id: "appointments", to: "/appointments", labelKey: "nav.appointments", Icon: IconClock, module: "appointments" }, | |
| 154 | + { id: "student-analysis", to: "/coming-soon/ogrenci-analizi", labelKey: "nav.studentAnalysis", Icon: IconChart, soon: true }, | |
| 155 | + { id: "pending-approvals", to: "/coming-soon/bekleyen-onaylar", labelKey: "nav.pendingApprovals", Icon: IconHelpCircle, soon: true }, | |
| 156 | + { id: "question-generation", to: "/coming-soon/soru-uretimi", labelKey: "nav.questionGeneration", Icon: IconEdit, soon: true }, | |
| 157 | + SOUND_STUDIO_ITEM, | |
| 131 | 158 | ], |
| 132 | 159 | }, |
| 133 | 160 | { |
| 134 | - id: "workspace", | |
| 135 | - labelKey: "nav.group.workspace", | |
| 136 | - Icon: IconNote, | |
| 161 | + id: "other", | |
| 162 | + labelKey: "nav.group.other", | |
| 163 | + Icon: IconMessage, | |
| 137 | 164 | items: [ |
| 138 | - { id: "notes", to: "/notes", labelKey: "nav.notes", Icon: IconNote, module: "notes" }, | |
| 139 | - { id: "whiteboards", to: "/whiteboards", labelKey: "nav.whiteboards", Icon: IconEdit, minRole: "student", module: "boards" }, | |
| 140 | - { id: "pomodoro", to: "/pomodoro", labelKey: "nav.pomodoro", Icon: IconClock, exactRole: "student", module: "pomodoro" }, | |
| 141 | - { id: "work", to: "/work", labelKey: "nav.work", Icon: IconBriefcase, minRole: "teacher", maxRole: "manager", module: "work" }, | |
| 165 | + { id: "parent-communication", to: "/messages", labelKey: "nav.parentCommunication", Icon: IconMessage, module: "messages" }, | |
| 166 | + { id: "work", to: "/work", labelKey: "nav.work", Icon: IconClock, minRole: "teacher", maxRole: "manager", module: "work" }, | |
| 167 | + settingsAction("settings-teacher"), | |
| 142 | 168 | ], |
| 143 | 169 | }, |
| 170 | +]; | |
| 171 | + | |
| 172 | +const STUDENT_GROUPS: NavGroup[] = [ | |
| 144 | 173 | { |
| 145 | - id: "students", | |
| 146 | - labelKey: "nav.group.students", | |
| 147 | - Icon: IconReportAnalytics, | |
| 174 | + id: "study", | |
| 175 | + labelKey: "nav.group.study", | |
| 176 | + Icon: IconSchool, | |
| 148 | 177 | items: [ |
| 149 | - CHILDREN_ITEM, | |
| 150 | - { id: "class-groups", to: "/management/classes", labelKey: "nav.classGroups", Icon: IconUsers, minRole: "teacher", module: "classes" }, | |
| 151 | - { id: "student-marks", to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, minRole: "teacher", module: "marks" }, | |
| 152 | - { id: "student-attendance", to: "/management/student-attendance", labelKey: "nav.studentAttendance", Icon: IconClipboardCheck, minRole: "teacher", module: "attendance" }, | |
| 153 | - { id: "student-pomodoro", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconClock, minRole: "teacher", module: "pomodoro" }, | |
| 178 | + { id: "study-plan", to: "/coming-soon/calisma-programim", labelKey: "nav.studyPlan", Icon: IconClock, soon: true }, | |
| 179 | + { id: "topic-mastery", to: "/marks", labelKey: "nav.topicMastery", Icon: IconChart, exactRole: "student", module: "marks" }, | |
| 180 | + { id: "exam-results", to: "/exams", labelKey: "nav.examResults", Icon: IconExam, module: "exams" }, | |
| 181 | + { id: "my-homework", to: "/homework", labelKey: "nav.myHomework", Icon: IconHomework, module: "homework" }, | |
| 182 | + { id: "whiteboards", to: "/whiteboards", labelKey: "nav.whiteboards", Icon: IconEdit, module: "boards" }, | |
| 183 | + { id: "pomodoro", to: "/pomodoro", labelKey: "nav.pomodoro", Icon: IconClock, exactRole: "student", module: "pomodoro" }, | |
| 154 | 184 | ], |
| 155 | 185 | }, |
| 156 | 186 | { |
| 157 | - id: "services", | |
| 158 | - labelKey: "nav.group.services", | |
| 159 | - Icon: IconGuide, | |
| 187 | + id: "ai", | |
| 188 | + labelKey: "nav.group.ai", | |
| 189 | + Icon: IconSparkles, | |
| 190 | + items: [CELEBI_ITEM, SOUND_STUDIO_ITEM], | |
| 191 | + }, | |
| 192 | + { | |
| 193 | + id: "other", | |
| 194 | + labelKey: "nav.group.other", | |
| 195 | + Icon: IconCalendarDays, | |
| 160 | 196 | items: [ |
| 161 | - MEALS_ITEM, | |
| 162 | - { id: "payment-statement", to: "/payments", labelKey: "nav.paymentStatement", Icon: IconChart, maxRole: "student", module: "payments" }, | |
| 197 | + { id: "calendar", to: "/calendar", labelKey: "nav.mySchedule", Icon: IconCalendarDays }, | |
| 198 | + settingsAction("settings-student"), | |
| 163 | 199 | ], |
| 164 | 200 | }, |
| 201 | +]; | |
| 202 | + | |
| 203 | +const PARENT_GROUPS: NavGroup[] = [ | |
| 165 | 204 | { |
| 166 | - id: "community", | |
| 167 | - labelKey: "nav.group.community", | |
| 168 | - Icon: IconGlobe, | |
| 205 | + id: "my-student", | |
| 206 | + labelKey: "nav.group.myStudent", | |
| 207 | + Icon: IconUsers, | |
| 169 | 208 | items: [ |
| 170 | - { id: "messages", to: "/messages", labelKey: "nav.messages", Icon: IconMessage, module: "messages" }, | |
| 171 | - { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle, module: "questions" }, | |
| 209 | + { id: "progress-report", to: "/students", labelKey: "nav.progressReport", Icon: IconReportAnalytics, exactRole: "parent" }, | |
| 210 | + { id: "absence", to: "/coming-soon/devamsizlik", labelKey: "nav.absence", Icon: IconClipboardCheck, soon: true }, | |
| 211 | + { id: "child-exam-results", to: "/coming-soon/sinav-sonuclari-veli", labelKey: "nav.childExamResults", Icon: IconExam, soon: true }, | |
| 212 | + { id: "child-study-plan", to: "/coming-soon/calisma-plani", labelKey: "nav.childStudyPlan", Icon: IconClock, soon: true }, | |
| 172 | 213 | ], |
| 173 | 214 | }, |
| 174 | 215 | { |
| 175 | - id: "school", | |
| 176 | - labelKey: "nav.group.school", | |
| 177 | - Icon: IconGrid, | |
| 216 | + id: "institution", | |
| 217 | + labelKey: "nav.group.institution", | |
| 218 | + Icon: IconUserCog, | |
| 178 | 219 | items: [ |
| 179 | - { id: "staff-work", to: "/management/staff-work", labelKey: "nav.staffWork", Icon: IconBriefcase, minRole: "manager", module: "work" }, | |
| 180 | - { id: "settings", to: "/management/settings", labelKey: "nav.settings", Icon: IconSettings, minRole: "manager" }, | |
| 181 | - { id: "terms", to: "/management/terms", labelKey: "nav.terms", Icon: IconCalendarDays, minRole: "manager" }, | |
| 182 | - { id: "payments", to: "/management/payments", labelKey: "nav.payments", Icon: IconReportAnalytics, minRole: "manager", module: "payments" }, | |
| 183 | - { id: "users", to: "/admin/users", labelKey: "nav.users", Icon: IconUserCog, minRole: "admin" }, | |
| 220 | + { id: "payment-statement", to: "/payments", labelKey: "nav.payments", Icon: IconReportAnalytics, exactRole: "parent", module: "payments" }, | |
| 221 | + { id: "appointments", to: "/appointments", labelKey: "nav.appointmentsAndCommunication", Icon: IconClock, exactRole: "parent", module: "appointments" }, | |
| 222 | + settingsAction("settings-parent"), | |
| 184 | 223 | ], |
| 185 | 224 | }, |
| 186 | 225 | ]; |
| 187 | 226 | |
| 227 | +const GROUPS_BY_ROLE: Record<Role, NavGroup[]> = { | |
| 228 | + student: STUDENT_GROUPS, | |
| 229 | + teacher: TEACHER_GROUPS, | |
| 230 | + manager: ADMIN_GROUPS, | |
| 231 | + admin: ADMIN_GROUPS, | |
| 232 | + parent: PARENT_GROUPS, | |
| 233 | +}; | |
| 234 | + | |
| 235 | +// The mobile bottom tab bar keeps its own small, role-specific set — Figma's | |
| 236 | +// desktop sidebar has no equivalent "primary strip" (only "Ana Sayfa" sits | |
| 237 | +// outside the groups there), so this stays a phone-only affordance built | |
| 238 | +// from items that also exist in the role's group tree above. | |
| 239 | +const PRIMARY_BY_ROLE: Record<Role, NavItem[]> = { | |
| 240 | + student: [HOME_ITEM, { id: "exam-results", to: "/exams", labelKey: "nav.examResults", Icon: IconExam, module: "exams" }, { id: "topic-mastery", to: "/marks", labelKey: "nav.topicMastery", Icon: IconChart, exactRole: "student", module: "marks" }], | |
| 241 | + teacher: [HOME_ITEM, { id: "my-classes", to: "/management/classes", labelKey: "nav.myClasses", Icon: IconSchool }, { id: "my-schedule", to: "/calendar", labelKey: "nav.mySchedule", Icon: IconCalendarDays }], | |
| 242 | + manager: [HOME_ITEM, { id: "class-groups", to: "/management/classes", labelKey: "nav.classGroups", Icon: IconSchool, minRole: "teacher" }, { id: "exams", to: "/exams", labelKey: "nav.exams", Icon: IconExam, minRole: "teacher", module: "exams" }], | |
| 243 | + admin: [HOME_ITEM, { id: "class-groups", to: "/management/classes", labelKey: "nav.classGroups", Icon: IconSchool, minRole: "teacher" }, { id: "exams", to: "/exams", labelKey: "nav.exams", Icon: IconExam, minRole: "teacher", module: "exams" }], | |
| 244 | + parent: [HOME_ITEM, { id: "progress-report", to: "/students", labelKey: "nav.progressReport", Icon: IconReportAnalytics, exactRole: "parent" }, { id: "appointments", to: "/appointments", labelKey: "nav.appointmentsAndCommunication", Icon: IconClock, exactRole: "parent", module: "appointments" }], | |
| 245 | +}; | |
| 246 | + | |
| 188 | 247 | function itemVisible(item: NavItem, role: Role | undefined) { |
| 189 | 248 | if (!role) return false; |
| 190 | 249 | if (item.exactRole) return hasExactRole(role, item.exactRole); |
| 191 | 250 | if (item.minRole || item.maxRole) return roleInRange(role, item.minRole, item.maxRole); |
| 192 | - return role !== "parent" || ["/", "/calendar", "/appointments", "/meals", "/messages"].includes(item.to); | |
| 251 | + return true; | |
| 193 | 252 | } |
| 194 | 253 | |
| 195 | 254 | /** |
| @@ -208,8 +267,12 @@ export function primaryNavItems(role: Role | undefined, enabled?: readonly strin | ||
| 208 | 267 | return PRIMARY_BY_ROLE[role].filter((item) => moduleVisible(item, enabled)); |
| 209 | 268 | } |
| 210 | 269 | |
| 270 | +/** The full, role-specific group tree — desktop sidebar and the mobile menu | |
| 271 | + * sheet both render this directly; it mirrors the Figma sidebar as-is, with | |
| 272 | + * no items pulled out for a separate "primary" section. */ | |
| 211 | 273 | export function visibleNavGroups(role: Role | undefined, enabled?: readonly string[] | null): NavGroup[] { |
| 212 | - return NAV_GROUPS | |
| 274 | + if (!role) return []; | |
| 275 | + return GROUPS_BY_ROLE[role] | |
| 213 | 276 | .map((group) => ({ |
| 214 | 277 | ...group, |
| 215 | 278 | items: group.items.filter((item) => itemVisible(item, role) && moduleVisible(item, enabled)), |
| @@ -217,31 +280,19 @@ export function visibleNavGroups(role: Role | undefined, enabled?: readonly stri | ||
| 217 | 280 | .filter((group) => group.items.length > 0); |
| 218 | 281 | } |
| 219 | 282 | |
| 220 | -export function sidebarNavGroups(role: Role | undefined, enabled?: readonly string[] | null): NavGroup[] { | |
| 221 | - const primaryPaths = new Set(primaryNavItems(role, enabled).map((item) => item.to)); | |
| 222 | - return visibleNavGroups(role, enabled) | |
| 223 | - .map((group) => ({ ...group, items: group.items.filter((item) => !primaryPaths.has(item.to)) })) | |
| 224 | - .filter((group) => group.items.length > 0); | |
| 225 | -} | |
| 226 | - | |
| 227 | 283 | export function visibleNavItems(role: Role | undefined, enabled?: readonly string[] | null): NavItem[] { |
| 228 | - const items = [HOME_ITEM, ...visibleNavGroups(role, enabled).flatMap((group) => group.items)]; | |
| 229 | - return items.filter((item, index) => items.findIndex((candidate) => candidate.to === item.to) === index); | |
| 284 | + const items = [HOME_ITEM, ...primaryNavItems(role, enabled), ...visibleNavGroups(role, enabled).flatMap((group) => group.items)]; | |
| 285 | + return items.filter((item, index) => items.findIndex((candidate) => candidate.id === item.id && candidate.to === item.to) === index); | |
| 230 | 286 | } |
| 231 | 287 | |
| 232 | 288 | export function pathActive(pathname: string, to: string, exact?: boolean) { |
| 289 | + if (!to) return false; | |
| 233 | 290 | if (exact) return pathname === to; |
| 234 | 291 | return pathname === to || pathname.startsWith(`${to}/`); |
| 235 | 292 | } |
| 236 | 293 | |
| 237 | 294 | export function primaryPathActive(pathname: string, item: NavItem) { |
| 238 | - if (pathActive(pathname, item.to, item.exact)) return true; | |
| 239 | - const prefixes: Partial<Record<string, string[]>> = { | |
| 240 | - classes: ["/homework", "/exams", "/question-bank"], | |
| 241 | - calendar: ["/events", "/appointments"], | |
| 242 | - progress: ["/attendance", "/pomodoro"], | |
| 243 | - }; | |
| 244 | - return (prefixes[item.id] ?? []).some((prefix) => pathname.startsWith(prefix)); | |
| 295 | + return pathActive(pathname, item.to, item.exact); | |
| 245 | 296 | } |
| 246 | 297 | |
| 247 | 298 | export function routeNavItem(pathname: string, role: Role | undefined): NavItem | undefined { |
| @@ -262,6 +313,11 @@ const UNLISTED_ROUTE_LABELS: { prefix: string; labelKey: MessageKey }[] = [ | ||
| 262 | 313 | { prefix: "/attendance", labelKey: "nav.attendance" }, |
| 263 | 314 | { prefix: "/studies", labelKey: "courses.kind.study" }, |
| 264 | 315 | { prefix: "/clubs", labelKey: "courses.kind.club" }, |
| 316 | + { prefix: "/courses", labelKey: "nav.courses" }, | |
| 317 | + { prefix: "/notes", labelKey: "nav.notes" }, | |
| 318 | + { prefix: "/questions", labelKey: "nav.questions" }, | |
| 319 | + { prefix: "/events", labelKey: "nav.events" }, | |
| 320 | + { prefix: "/meals", labelKey: "nav.meals" }, | |
| 265 | 321 | ]; |
| 266 | 322 | |
| 267 | 323 | /** |
| @@ -281,7 +337,8 @@ export function routeLabelKey(pathname: string, role: Role | undefined): Message | ||
| 281 | 337 | // A page still has a name when the viewer may not open it — the shell title |
| 282 | 338 | // must not go blank on the "no access" screen — so fall back to the nav entry |
| 283 | 339 | // for any role, not just this one. |
| 284 | - return [HOME_ITEM, ...NAV_GROUPS.flatMap((group) => group.items)] | |
| 340 | + const allItems = [HOME_ITEM, ...Object.values(GROUPS_BY_ROLE).flatMap((groups) => groups.flatMap((group) => group.items))]; | |
| 341 | + return allItems | |
| 285 | 342 | .filter((entry) => pathActive(pathname, entry.to, entry.exact)) |
| 286 | 343 | .sort((a, b) => b.to.length - a.to.length)[0]?.labelKey; |
| 287 | 344 | } |
src/components/layout/side-nav.tsxmodified+58 -47
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | import { For, Show } from "solid-js"; |
| 2 | 2 | import { Link, useNavigate, useRouterState } from "@tanstack/solid-router"; |
| 3 | -import { primaryNavItems, routeNavItem, sidebarNavGroups, type NavItem } from "@/components/layout/nav-items"; | |
| 3 | +import { HOME_ITEM, routeNavItem, visibleNavGroups, type NavItem } from "@/components/layout/nav-items"; | |
| 4 | 4 | import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; |
| 5 | 5 | import { IconChevronRight } from "@/components/ui/icons"; |
| 6 | 6 | import { cn } from "@/lib/cn"; |
| @@ -9,7 +9,12 @@ import { useModules } from "@/stores/modules-context"; | ||
| 9 | 9 | import { useShellFeed } from "@/stores/shell-feed-context"; |
| 10 | 10 | import { useT } from "@/stores/preferences-context"; |
| 11 | 11 | |
| 12 | -export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) { | |
| 12 | +export function SideNav(props: { | |
| 13 | + onNavigate?: () => void; | |
| 14 | + collapsed?: boolean; | |
| 15 | + onOpenCelebi?: () => void; | |
| 16 | + onOpenProfile?: () => void; | |
| 17 | +}) { | |
| 13 | 18 | const auth = useAuth(); |
| 14 | 19 | const t = useT(); |
| 15 | 20 | const feed = useShellFeed(); |
| @@ -17,16 +22,22 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | ||
| 17 | 22 | const navigate = useNavigate(); |
| 18 | 23 | const pathname = useRouterState({ select: (state) => state.location.pathname }); |
| 19 | 24 | |
| 20 | - const primary = () => primaryNavItems(auth.user()?.role, modules.enabled()); | |
| 21 | - const groups = () => sidebarNavGroups(auth.user()?.role, modules.enabled()); | |
| 25 | + const home = () => (auth.user() ? [HOME_ITEM] : []); | |
| 26 | + const groups = () => visibleNavGroups(auth.user()?.role, modules.enabled()); | |
| 22 | 27 | const current = () => routeNavItem(pathname(), auth.user()?.role); |
| 23 | 28 | const unread = () => feed.unreadMessages().total; |
| 24 | 29 | const badgeFor = (item: NavItem) => (item.id === "messages" ? unread() : 0); |
| 25 | 30 | |
| 31 | + const runAction = (item: NavItem) => { | |
| 32 | + props.onNavigate?.(); | |
| 33 | + if (item.action === "celebi") props.onOpenCelebi?.(); | |
| 34 | + if (item.action === "profile") props.onOpenProfile?.(); | |
| 35 | + }; | |
| 36 | + | |
| 26 | 37 | return ( |
| 27 | 38 | <nav class="flex h-full flex-col gap-1" aria-label={t("nav.menu")}> |
| 28 | 39 | <div class="grid gap-1"> |
| 29 | - <For each={primary()}> | |
| 40 | + <For each={home()}> | |
| 30 | 41 | {(item) => { |
| 31 | 42 | const active = () => current()?.id === item.id; |
| 32 | 43 | return ( |
| @@ -45,20 +56,6 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | ||
| 45 | 56 | > |
| 46 | 57 | <item.Icon class="h-4 w-4 shrink-0" /> |
| 47 | 58 | <span class={props.collapsed ? "sr-only" : "truncate"}>{t(item.labelKey)}</span> |
| 48 | - <Show when={badgeFor(item) > 0}> | |
| 49 | - <Show | |
| 50 | - when={!props.collapsed} | |
| 51 | - fallback={ | |
| 52 | - <span class="absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-rose-500 px-1 text-[9px] font-bold text-white"> | |
| 53 | - {unread() > 9 ? "9+" : unread()} | |
| 54 | - </span> | |
| 55 | - } | |
| 56 | - > | |
| 57 | - <span class="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-rose-500 px-1.5 text-[10px] font-bold text-white"> | |
| 58 | - {unread() > 9 ? "9+" : unread()} | |
| 59 | - </span> | |
| 60 | - </Show> | |
| 61 | - </Show> | |
| 62 | 59 | </Link> |
| 63 | 60 | ); |
| 64 | 61 | }} |
| @@ -72,38 +69,43 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | ||
| 72 | 69 | <For each={group.items}> |
| 73 | 70 | {(item: NavItem) => { |
| 74 | 71 | const itemActive = () => current()?.id === item.id; |
| 75 | - return ( | |
| 76 | - <Link | |
| 77 | - to={item.to} | |
| 78 | - onClick={() => props.onNavigate?.()} | |
| 79 | - title={t(item.labelKey)} | |
| 80 | - aria-current={itemActive() ? "page" : undefined} | |
| 81 | - class={cn( | |
| 82 | - // Active submenu item: bold foreground text + a bright segment over | |
| 83 | - // the group's left guide line (no filled pill). | |
| 84 | - "relative flex h-[30px] items-center gap-2.5 rounded-md px-2.5 text-[13px] outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-ring", | |
| 85 | - itemActive() | |
| 86 | - ? "font-semibold text-foreground before:absolute before:-left-[9px] before:top-1 before:bottom-1 before:w-0.5 before:rounded-full before:bg-foreground" | |
| 87 | - : "font-medium text-muted-foreground hover:bg-muted/70 hover:text-foreground", | |
| 88 | - )} | |
| 89 | - > | |
| 72 | + const linkClass = cn( | |
| 73 | + // Active submenu item: bold foreground text + a bright segment over | |
| 74 | + // the group's left guide line (no filled pill). | |
| 75 | + "relative flex h-[30px] items-center gap-2.5 rounded-md px-2.5 text-[13px] outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-ring", | |
| 76 | + itemActive() | |
| 77 | + ? "font-semibold text-foreground before:absolute before:-left-[9px] before:top-1 before:bottom-1 before:w-0.5 before:rounded-full before:bg-foreground" | |
| 78 | + : "font-medium text-muted-foreground hover:bg-muted/70 hover:text-foreground", | |
| 79 | + ); | |
| 80 | + const content = ( | |
| 81 | + <> | |
| 90 | 82 | <item.Icon class="h-4 w-4 shrink-0 opacity-80" /> |
| 91 | 83 | <span class="truncate">{t(item.labelKey)}</span> |
| 84 | + <Show when={item.soon}> | |
| 85 | + <span class="ml-auto shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground"> | |
| 86 | + {t("nav.soon")} | |
| 87 | + </span> | |
| 88 | + </Show> | |
| 92 | 89 | <Show when={badgeFor(item) > 0}> |
| 93 | - <Show | |
| 94 | - when={!props.collapsed} | |
| 95 | - fallback={ | |
| 96 | - <span class="absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-rose-500 px-1 text-[9px] font-bold text-white"> | |
| 97 | - {unread() > 9 ? "9+" : unread()} | |
| 98 | - </span> | |
| 99 | - } | |
| 100 | - > | |
| 101 | - <span class="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-rose-500 px-1.5 text-[10px] font-bold text-white"> | |
| 102 | - {unread() > 9 ? "9+" : unread()} | |
| 103 | - </span> | |
| 104 | - </Show> | |
| 90 | + <span class="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-rose-500 px-1.5 text-[10px] font-bold text-white"> | |
| 91 | + {unread() > 9 ? "9+" : unread()} | |
| 92 | + </span> | |
| 105 | 93 | </Show> |
| 106 | - </Link> | |
| 94 | + </> | |
| 95 | + ); | |
| 96 | + return ( | |
| 97 | + <Show | |
| 98 | + when={!item.action} | |
| 99 | + fallback={ | |
| 100 | + <button type="button" onClick={() => runAction(item)} title={t(item.labelKey)} class={cn(linkClass, "w-full text-left")}> | |
| 101 | + {content} | |
| 102 | + </button> | |
| 103 | + } | |
| 104 | + > | |
| 105 | + <Link to={item.to} onClick={() => props.onNavigate?.()} title={t(item.labelKey)} aria-current={itemActive() ? "page" : undefined} class={linkClass}> | |
| 106 | + {content} | |
| 107 | + </Link> | |
| 108 | + </Show> | |
| 107 | 109 | ); |
| 108 | 110 | }} |
| 109 | 111 | </For> |
| @@ -154,12 +156,21 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | ||
| 154 | 156 | <DropdownMenuItem |
| 155 | 157 | class="min-h-8 gap-2.5 rounded-md px-2.5 py-1.5 text-[13px]" |
| 156 | 158 | onSelect={() => { |
| 159 | + if (item.action) { | |
| 160 | + runAction(item); | |
| 161 | + return; | |
| 162 | + } | |
| 157 | 163 | props.onNavigate?.(); |
| 158 | 164 | void navigate({ to: item.to }); |
| 159 | 165 | }} |
| 160 | 166 | > |
| 161 | 167 | <item.Icon class="h-4 w-4 shrink-0" /> |
| 162 | 168 | <span>{t(item.labelKey)}</span> |
| 169 | + <Show when={item.soon}> | |
| 170 | + <span class="ml-auto shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground"> | |
| 171 | + {t("nav.soon")} | |
| 172 | + </span> | |
| 173 | + </Show> | |
| 163 | 174 | <Show when={badgeFor(item) > 0}> |
| 164 | 175 | <span class="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-rose-500 px-1.5 text-[10px] font-bold text-white"> |
| 165 | 176 | {unread() > 9 ? "9+" : unread()} |
src/components/ui/icons.tsxmodified+35 -0
| @@ -5,6 +5,8 @@ import bellUrl from "@phosphor-icons/core/regular/bell.svg?url"; | ||
| 5 | 5 | import bookOpenUrl from "@phosphor-icons/core/regular/book-open.svg?url"; |
| 6 | 6 | import calendarDotsUrl from "@phosphor-icons/core/regular/calendar-dots.svg?url"; |
| 7 | 7 | import caretDownUrl from "@phosphor-icons/core/regular/caret-down.svg?url"; |
| 8 | +import chalkboardTeacherUrl from "@phosphor-icons/core/regular/chalkboard-teacher.svg?url"; | |
| 9 | +import chartPieUrl from "@phosphor-icons/core/regular/chart-pie.svg?url"; | |
| 8 | 10 | import caretLeftUrl from "@phosphor-icons/core/regular/caret-left.svg?url"; |
| 9 | 11 | import caretRightUrl from "@phosphor-icons/core/regular/caret-right.svg?url"; |
| 10 | 12 | import caretUpDownUrl from "@phosphor-icons/core/regular/caret-up-down.svg?url"; |
| @@ -27,17 +29,22 @@ import houseUrl from "@phosphor-icons/core/regular/house.svg?url"; | ||
| 27 | 29 | import listUrl from "@phosphor-icons/core/regular/list.svg?url"; |
| 28 | 30 | import lockSimpleUrl from "@phosphor-icons/core/regular/lock-simple.svg?url"; |
| 29 | 31 | import magnifyingGlassUrl from "@phosphor-icons/core/regular/magnifying-glass.svg?url"; |
| 32 | +import packageUrl from "@phosphor-icons/core/regular/package.svg?url"; | |
| 30 | 33 | import paperPlaneTiltUrl from "@phosphor-icons/core/regular/paper-plane-tilt.svg?url"; |
| 31 | 34 | import pencilSimpleUrl from "@phosphor-icons/core/regular/pencil-simple.svg?url"; |
| 32 | 35 | import plusUrl from "@phosphor-icons/core/regular/plus.svg?url"; |
| 33 | 36 | import questionUrl from "@phosphor-icons/core/regular/question.svg?url"; |
| 37 | +import scanUrl from "@phosphor-icons/core/regular/scan.svg?url"; | |
| 38 | +import shieldCheckUrl from "@phosphor-icons/core/regular/shield-check.svg?url"; | |
| 34 | 39 | import sidebarSimpleUrl from "@phosphor-icons/core/regular/sidebar-simple.svg?url"; |
| 35 | 40 | import signOutUrl from "@phosphor-icons/core/regular/sign-out.svg?url"; |
| 36 | 41 | import sparkleUrl from "@phosphor-icons/core/regular/sparkle.svg?url"; |
| 42 | +import targetUrl from "@phosphor-icons/core/regular/target.svg?url"; | |
| 37 | 43 | import trashUrl from "@phosphor-icons/core/regular/trash.svg?url"; |
| 38 | 44 | import uploadSimpleUrl from "@phosphor-icons/core/regular/upload-simple.svg?url"; |
| 39 | 45 | import usersUrl from "@phosphor-icons/core/regular/users.svg?url"; |
| 40 | 46 | import warningUrl from "@phosphor-icons/core/regular/warning.svg?url"; |
| 47 | +import waveformUrl from "@phosphor-icons/core/regular/waveform.svg?url"; | |
| 41 | 48 | import xUrl from "@phosphor-icons/core/regular/x.svg?url"; |
| 42 | 49 | |
| 43 | 50 | type IconProps = { |
| @@ -596,3 +603,31 @@ export function IconExternalLink(props: IconProps) { | ||
| 596 | 603 | export function IconBell(props: IconProps) { |
| 597 | 604 | return <PhosphorIcon {...props} src={bellUrl} />; |
| 598 | 605 | } |
| 606 | + | |
| 607 | +export function IconChalkboardTeacher(props: IconProps) { | |
| 608 | + return <PhosphorIcon {...props} src={chalkboardTeacherUrl} />; | |
| 609 | +} | |
| 610 | + | |
| 611 | +export function IconChartPie(props: IconProps) { | |
| 612 | + return <PhosphorIcon {...props} src={chartPieUrl} />; | |
| 613 | +} | |
| 614 | + | |
| 615 | +export function IconPackage(props: IconProps) { | |
| 616 | + return <PhosphorIcon {...props} src={packageUrl} />; | |
| 617 | +} | |
| 618 | + | |
| 619 | +export function IconScan(props: IconProps) { | |
| 620 | + return <PhosphorIcon {...props} src={scanUrl} />; | |
| 621 | +} | |
| 622 | + | |
| 623 | +export function IconShieldCheck(props: IconProps) { | |
| 624 | + return <PhosphorIcon {...props} src={shieldCheckUrl} />; | |
| 625 | +} | |
| 626 | + | |
| 627 | +export function IconTarget(props: IconProps) { | |
| 628 | + return <PhosphorIcon {...props} src={targetUrl} />; | |
| 629 | +} | |
| 630 | + | |
| 631 | +export function IconWaveform(props: IconProps) { | |
| 632 | + return <PhosphorIcon {...props} src={waveformUrl} />; | |
| 633 | +} |
src/i18n/messages.tsmodified+127 -10
| @@ -258,6 +258,45 @@ export type MessageKey = | ||
| 258 | 258 | | "nav.group.grades" |
| 259 | 259 | | "nav.group.community" |
| 260 | 260 | | "nav.group.services" |
| 261 | + | "nav.group.operations" | |
| 262 | + | "nav.group.ai" | |
| 263 | + | "nav.group.institution" | |
| 264 | + | "nav.group.myClassroom" | |
| 265 | + | "nav.group.study" | |
| 266 | + | "nav.group.other" | |
| 267 | + | "nav.group.myStudent" | |
| 268 | + | "nav.studentsRoster" | |
| 269 | + | "nav.teachersRoster" | |
| 270 | + | "nav.schedule" | |
| 271 | + | "nav.mySchedule" | |
| 272 | + | "nav.mockExams" | |
| 273 | + | "nav.opticalReading" | |
| 274 | + | "nav.hezarfenZeka" | |
| 275 | + | "nav.celebi" | |
| 276 | + | "nav.soundStudio" | |
| 277 | + | "nav.reports" | |
| 278 | + | "nav.licenseModules" | |
| 279 | + | "nav.dataProtection" | |
| 280 | + | "nav.schoolMeals" | |
| 281 | + | "nav.myClasses" | |
| 282 | + | "nav.studentAnalysis" | |
| 283 | + | "nav.pendingApprovals" | |
| 284 | + | "nav.questionGeneration" | |
| 285 | + | "nav.parentCommunication" | |
| 286 | + | "nav.studyPlan" | |
| 287 | + | "nav.topicMastery" | |
| 288 | + | "nav.examResults" | |
| 289 | + | "nav.myHomework" | |
| 290 | + | "nav.progressReport" | |
| 291 | + | "nav.absence" | |
| 292 | + | "nav.childExamResults" | |
| 293 | + | "nav.childStudyPlan" | |
| 294 | + | "nav.appointmentsAndCommunication" | |
| 295 | + | "nav.soon" | |
| 296 | + | "comingSoon.title" | |
| 297 | + | "comingSoon.description" | |
| 298 | + | "comingSoon.emptyTitle" | |
| 299 | + | "comingSoon.emptyDescription" | |
| 261 | 300 | | "nav.darkMode" |
| 262 | 301 | | "rightPanel.messagesTitle" |
| 263 | 302 | | "rightPanel.calendarTitle" |
| @@ -1794,9 +1833,9 @@ const en: Dict = { | ||
| 1794 | 1833 | "nav.pomodoro": "Pomodoro", |
| 1795 | 1834 | "nav.attendance": "Attendance", |
| 1796 | 1835 | "nav.questions": "Question pool", |
| 1797 | - "nav.work": "Work log", | |
| 1836 | + "nav.work": "Shift", | |
| 1798 | 1837 | "nav.staffWork": "Staff shifts", |
| 1799 | - "nav.users": "Users", | |
| 1838 | + "nav.users": "Users & roles", | |
| 1800 | 1839 | "nav.studentMarks": "Student marks", |
| 1801 | 1840 | "nav.studentAttendance": "Student attendance", |
| 1802 | 1841 | "nav.studentPomodoro": "Student pomodoros", |
| @@ -1820,6 +1859,45 @@ const en: Dict = { | ||
| 1820 | 1859 | "nav.group.grades": "Grades", |
| 1821 | 1860 | "nav.group.community": "Community", |
| 1822 | 1861 | "nav.group.services": "School services", |
| 1862 | + "nav.group.operations": "Operations", | |
| 1863 | + "nav.group.ai": "AI", | |
| 1864 | + "nav.group.institution": "Institution", | |
| 1865 | + "nav.group.myClassroom": "My classroom", | |
| 1866 | + "nav.group.study": "Study", | |
| 1867 | + "nav.group.other": "Other", | |
| 1868 | + "nav.group.myStudent": "My student", | |
| 1869 | + "nav.studentsRoster": "Students", | |
| 1870 | + "nav.teachersRoster": "Teachers", | |
| 1871 | + "nav.schedule": "Class schedule", | |
| 1872 | + "nav.mySchedule": "My schedule", | |
| 1873 | + "nav.mockExams": "Mock exams", | |
| 1874 | + "nav.opticalReading": "Optical reading", | |
| 1875 | + "nav.hezarfenZeka": "Hezarfen AI", | |
| 1876 | + "nav.celebi": "Çelebi", | |
| 1877 | + "nav.soundStudio": "Sound studio", | |
| 1878 | + "nav.reports": "Reports", | |
| 1879 | + "nav.licenseModules": "License & modules", | |
| 1880 | + "nav.dataProtection": "Data protection & audit", | |
| 1881 | + "nav.schoolMeals": "Cafeteria management", | |
| 1882 | + "nav.myClasses": "My classes", | |
| 1883 | + "nav.studentAnalysis": "Student analysis", | |
| 1884 | + "nav.pendingApprovals": "Pending approvals", | |
| 1885 | + "nav.questionGeneration": "Question generation", | |
| 1886 | + "nav.parentCommunication": "Parent communication", | |
| 1887 | + "nav.studyPlan": "Study plan", | |
| 1888 | + "nav.topicMastery": "Topic mastery", | |
| 1889 | + "nav.examResults": "My exam results", | |
| 1890 | + "nav.myHomework": "My homework", | |
| 1891 | + "nav.progressReport": "Progress report", | |
| 1892 | + "nav.absence": "Absence", | |
| 1893 | + "nav.childExamResults": "Exam results", | |
| 1894 | + "nav.childStudyPlan": "Study plan", | |
| 1895 | + "nav.appointmentsAndCommunication": "Appointments & messages", | |
| 1896 | + "nav.soon": "Coming soon", | |
| 1897 | + "comingSoon.title": "Coming soon", | |
| 1898 | + "comingSoon.description": "This module is on its way — there is nothing to show here yet.", | |
| 1899 | + "comingSoon.emptyTitle": "Not available yet", | |
| 1900 | + "comingSoon.emptyDescription": "This part of Hezarfen is still being built. Check back soon.", | |
| 1823 | 1901 | "nav.darkMode": "Dark mode", |
| 1824 | 1902 | "parents.title": "My Students", |
| 1825 | 1903 | "parents.subtitle": "Review academic records for the students linked to your account.", |
| @@ -2893,9 +2971,9 @@ const en: Dict = { | ||
| 2893 | 2971 | "meals.editDish": "Edit dish", |
| 2894 | 2972 | "meals.dishName": "Dish name", |
| 2895 | 2973 | "meals.priceTry": "Price (TRY)", |
| 2896 | - "nav.payments": "Fees", | |
| 2974 | + "nav.payments": "Payments & collection", | |
| 2897 | 2975 | "nav.paymentStatement": "My Fees", |
| 2898 | - "nav.whiteboards": "Whiteboards", | |
| 2976 | + "nav.whiteboards": "Board", | |
| 2899 | 2977 | "whiteboard.title": "Whiteboards", |
| 2900 | 2978 | "whiteboard.subtitle": "Live collaborative sketch boards.", |
| 2901 | 2979 | "whiteboard.empty": "No whiteboards yet.", |
| @@ -3136,7 +3214,7 @@ const tr: Dict = { | ||
| 3136 | 3214 | "ai.skipTyping": "Cevabın tamamını göster", |
| 3137 | 3215 | "nav.today": "Bugün", |
| 3138 | 3216 | "nav.classes": "Eğitim", |
| 3139 | - "nav.classGroups": "Şubeler", | |
| 3217 | + "nav.classGroups": "Sınıflar", | |
| 3140 | 3218 | "classGroups.title": "Şubeler", |
| 3141 | 3219 | "classGroups.subtitle": "Aynı dersleri paylaşan öğrenci grupları.", |
| 3142 | 3220 | "classGroups.newClass": "Yeni şube", |
| @@ -3351,9 +3429,9 @@ const tr: Dict = { | ||
| 3351 | 3429 | "nav.pomodoro": "Pomodoro", |
| 3352 | 3430 | "nav.attendance": "Yoklama", |
| 3353 | 3431 | "nav.questions": "Soru havuzu", |
| 3354 | - "nav.work": "Çalışma kaydı", | |
| 3355 | - "nav.staffWork": "Personel mesaisi", | |
| 3356 | - "nav.users": "Kullanıcılar", | |
| 3432 | + "nav.work": "Mesai", | |
| 3433 | + "nav.staffWork": "Personel Mesai", | |
| 3434 | + "nav.users": "Kullanıcılar ve roller", | |
| 3357 | 3435 | "nav.studentMarks": "Öğrenci notları", |
| 3358 | 3436 | "nav.studentAttendance": "Öğrenci yoklamaları", |
| 3359 | 3437 | "nav.studentPomodoro": "Öğrenci pomodoroları", |
| @@ -3377,6 +3455,45 @@ const tr: Dict = { | ||
| 3377 | 3455 | "nav.group.grades": "Notlar", |
| 3378 | 3456 | "nav.group.community": "Topluluk", |
| 3379 | 3457 | "nav.group.services": "Okul hizmetleri", |
| 3458 | + "nav.group.operations": "Operasyon", | |
| 3459 | + "nav.group.ai": "Yapay zekâ", | |
| 3460 | + "nav.group.institution": "Kurum", | |
| 3461 | + "nav.group.myClassroom": "Sınıfım", | |
| 3462 | + "nav.group.study": "Çalışma", | |
| 3463 | + "nav.group.other": "Diğer", | |
| 3464 | + "nav.group.myStudent": "Öğrencim", | |
| 3465 | + "nav.studentsRoster": "Öğrenciler", | |
| 3466 | + "nav.teachersRoster": "Öğretmenler", | |
| 3467 | + "nav.schedule": "Ders programı", | |
| 3468 | + "nav.mySchedule": "Ders programım", | |
| 3469 | + "nav.mockExams": "Deneme sınavları", | |
| 3470 | + "nav.opticalReading": "Optik okuma", | |
| 3471 | + "nav.hezarfenZeka": "Hezarfen Zekâ", | |
| 3472 | + "nav.celebi": "Çelebi", | |
| 3473 | + "nav.soundStudio": "Ses Atölyesi", | |
| 3474 | + "nav.reports": "Raporlar", | |
| 3475 | + "nav.licenseModules": "Lisans ve modüller", | |
| 3476 | + "nav.dataProtection": "KVKK ve denetim", | |
| 3477 | + "nav.schoolMeals": "Yemekhane Yönetimi", | |
| 3478 | + "nav.myClasses": "Sınıflarım", | |
| 3479 | + "nav.studentAnalysis": "Öğrenci analizi", | |
| 3480 | + "nav.pendingApprovals": "Bekleyen onaylar", | |
| 3481 | + "nav.questionGeneration": "Soru üretimi", | |
| 3482 | + "nav.parentCommunication": "Veli iletişimi", | |
| 3483 | + "nav.studyPlan": "Çalışma programım", | |
| 3484 | + "nav.topicMastery": "Konu yetkinliğim", | |
| 3485 | + "nav.examResults": "Sınav sonuçlarım", | |
| 3486 | + "nav.myHomework": "Ödevlerim", | |
| 3487 | + "nav.progressReport": "Gelişim raporu", | |
| 3488 | + "nav.absence": "Devamsızlık", | |
| 3489 | + "nav.childExamResults": "Sınav sonuçları", | |
| 3490 | + "nav.childStudyPlan": "Çalışma planı", | |
| 3491 | + "nav.appointmentsAndCommunication": "Randevu ve iletişim", | |
| 3492 | + "nav.soon": "Yakında", | |
| 3493 | + "comingSoon.title": "Yakında", | |
| 3494 | + "comingSoon.description": "Bu modül hazırlanıyor — henüz gösterecek bir şey yok.", | |
| 3495 | + "comingSoon.emptyTitle": "Henüz kullanıma açık değil", | |
| 3496 | + "comingSoon.emptyDescription": "Hezarfen'in bu bölümü hâlâ hazırlanıyor. Yakında tekrar bakın.", | |
| 3380 | 3497 | "nav.darkMode": "Karanlık mod", |
| 3381 | 3498 | "parents.title": "Öğrencilerim", |
| 3382 | 3499 | "parents.subtitle": "Size bağlı öğrencilerin akademik kayıtlarını inceleyin.", |
| @@ -4450,9 +4567,9 @@ const tr: Dict = { | ||
| 4450 | 4567 | "meals.editDish": "Yemeği düzenle", |
| 4451 | 4568 | "meals.dishName": "Yemek adı", |
| 4452 | 4569 | "meals.priceTry": "Fiyat (TRY)", |
| 4453 | - "nav.payments": "Ücretler", | |
| 4570 | + "nav.payments": "Ödeme ve tahsilat", | |
| 4454 | 4571 | "nav.paymentStatement": "Ücretlerim", |
| 4455 | - "nav.whiteboards": "Beyaz tahtalar", | |
| 4572 | + "nav.whiteboards": "Tahta", | |
| 4456 | 4573 | "whiteboard.title": "Beyaz tahtalar", |
| 4457 | 4574 | "whiteboard.subtitle": "Canlı ortak çizim tahtaları.", |
| 4458 | 4575 | "whiteboard.empty": "Henüz beyaz tahta yok.", |
src/pages/coming-soon-page.tsxadded+58 -0
| @@ -0,0 +1,58 @@ | ||
| 1 | +import { useLocation } from "@tanstack/solid-router"; | |
| 2 | +import { RouteGuard } from "@/components/layout/route-guard"; | |
| 3 | +import { PageHeader } from "@/components/layout/page-header"; | |
| 4 | +import { EmptyState } from "@/components/ui/empty-state"; | |
| 5 | +import type { MessageKey } from "@/i18n/messages"; | |
| 6 | +import { useT } from "@/stores/preferences-context"; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * One route per not-yet-built module (see router.tsx's comingSoonRoutes) so | |
| 10 | + * each has its own URL, breadcrumb and back-button target, but they all | |
| 11 | + * render this same "not ready yet" page. The label comes from the last path | |
| 12 | + * segment, kept in step with COMING_SOON_LABELS below and with the matching | |
| 13 | + * sidebar entry's own labelKey in nav-items.ts. | |
| 14 | + */ | |
| 15 | +const COMING_SOON_LABELS: Record<string, MessageKey> = { | |
| 16 | + "hezarfen-zeka": "nav.hezarfenZeka", | |
| 17 | + "ses-atolyesi": "nav.soundStudio", | |
| 18 | + "deneme-sinavlari": "nav.mockExams", | |
| 19 | + "optik-okuma": "nav.opticalReading", | |
| 20 | + raporlar: "nav.reports", | |
| 21 | + "lisans-modulleri": "nav.licenseModules", | |
| 22 | + "kvkk-denetim": "nav.dataProtection", | |
| 23 | + ogrenciler: "nav.studentsRoster", | |
| 24 | + ogretmenler: "nav.teachersRoster", | |
| 25 | + "ogrenci-analizi": "nav.studentAnalysis", | |
| 26 | + "bekleyen-onaylar": "nav.pendingApprovals", | |
| 27 | + "soru-uretimi": "nav.questionGeneration", | |
| 28 | + "calisma-programim": "nav.studyPlan", | |
| 29 | + devamsizlik: "nav.absence", | |
| 30 | + "sinav-sonuclari-veli": "nav.childExamResults", | |
| 31 | + "calisma-plani": "nav.childStudyPlan", | |
| 32 | +}; | |
| 33 | + | |
| 34 | +export default function ComingSoonPage() { | |
| 35 | + return ( | |
| 36 | + <RouteGuard> | |
| 37 | + <ComingSoonContent /> | |
| 38 | + </RouteGuard> | |
| 39 | + ); | |
| 40 | +} | |
| 41 | + | |
| 42 | +function ComingSoonContent() { | |
| 43 | + const t = useT(); | |
| 44 | + const location = useLocation(); | |
| 45 | + const slug = () => location().pathname.split("/").filter(Boolean).pop() ?? ""; | |
| 46 | + const labelKey = () => COMING_SOON_LABELS[slug()]; | |
| 47 | + const title = () => { | |
| 48 | + const key = labelKey(); | |
| 49 | + return key ? t(key) : t("comingSoon.title"); | |
| 50 | + }; | |
| 51 | + | |
| 52 | + return ( | |
| 53 | + <div class="space-y-6"> | |
| 54 | + <PageHeader title={title()} description={t("comingSoon.description")} /> | |
| 55 | + <EmptyState title={t("comingSoon.emptyTitle")} description={t("comingSoon.emptyDescription")} /> | |
| 56 | + </div> | |
| 57 | + ); | |
| 58 | +} |
src/routes/router.tsxmodified+32 -0
| @@ -66,6 +66,7 @@ const ProfilePage = lazyRoute(() => import("@/pages/profile-page")); | ||
| 66 | 66 | const PaymentStatementPage = lazyRoute(() => import("@/pages/payment-statement-page")); |
| 67 | 67 | const WhiteboardsPage = lazyRoute(() => import("@/pages/whiteboards-page")); |
| 68 | 68 | const WhiteboardPage = lazyRoute(() => import("@/pages/whiteboard-page")); |
| 69 | +const ComingSoonPage = lazyRoute(() => import("@/pages/coming-soon-page")); | |
| 69 | 70 | |
| 70 | 71 | function RootComponent() { |
| 71 | 72 | return ( |
| @@ -396,6 +397,36 @@ const whiteboardRoute = createRoute({ | ||
| 396 | 397 | component: WhiteboardPage, |
| 397 | 398 | }); |
| 398 | 399 | |
| 400 | +// One route per Figma menu entry with no backend yet — each gets its own URL | |
| 401 | +// (so breadcrumbs, back and direct links behave normally) but all render the | |
| 402 | +// same "not ready" page. Slugs are read back by coming-soon-page.tsx. | |
| 403 | +const COMING_SOON_SLUGS = [ | |
| 404 | + "hezarfen-zeka", | |
| 405 | + "ses-atolyesi", | |
| 406 | + "deneme-sinavlari", | |
| 407 | + "optik-okuma", | |
| 408 | + "raporlar", | |
| 409 | + "lisans-modulleri", | |
| 410 | + "kvkk-denetim", | |
| 411 | + "ogrenciler", | |
| 412 | + "ogretmenler", | |
| 413 | + "ogrenci-analizi", | |
| 414 | + "bekleyen-onaylar", | |
| 415 | + "soru-uretimi", | |
| 416 | + "calisma-programim", | |
| 417 | + "devamsizlik", | |
| 418 | + "sinav-sonuclari-veli", | |
| 419 | + "calisma-plani", | |
| 420 | +] as const; | |
| 421 | + | |
| 422 | +const comingSoonRoutes = COMING_SOON_SLUGS.map((slug) => | |
| 423 | + createRoute({ | |
| 424 | + getParentRoute: () => rootRoute, | |
| 425 | + path: `/coming-soon/${slug}`, | |
| 426 | + component: ComingSoonPage, | |
| 427 | + }), | |
| 428 | +); | |
| 429 | + | |
| 399 | 430 | const routeTree = rootRoute.addChildren([ |
| 400 | 431 | indexRoute, |
| 401 | 432 | loginRoute, |
| @@ -445,6 +476,7 @@ const routeTree = rootRoute.addChildren([ | ||
| 445 | 476 | whiteboardRoute, |
| 446 | 477 | myProfileRoute, |
| 447 | 478 | userProfileRoute, |
| 479 | + ...comingSoonRoutes, | |
| 448 | 480 | ]); |
| 449 | 481 | |
| 450 | 482 | function RouterPending() { |