From 0b3228b547ce510485c349d527b3eef55223c9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Fri, 25 Sep 2026 15:15:56 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=93=8A=20improve=20student=20mark?= =?UTF-8?q?s=20report=20panel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - show student identity and report summary in a responsive panel - replace course chips with a searchable course picker - give course and section links a clear vertical hierarchy --- src/components/marks/marks-report-view.tsx | 116 +++++++++++++-------- src/pages/student-marks-page.tsx | 34 +++--- 2 files changed, 94 insertions(+), 56 deletions(-) diff --git a/src/components/marks/marks-report-view.tsx b/src/components/marks/marks-report-view.tsx index 8781fc9..c60d9cd 100644 --- a/src/components/marks/marks-report-view.tsx +++ b/src/components/marks/marks-report-view.tsx @@ -9,7 +9,9 @@ import { Badge } from "@/components/ui/badge"; import { buttonVariants } from "@/components/ui/button"; import { IconExternalLink } from "@/components/ui/icons"; import { DataTable, DataTableEmpty } from "@/components/ui/data-table"; +import { EmptyInline } from "@/components/ui/empty-inline"; import { ExamLink } from "@/components/exams/exam-link"; +import { SearchableSelect } from "@/components/ui/searchable-select"; import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { cn } from "@/lib/cn"; import { examKindLabel } from "@/lib/exam-labels"; @@ -27,7 +29,11 @@ function scoreWidth(mark: number | null): string { /** How many sections we bother reading before giving up on naming one. */ const MAX_SECTIONS = 3; -export function MarksReportView(props: { report: MarksReport; compact?: boolean }) { +export function MarksReportView(props: { + report: MarksReport; + compact?: boolean; + identity?: { name: string; studentNumber?: string | null; classes: string[] }; +}) { const t = useT(); const { locale } = usePreferences(); // "68,2 · Bant 3": the grade is the school's band label, and "68,2 / 3" @@ -125,6 +131,10 @@ export function MarksReportView(props: { report: MarksReport; compact?: boolean const courses = props.report.courses; return (id ? courses.find((c) => c.instance === id) : undefined) ?? courses[0]; }); + const courseOptions = createMemo(() => props.report.courses.map((block) => ({ + value: block.instance, + label: block.course.title, + }))); const columns = createMemo[]>(() => [ { accessorKey: "title", @@ -166,32 +176,58 @@ export function MarksReportView(props: { report: MarksReport; compact?: boolean ]); return ( -
-
-
-

{t("marks.overall")}

-

- {markWithGrade(props.report.overall_average, props.report.overall_grade)} -

-
-
+
+
+ + {(identity) => ( +
+

{identity().name}

+
+ + {(className) => {className}} + + + + {t("roster.studentNumber")}: {identity().studentNumber} + + +
+
+ )} +
+
+
+

{t("marks.overall")}

+
+

+ {props.report.overall_average == null ? "—" : formatDecimal(props.report.overall_average, locale())} +

+ + {t("marks.bandLabel", { grade: props.report.overall_grade! })} + +
+ +
+
+
+
+
+
+
{t("nav.courses")}
+
{props.report.courses.length}
+
+
+
{t("marks.examCount")}
+
{resultCount()}
+
+
-
-
-
{t("nav.courses")}
-
{props.report.courses.length}
-
-
-
{t("exams.results")}
-
{resultCount()}
-
-
- 0} fallback={{t("marks.empty")}}> + 0} fallback={
}> setTab(value === "byCourse" ? "byCourse" : "general")}> - + {t("marks.tabGeneral")} {t("marks.tabByCourse")} @@ -210,44 +246,36 @@ export function MarksReportView(props: { report: MarksReport; compact?: boolean
-
- - {(block) => ( - - )} - +
+ +
{(block) => (
-
+
- + {block.course.title} {openLabel()}
-
+

{t("marks.courseAvg")}

{markWithGrade(block.average, block.average_grade)}

@@ -258,7 +286,7 @@ export function MarksReportView(props: { report: MarksReport; compact?: boolean class="min-w-0" columns={columns()} data={block.results} - tableClass={cn("w-full", compact() ? "text-xs" : "table-fixed sm:min-w-xl")} + tableClass={cn("w-full min-w-xl", compact() ? "text-xs" : "table-fixed")} enableColumnVisibility={false} /> diff --git a/src/pages/student-marks-page.tsx b/src/pages/student-marks-page.tsx index 84a2a96..58b9d64 100644 --- a/src/pages/student-marks-page.tsx +++ b/src/pages/student-marks-page.tsx @@ -3,7 +3,7 @@ import { createResource } from "@/lib/create-resource"; import type { ColumnDef } from "@tanstack/solid-table"; import { getUserMarks } from "@/api/reports"; import { ApiError, formatApiError } from "@/api/client"; -import type { MarksReport, PersonRef } from "@/api/client"; +import type { MarksReport } from "@/api/client"; import { cn } from "@/lib/cn"; import { MarksReportView } from "@/components/marks/marks-report-view"; import { RouteGuard } from "@/components/layout/route-guard"; @@ -16,7 +16,6 @@ import { SidePanel } from "@/components/ui/side-panel"; import { studentDirectoryColumns } from "@/components/users/student-directory-columns"; import { TableRowActions } from "@/components/ui/table-row-actions"; import { matchesSearch } from "@/lib/search-text"; -import { personLabel } from "@/lib/person"; import { getStudentDirectory, type StudentDirectoryRow } from "@/lib/student-directory"; import { usePreferences, useT } from "@/stores/preferences-context"; import { formatDecimal } from "@/lib/format"; @@ -38,7 +37,7 @@ const MARKS_FETCH_CAP = 200; function StudentMarksContent() { const t = useT(); const { locale } = usePreferences(); - const [viewUser, setViewUser] = createSignal(null); + const [viewStudent, setViewStudent] = createSignal(null); const [error, setError] = createSignal(""); const [list] = createResource(async () => { @@ -80,7 +79,7 @@ function StudentMarksContent() { }; const [report, { refetch: refetchReport }] = createResource( - () => viewUser()?.id ?? null, + () => viewStudent()?.person.id ?? null, async (id) => { if (!id) return null; try { @@ -158,7 +157,7 @@ function StudentMarksContent() { icon: , onSelect: () => { setError(""); - setViewUser(cell.row.original.person); + setViewStudent(cell.row.original); }, }, ]} @@ -170,7 +169,7 @@ function StudentMarksContent() { return (
- + {error()} @@ -190,7 +189,7 @@ function StudentMarksContent() { storageKey="student-marks" onRowClick={(row) => { setError(""); - setViewUser(row.person); + setViewStudent(row); }} /> @@ -198,15 +197,14 @@ function StudentMarksContent() { { if (!open) { - setViewUser(null); + setViewStudent(null); setError(""); } }} - title={t("marks.forUser", { user: personLabel(viewUser()) })} - description={t("marks.lookup")} + title={t("nav.studentMarks")} >
@@ -215,7 +213,19 @@ function StudentMarksContent() {

{t("common.loading")}

- {(r) => } + + {(student) => ( + cls.name), + }} + /> + )} +