完整性更新

现在已经实现了大部分基础功能
This commit is contained in:
SpecialX
2026-01-08 11:14:03 +08:00
parent 0da2eac0b4
commit 57807def37
155 changed files with 26421 additions and 1036 deletions

View File

@@ -0,0 +1,89 @@
import { Card, CardContent, CardHeader, CardTitle } from "@/shared/components/ui/card"
import { Badge } from "@/shared/components/ui/badge"
import { EmptyState } from "@/shared/components/ui/empty-state"
import { CalendarX, Clock, MapPin } from "lucide-react"
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" },
]
export function StudentScheduleView({ items }: { items: StudentScheduleItem[] }) {
if (items.length === 0) {
return (
<EmptyState
icon={CalendarX}
title="No schedule"
description="No timetable entries found for your enrolled classes."
className="h-80"
/>
)
}
const itemsByDay = new Map<number, StudentScheduleItem[]>()
for (const item of items) {
const list = itemsByDay.get(item.weekday) ?? []
list.push(item)
itemsByDay.set(item.weekday, list)
}
for (const [day, list] of itemsByDay) {
list.sort((a, b) => a.startTime.localeCompare(b.startTime))
itemsByDay.set(day, list)
}
return (
<div className="grid gap-4 lg:grid-cols-2">
{WEEKDAYS.map((d) => {
const dayItems = itemsByDay.get(d.key) ?? []
return (
<Card key={d.key}>
<CardHeader className="pb-3">
<CardTitle className="text-sm font-medium">{d.label}</CardTitle>
</CardHeader>
<CardContent className="space-y-3">
{dayItems.length === 0 ? (
<div className="text-sm text-muted-foreground">No classes.</div>
) : (
dayItems.map((item) => (
<div
key={item.id}
className="flex items-start justify-between gap-3 rounded-md border bg-card p-3"
>
<div className="min-w-0 space-y-1">
<div className="font-medium leading-none truncate">{item.course}</div>
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground">
<div className="inline-flex items-center">
<Clock className="mr-1 h-3 w-3" />
<span className="tabular-nums">
{item.startTime}{item.endTime}
</span>
</div>
{item.location ? (
<div className="inline-flex items-center min-w-0">
<MapPin className="mr-1 h-3 w-3 shrink-0" />
<span className="truncate">{item.location}</span>
</div>
) : null}
</div>
</div>
<Badge variant="secondary" className="shrink-0">
{item.className}
</Badge>
</div>
))
)}
</CardContent>
</Card>
)
})}
</div>
)
}