diff --git a/src/components/layout/nav-items.test.ts b/src/components/layout/nav-items.test.ts index e61a758..bc56c0b 100644 --- a/src/components/layout/nav-items.test.ts +++ b/src/components/layout/nav-items.test.ts @@ -5,7 +5,7 @@ test.each([ ["teacher", ["/", "/courses", "/calendar"]], ["manager", ["/", "/courses", "/calendar"]], ["admin", ["/", "/courses", "/calendar"]], - ["parent", ["/", "/students", "/calendar", "/meals"]], + ["parent", ["/", "/students", "/calendar"]], ] as const)("%s gets role-specific primary destinations", (role, expected) => { expect(primaryNavItems(role).map((item) => item.to)).toEqual(expected); }); @@ -16,7 +16,7 @@ test("invalid role destinations stay hidden", () => { expect(visibleNavItems("teacher").map((item) => item.to)).not.toContain("/admin/users"); }); -test("student secondary navigation follows the academic, planning, workspace, community flow", () => { +test("student secondary navigation follows the academic, planning, workspace, services, community flow", () => { expect( sidebarNavGroups("student").map((group) => ({ id: group.id, @@ -26,10 +26,16 @@ test("student secondary navigation follows the academic, planning, workspace, co { id: "classes", items: ["homework", "exams"] }, { id: "planning", items: ["events", "appointments"] }, { id: "workspace", items: ["notes", "whiteboards", "pomodoro"] }, - { id: "community", items: ["meals", "payment-statement", "messages", "questions"] }, + { id: "services", items: ["meals", "payment-statement"] }, + { id: "community", items: ["messages", "questions"] }, ]); }); +test("parent's services group includes meals and payment-statement, consistent with every other role", () => { + const services = sidebarNavGroups("parent").find((group) => group.id === "services"); + expect(services?.items.map((item) => item.id)).toEqual(["meals", "payment-statement"]); +}); + test.each(["student", "parent", "teacher", "manager", "admin"] as const)( "%s can reach every visible feature and appointments from the sidebar", (role) => { diff --git a/src/components/layout/nav-items.ts b/src/components/layout/nav-items.ts index 0da592f..ccdd26f 100644 --- a/src/components/layout/nav-items.ts +++ b/src/components/layout/nav-items.ts @@ -20,6 +20,7 @@ import { IconEdit, IconNote, IconReportAnalytics, + IconSchool, IconSettings, IconUserCog, IconUsers, @@ -96,14 +97,16 @@ const PRIMARY_BY_ROLE: Record = { teacher: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], manager: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], admin: [HOME_ITEM, CLASSES_ITEM, CALENDAR_ITEM], - parent: [HOME_ITEM, CHILDREN_ITEM, CALENDAR_ITEM, MEALS_ITEM], + // Meals stays out of the primary strip so it lives under "Community" for + // every role consistently, same as teacher/manager/admin/student. + parent: [HOME_ITEM, CHILDREN_ITEM, CALENDAR_ITEM], }; const NAV_GROUPS: NavGroup[] = [ { id: "classes", labelKey: "nav.group.classes", - Icon: IconGuide, + Icon: IconSchool, items: [ CLASSES_ITEM, { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework }, @@ -144,13 +147,20 @@ const NAV_GROUPS: NavGroup[] = [ { id: "student-pomodoro", to: "/management/pomodoros", labelKey: "nav.studentPomodoro", Icon: IconClock, minRole: "teacher" }, ], }, + { + id: "services", + labelKey: "nav.group.services", + Icon: IconGuide, + items: [ + MEALS_ITEM, + { id: "payment-statement", to: "/payments", labelKey: "nav.paymentStatement", Icon: IconChart, maxRole: "student" }, + ], + }, { id: "community", labelKey: "nav.group.community", Icon: IconGlobe, items: [ - MEALS_ITEM, - { id: "payment-statement", to: "/payments", labelKey: "nav.paymentStatement", Icon: IconChart, maxRole: "student" }, { id: "messages", to: "/messages", labelKey: "nav.messages", Icon: IconMessage }, { id: "questions", to: "/questions", labelKey: "nav.questions", Icon: IconHelpCircle }, { id: "work", to: "/work", labelKey: "nav.work", Icon: IconBriefcase, minRole: "teacher", maxRole: "manager" }, diff --git a/src/i18n/messages.ts b/src/i18n/messages.ts index af3cde1..e9a9de4 100644 --- a/src/i18n/messages.ts +++ b/src/i18n/messages.ts @@ -107,6 +107,7 @@ export type MessageKey = | "nav.group.reports" | "nav.group.settings" | "nav.group.community" + | "nav.group.services" | "nav.darkMode" | "rightPanel.messagesTitle" | "rightPanel.calendarTitle" @@ -1370,6 +1371,7 @@ const en: Dict = { "nav.group.reports": "Reports", "nav.group.settings": "Settings", "nav.group.community": "Community", + "nav.group.services": "Services", "nav.darkMode": "Dark mode", "nav.myStudents": "My Students", "parents.title": "My Students", @@ -2638,6 +2640,7 @@ const tr: Dict = { "nav.group.reports": "Raporlar", "nav.group.settings": "Ayarlar", "nav.group.community": "Topluluk", + "nav.group.services": "Hizmetler", "nav.darkMode": "Karanlık mod", "nav.myStudents": "Öğrencilerim", "parents.title": "Öğrencilerim",