refactor(modules): update existing module implementations across attendance, audit, auth, classes, course-plans, exams, files, homework, layout, proctoring, questions, scheduling, textbooks, users

- Update attendance components and data-access for record management

- Update audit log views, filters, and data-access

- Update auth login and register forms

- Update classes actions, components, and data-access (admin, schedule, stats)

- Update course-plans actions, form, list, progress, and schema

- Update exams actions, AI pipeline, preview components, and hooks

- Update files components (icon, list, preview, upload) and data-access

- Update homework assignment form, review view, auto-save hook, and stats-service

- Update layout sidebar, header, and navigation config

- Update proctoring actions, anti-cheat monitor, and data-access

- Update questions actions, components (dialog, actions, columns, filters), and data-access

- Update scheduling actions, auto-scheduler, components, and schema

- Update textbooks constants and text-selection hook

- Update users class-registration, import-dialog, data-access, and user-service
This commit is contained in:
SpecialX
2026-06-23 17:38:56 +08:00
parent 1a9377222c
commit 4f0ef217a0
56 changed files with 1251 additions and 850 deletions

View File

@@ -21,6 +21,7 @@ export type GradeOption = {
* 新增学科只需在此处添加一条记录,所有 Select/筛选/表单/设置弹窗自动同步。
*/
export const SUBJECTS: readonly SubjectOption[] = [
{ value: "Chinese", labelKey: "chinese" },
{ value: "Mathematics", labelKey: "mathematics" },
{ value: "Physics", labelKey: "physics" },
{ value: "Chemistry", labelKey: "chemistry" },
@@ -34,6 +35,8 @@ export const SUBJECTS: readonly SubjectOption[] = [
* 年级列表。
*/
export const GRADES: readonly GradeOption[] = [
{ value: "Grade 1", labelKey: "grade1" },
{ value: "Grade 2", labelKey: "grade2" },
{ value: "Grade 7", labelKey: "grade7" },
{ value: "Grade 8", labelKey: "grade8" },
{ value: "Grade 9", labelKey: "grade9" },
@@ -47,6 +50,8 @@ export const GRADES: readonly GradeOption[] = [
* key 必须与 SUBJECTS 中的 value 一致。
*/
export const SUBJECT_COLORS: Record<string, string> = {
Chinese:
"bg-rose-50 text-rose-700 border-rose-200/70 dark:bg-rose-950/50 dark:text-rose-200 dark:border-rose-900/60",
Mathematics:
"bg-blue-50 text-blue-700 border-blue-200/70 dark:bg-blue-950/50 dark:text-blue-200 dark:border-blue-900/60",
Physics:
@@ -73,3 +78,19 @@ export const DEFAULT_SUBJECT_COLOR =
export function getSubjectColor(subject: string): string {
return SUBJECT_COLORS[subject] ?? DEFAULT_SUBJECT_COLOR
}
/**
* 根据学科 value 获取 i18n labelKey。
* 未命中时返回 value 本身(作为兜底,调用方可直接用作显示文本)。
*/
export function getSubjectLabelKey(subject: string): string {
return SUBJECTS.find((s) => s.value === subject)?.labelKey ?? subject
}
/**
* 根据年级 value 获取 i18n labelKey。
* 未命中时返回 value 本身。
*/
export function getGradeLabelKey(grade: string): string {
return GRADES.find((g) => g.value === grade)?.labelKey ?? grade
}