🧭 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 | ["teacher", ["/", "/courses", "/calendar"]], | 5 | ["teacher", ["/", "/courses", "/calendar"]], |
| 6 | ["manager", ["/", "/courses", "/calendar"]], | 6 | ["manager", ["/", "/courses", "/calendar"]], |
| 7 | ["admin", ["/", "/courses", "/calendar"]], | 7 | ["admin", ["/", "/courses", "/calendar"]], |
| 8 | - ["parent", ["/", "/students", "/calendar", "/meals"]], | 8 | + ["parent", ["/", "/students", "/calendar"]], |
| 9 | ] as const)("%s gets role-specific primary destinations", (role, expected) => { | 9 | ] as const)("%s gets role-specific primary destinations", (role, expected) => { |
| 10 | expect(primaryNavItems(role).map((item) => item.to)).toEqual(expected); | 10 | expect(primaryNavItems(role).map((item) => item.to)).toEqual(expected); |
| 11 | }); | 11 | }); |
| @@ -16,7 +16,7 @@ test("invalid role destinations stay hidden", () => { | |||
| 16 | expect(visibleNavItems("teacher").map((item) => item.to)).not.toContain("/admin/users"); | 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 | expect( | 20 | expect( |
| 21 | sidebarNavGroups("student").map((group) => ({ | 21 | sidebarNavGroups("student").map((group) => ({ |
| 22 | id: group.id, | 22 | id: group.id, |
| @@ -26,10 +26,16 @@ test("student secondary navigation follows the academic, planning, workspace, co | |||
| 26 | { id: "classes", items: ["homework", "exams"] }, | 26 | { id: "classes", items: ["homework", "exams"] }, |
| 27 | { id: "planning", items: ["events", "appointments"] }, | 27 | { id: "planning", items: ["events", "appointments"] }, |
| 28 | { id: "workspace", items: ["notes", "whiteboards", "pomodoro"] }, | 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 | test.each(["student", "parent", "teacher", "manager", "admin"] as const)( | 39 | test.each(["student", "parent", "teacher", "manager", "admin"] as const)( |
| 34 | "%s can reach every visible feature and appointments from the sidebar", | 40 | "%s can reach every visible feature and appointments from the sidebar", |
| 35 | (role) => { | 41 | (role) => { |
src/components/layout/nav-items.tsmodified+14 -4
| @@ -20,6 +20,7 @@ import { | |||
| 20 | IconEdit, | 20 | IconEdit, |
| 21 | IconNote, | 21 | IconNote, |
| 22 | IconReportAnalytics, | 22 | IconReportAnalytics, |
| 23 | + IconSchool, | ||
| 23 | IconSettings, | 24 | IconSettings, |
| 24 | IconUserCog, | 25 | IconUserCog, |
| 25 | IconUsers, | 26 | IconUsers, |
| @@ -96,14 +97,16 @@ const PRIMARY_BY_ROLE: Record<Role, NavItem[]> = { | |||
| 96 | teacher: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], | 97 | teacher: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], |
| 97 | manager: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], | 98 | manager: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], |
| 98 | admin: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], | 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 | const NAV_GROUPS: NavGroup[] = [ | 105 | const NAV_GROUPS: NavGroup[] = [ |
| 103 | { | 106 | { |
| 104 | id: "classes", | 107 | id: "classes", |
| 105 | labelKey: "nav.group.classes", | 108 | labelKey: "nav.group.classes", |
| 106 | - Icon: IconGuide, | 109 | + Icon: IconSchool, |
| 107 | items: [ | 110 | items: [ |
| 108 | CLASSES_ITEM, | 111 | CLASSES_ITEM, |
| 109 | { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework }, | 112 | { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework }, |
| @@ -144,13 +147,20 @@ const NAV_GROUPS: NavGroup[] = [ | |||
| 144 | { id: "student-pomodoro", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconClock, minRole: "teacher" }, | 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 | id: "community", | 160 | id: "community", |
| 149 | labelKey: "nav.group.community", | 161 | labelKey: "nav.group.community", |
| 150 | Icon: IconGlobe, | 162 | Icon: IconGlobe, |
| 151 | items: [ | 163 | items: [ |
| 152 | - MEALS_ITEM, | ||
| 153 | - { id: "payment-statement", to: "/payments", labelKey: "nav.paymentStatement", Icon: IconChart, maxRole: "student" }, | ||
| 154 | { id: "messages", to: "/messages", labelKey: "nav.messages", Icon: IconMessage }, | 164 | { id: "messages", to: "/messages", labelKey: "nav.messages", Icon: IconMessage }, |
| 155 | { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle }, | 165 | { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle }, |
| 156 | { id: "work", to: "/work", labelKey: "nav.work", Icon: IconBriefcase, minRole: "teacher", maxRole: "manager" }, | 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 | | "nav.group.reports" | 107 | | "nav.group.reports" |
| 108 | | "nav.group.settings" | 108 | | "nav.group.settings" |
| 109 | | "nav.group.community" | 109 | | "nav.group.community" |
| 110 | + | "nav.group.services" | ||
| 110 | | "nav.darkMode" | 111 | | "nav.darkMode" |
| 111 | | "rightPanel.messagesTitle" | 112 | | "rightPanel.messagesTitle" |
| 112 | | "rightPanel.calendarTitle" | 113 | | "rightPanel.calendarTitle" |
| @@ -1370,6 +1371,7 @@ const en: Dict = { | |||
| 1370 | "nav.group.reports": "Reports", | 1371 | "nav.group.reports": "Reports", |
| 1371 | "nav.group.settings": "Settings", | 1372 | "nav.group.settings": "Settings", |
| 1372 | "nav.group.community": "Community", | 1373 | "nav.group.community": "Community", |
| 1374 | + "nav.group.services": "Services", | ||
| 1373 | "nav.darkMode": "Dark mode", | 1375 | "nav.darkMode": "Dark mode", |
| 1374 | "nav.myStudents": "My Students", | 1376 | "nav.myStudents": "My Students", |
| 1375 | "parents.title": "My Students", | 1377 | "parents.title": "My Students", |
| @@ -2638,6 +2640,7 @@ const tr: Dict = { | |||
| 2638 | "nav.group.reports": "Raporlar", | 2640 | "nav.group.reports": "Raporlar", |
| 2639 | "nav.group.settings": "Ayarlar", | 2641 | "nav.group.settings": "Ayarlar", |
| 2640 | "nav.group.community": "Topluluk", | 2642 | "nav.group.community": "Topluluk", |
| 2643 | + "nav.group.services": "Hizmetler", | ||
| 2641 | "nav.darkMode": "Karanlık mod", | 2644 | "nav.darkMode": "Karanlık mod", |
| 2642 | "nav.myStudents": "Öğrencilerim", | 2645 | "nav.myStudents": "Öğrencilerim", |
| 2643 | "parents.title": "Öğrencilerim", | 2646 | "parents.title": "Öğrencilerim", |