- Add ranking-trend-card and school-wide-summary-card for broader analytics - Add score-cell and grade-filters components for table rendering - Add scope-filter and type-guards lib utilities for grade data filtering - Update actions, data-access (analytics, ranking, main), stats-service, export - Update schema, types, and grade-utils lib - Update all grade chart and report components (distribution, trend, comparison, query)
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import type { JSX } from "react"
|
|
import { getTranslations } from "next-intl/server"
|
|
|
|
import { ChipNav } from "@/shared/components/ui/chip-nav"
|
|
|
|
interface StatsClassSelectorProps {
|
|
classes: Array<{ id: string; name: string }>
|
|
subjects: Array<{ id: string; name: string }>
|
|
currentClassId: string
|
|
currentSubjectId: string
|
|
}
|
|
|
|
export async function StatsClassSelector({
|
|
classes,
|
|
subjects,
|
|
currentClassId,
|
|
currentSubjectId,
|
|
}: StatsClassSelectorProps): Promise<JSX.Element> {
|
|
const t = await getTranslations("grades")
|
|
return (
|
|
<div className="flex flex-wrap gap-2">
|
|
<ChipNav
|
|
options={classes}
|
|
currentId={currentClassId}
|
|
buildHref={(id) =>
|
|
`/teacher/grades/stats?classId=${id}${currentSubjectId !== "all" ? `&subjectId=${currentSubjectId}` : ""}`
|
|
}
|
|
/>
|
|
<div className="ml-auto">
|
|
<ChipNav
|
|
options={subjects}
|
|
currentId={currentSubjectId}
|
|
buildHref={(id) =>
|
|
id === "all"
|
|
? `/teacher/grades/stats?classId=${currentClassId}`
|
|
: `/teacher/grades/stats?classId=${currentClassId}&subjectId=${id}`
|
|
}
|
|
allOption={{ id: "all", label: t("filters.allSubjects") }}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|