From 7a6c14031020a4463500aee38898769a782c164e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Sun, 12 Jul 2026 22:27:42 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20move=20student=20mark=20loo?= =?UTF-8?q?kup=20into=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove student lookup from the report card page - add a teacher-only student marks lookup page under management - protect the new lookup route from student access - add the management sidebar item for teacher and higher roles - reuse the marks report view across own and searched reports - fix sidebar label line height for Turkish text - align the student lookup input and submit button heights --- src/components/layout/side-nav.tsx | 14 +- src/components/marks/marks-report-view.tsx | 85 +++++++++++ src/i18n/messages.ts | 6 + src/pages/marks-page.tsx | 170 +-------------------- src/pages/student-marks-page.tsx | 68 +++++++++ src/routes/router.tsx | 22 +++ 6 files changed, 191 insertions(+), 174 deletions(-) create mode 100644 src/components/marks/marks-report-view.tsx create mode 100644 src/pages/student-marks-page.tsx diff --git a/src/components/layout/side-nav.tsx b/src/components/layout/side-nav.tsx index 746fde0..f3a258d 100644 --- a/src/components/layout/side-nav.tsx +++ b/src/components/layout/side-nav.tsx @@ -5,6 +5,7 @@ import { useT } from "@/stores/preferences-context"; import { hasMinRole } from "@/lib/roles"; import { cn } from "@/lib/cn"; import type { MessageKey } from "@/i18n/messages"; +import type { Role } from "@/api/types"; import { IconBook, IconCalendar, @@ -20,7 +21,7 @@ type NavItem = { to: string; labelKey: MessageKey; Icon: Component<{ class?: string }>; - adminOnly?: boolean; + minRole?: Role; exact?: boolean; }; @@ -31,7 +32,8 @@ const MAIN_ITEMS: NavItem[] = [ { to: "/marks", labelKey: "nav.marks", Icon: IconChart }, { to: "/notes", labelKey: "nav.notes", Icon: IconNote }, { to: "/events", labelKey: "nav.events", Icon: IconCalendar }, - { to: "/admin/users", labelKey: "nav.users", Icon: IconUsers, adminOnly: true }, + { to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, minRole: "teacher" }, + { to: "/admin/users", labelKey: "nav.users", Icon: IconUsers, minRole: "admin" }, ]; const GUIDE_ITEM: NavItem = { @@ -79,7 +81,7 @@ function NavLink(props: { @@ -93,7 +95,7 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) const auth = useAuth(); const items = createMemo(() => - MAIN_ITEMS.filter((item) => !item.adminOnly || hasMinRole(auth.user()?.role, "admin")), + MAIN_ITEMS.filter((item) => !item.minRole || hasMinRole(auth.user()?.role, item.minRole)), ); const t = useT(); @@ -102,9 +104,9 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean })