refactor(modules): update classes, course-plans, diagnostic, questions, settings, student, layout

- Update classes data-access (invitations, main) for invitation management

- Update course-plans actions, data-access, and types

- Update diagnostic data-access for report queries

- Update questions data-access for question bank queries

- Update settings actions, ai-provider-settings-card, data-access, and types

- Update student course-filters, student-courses-view, student-schedule-filters, student-schedule-view

- Update layout app-sidebar, site-header, and navigation config
This commit is contained in:
SpecialX
2026-06-24 12:03:35 +08:00
parent c9e46f9f80
commit 8c2fe14c20
18 changed files with 712 additions and 189 deletions

View File

@@ -3,17 +3,18 @@ import { EmptyState } from "@/shared/components/ui/empty-state"
import { CalendarX } from "lucide-react"
import { ScheduleList } from "@/shared/components/schedule/schedule-list"
import { cn } from "@/shared/lib/utils"
import { useTranslations } from "next-intl"
import type { StudentScheduleItem } from "@/modules/classes/types"
const WEEKDAYS: Array<{ key: 1 | 2 | 3 | 4 | 5 | 6 | 7; label: string }> = [
{ key: 1, label: "Mon" },
{ key: 2, label: "Tue" },
{ key: 3, label: "Wed" },
{ key: 4, label: "Thu" },
{ key: 5, label: "Fri" },
{ key: 6, label: "Sat" },
{ key: 7, label: "Sun" },
const WEEKDAY_KEYS: Array<{ key: 1 | 2 | 3 | 4 | 5 | 6 | 7; label: string }> = [
{ key: 1, label: "mon" },
{ key: 2, label: "tue" },
{ key: 3, label: "wed" },
{ key: 4, label: "thu" },
{ key: 5, label: "fri" },
{ key: 6, label: "sat" },
{ key: 7, label: "sun" },
]
const getTodayWeekday = (): 1 | 2 | 3 | 4 | 5 | 6 | 7 => {
@@ -27,12 +28,14 @@ const getTodayWeekday = (): 1 | 2 | 3 | 4 | 5 | 6 | 7 => {
}
export function StudentScheduleView({ items }: { items: StudentScheduleItem[] }) {
const t = useTranslations("student")
if (items.length === 0) {
return (
<EmptyState
icon={CalendarX}
title="No schedule"
description="No timetable entries found for your enrolled classes."
title={t("scheduleView.noSchedule")}
description={t("scheduleView.noScheduleDesc")}
className="h-80"
/>
)
@@ -52,7 +55,7 @@ export function StudentScheduleView({ items }: { items: StudentScheduleItem[] })
return (
<div className="grid gap-4 lg:grid-cols-2">
{WEEKDAYS.map((d) => {
{WEEKDAY_KEYS.map((d) => {
const dayItems = itemsByDay.get(d.key) ?? []
const isToday = d.key === todayKey
return (
@@ -64,17 +67,17 @@ export function StudentScheduleView({ items }: { items: StudentScheduleItem[] })
>
<CardHeader className="pb-3">
<CardTitle className="flex items-center gap-2 text-sm font-medium">
<span>{d.label}</span>
<span>{t(`weekdays.${d.label}`)}</span>
{isToday && (
<span className="rounded-full bg-primary px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground">
Today
{t("scheduleView.today")}
</span>
)}
</CardTitle>
</CardHeader>
<CardContent>
{dayItems.length === 0 ? (
<div className="text-sm text-muted-foreground">No classes.</div>
<div className="text-sm text-muted-foreground">{t("scheduleView.noClasses")}</div>
) : (
<ScheduleList
items={dayItems.map((item) => ({