🧭 add a Services nav group for meals and payment statement
Browse files at this commit083afa3ecfb29d5f364a677b0b2290753cdc8cc8Parent: e3aba15- feat
- 🧭 add a Services nav group for meals and payment statement
3 changed files +26 -7
- src/components/layout/nav-items.test.ts +9 -3
- src/components/layout/nav-items.ts +14 -4
- src/i18n/messages.ts +3 -0
src/components/layout/nav-items.test.tsmodified+9 -3
| @@ -5,7 +5,7 @@ test.each([ | ||
| 5 | 5 | ["teacher", ["/", "/courses", "/calendar"]], |
| 6 | 6 | ["manager", ["/", "/courses", "/calendar"]], |
| 7 | 7 | ["admin", ["/", "/courses", "/calendar"]], |
| 8 | - ["parent", ["/", "/students", "/calendar", "/meals"]], | |
| 8 | + ["parent", ["/", "/students", "/calendar"]], | |
| 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 | }); |
| @@ -16,7 +16,7 @@ test("invalid role destinations stay hidden", () => { | ||
| 16 | 16 | expect(visibleNavItems("teacher").map((item) => item.to)).not.toContain("/admin/users"); |
| 17 | 17 | }); |
| 18 | 18 | |
| 19 | -test("student secondary navigation follows the academic, planning, workspace, community flow", () => { | |
| 19 | +test("student secondary navigation follows the academic, planning, workspace, services, community flow", () => { | |
| 20 | 20 | expect( |
| 21 | 21 | sidebarNavGroups("student").map((group) => ({ |
| 22 | 22 | id: group.id, |
| @@ -26,10 +26,16 @@ test("student secondary navigation follows the academic, planning, workspace, co | ||
| 26 | 26 | { id: "classes", items: ["homework", "exams"] }, |
| 27 | 27 | { id: "planning", items: ["events", "appointments"] }, |
| 28 | 28 | { id: "workspace", items: ["notes", "whiteboards", "pomodoro"] }, |
| 29 | - { id: "community", items: ["meals", "payment-statement", "messages", "questions"] }, | |
| 29 | + { id: "services", items: ["meals", "payment-statement"] }, | |
| 30 | + { id: "community", items: ["messages", "questions"] }, | |
| 30 | 31 | ]); |
| 31 | 32 | }); |
| 32 | 33 | |
| 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"]); | |
| 37 | +}); | |
| 38 | + | |
| 33 | 39 | test.each(["student", "parent", "teacher", "manager", "admin"] as const)( |
| 34 | 40 | "%s can reach every visible feature and appointments from the sidebar", |
| 35 | 41 | (role) => { |
src/components/layout/nav-items.tsmodified+14 -4
| @@ -20,6 +20,7 @@ import { | ||
| 20 | 20 | IconEdit, |
| 21 | 21 | IconNote, |
| 22 | 22 | IconReportAnalytics, |
| 23 | + IconSchool, | |
| 23 | 24 | IconSettings, |
| 24 | 25 | IconUserCog, |
| 25 | 26 | IconUsers, |
| @@ -96,14 +97,16 @@ const PRIMARY_BY_ROLE: Record<Role, NavItem[]> = { | ||
| 96 | 97 | teacher: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], |
| 97 | 98 | manager: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], |
| 98 | 99 | admin: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], |
| 99 | - parent: [HOME_ITEM, CHILDREN_ITEM, CALENDAR_ITEM, MEALS_ITEM], | |
| 100 | + // Meals stays out of the primary strip so it lives under "Community" for | |
| 101 | + // every role consistently, same as teacher/manager/admin/student. | |
| 102 | + parent: [HOME_ITEM, CHILDREN_ITEM, CALENDAR_ITEM], | |
| 100 | 103 | }; |
| 101 | 104 | |
| 102 | 105 | const NAV_GROUPS: NavGroup[] = [ |
| 103 | 106 | { |
| 104 | 107 | id: "classes", |
| 105 | 108 | labelKey: "nav.group.classes", |
| 106 | - Icon: IconGuide, | |
| 109 | + Icon: IconSchool, | |
| 107 | 110 | items: [ |
| 108 | 111 | CLASSES_ITEM, |
| 109 | 112 | { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework }, |
| @@ -144,13 +147,20 @@ const NAV_GROUPS: NavGroup[] = [ | ||
| 144 | 147 | { id: "student-pomodoro", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconClock, minRole: "teacher" }, |
| 145 | 148 | ], |
| 146 | 149 | }, |
| 150 | + { | |
| 151 | + id: "services", | |
| 152 | + labelKey: "nav.group.services", | |
| 153 | + Icon: IconGuide, | |
| 154 | + items: [ | |
| 155 | + MEALS_ITEM, | |
| 156 | + { id: "payment-statement", to: "/payments", labelKey: "nav.paymentStatement", Icon: IconChart, maxRole: "student" }, | |
| 157 | + ], | |
| 158 | + }, | |
| 147 | 159 | { |
| 148 | 160 | id: "community", |
| 149 | 161 | labelKey: "nav.group.community", |
| 150 | 162 | Icon: IconGlobe, |
| 151 | 163 | items: [ |
| 152 | - MEALS_ITEM, | |
| 153 | - { id: "payment-statement", to: "/payments", labelKey: "nav.paymentStatement", Icon: IconChart, maxRole: "student" }, | |
| 154 | 164 | { id: "messages", to: "/messages", labelKey: "nav.messages", Icon: IconMessage }, |
| 155 | 165 | { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle }, |
| 156 | 166 | { id: "work", to: "/work", labelKey: "nav.work", Icon: IconBriefcase, minRole: "teacher", maxRole: "manager" }, |
src/i18n/messages.tsmodified+3 -0
| @@ -107,6 +107,7 @@ export type MessageKey = | ||
| 107 | 107 | | "nav.group.reports" |
| 108 | 108 | | "nav.group.settings" |
| 109 | 109 | | "nav.group.community" |
| 110 | + | "nav.group.services" | |
| 110 | 111 | | "nav.darkMode" |
| 111 | 112 | | "rightPanel.messagesTitle" |
| 112 | 113 | | "rightPanel.calendarTitle" |
| @@ -1370,6 +1371,7 @@ const en: Dict = { | ||
| 1370 | 1371 | "nav.group.reports": "Reports", |
| 1371 | 1372 | "nav.group.settings": "Settings", |
| 1372 | 1373 | "nav.group.community": "Community", |
| 1374 | + "nav.group.services": "Services", | |
| 1373 | 1375 | "nav.darkMode": "Dark mode", |
| 1374 | 1376 | "nav.myStudents": "My Students", |
| 1375 | 1377 | "parents.title": "My Students", |
| @@ -2638,6 +2640,7 @@ const tr: Dict = { | ||
| 2638 | 2640 | "nav.group.reports": "Raporlar", |
| 2639 | 2641 | "nav.group.settings": "Ayarlar", |
| 2640 | 2642 | "nav.group.community": "Topluluk", |
| 2643 | + "nav.group.services": "Hizmetler", | |
| 2641 | 2644 | "nav.darkMode": "Karanlık mod", |
| 2642 | 2645 | "nav.myStudents": "Öğrencilerim", |
| 2643 | 2646 | "parents.title": "Öğrencilerim", |