import Link from "next/link" import { getTranslations } from "next-intl/server" import { Card, CardContent, CardHeader, CardTitle } from "@/shared/components/ui/card" import { Badge } from "@/shared/components/ui/badge" import { CalendarDays, CalendarX, MapPin } from "lucide-react" import { EmptyState } from "@/shared/components/ui/empty-state" import { cn } from "@/shared/lib/utils" import { ScrollArea } from "@/shared/components/ui/scroll-area" import { getScheduleStatus } from "@/modules/dashboard/lib/dashboard-utils" import type { TeacherTodayScheduleItem } from "@/modules/dashboard/types" export async function TeacherSchedule({ items }: { items: TeacherTodayScheduleItem[] }) { const t = await getTranslations("dashboard") const hasSchedule = items.length > 0 return ( {t("sections.todaySchedule")} {!hasSchedule ? ( ) : (
{items.map((item, index) => { const status = getScheduleStatus(item.startTime, item.endTime, new Date()) const isLive = status === "live" const isPast = status === "past" const isLast = index === items.length - 1 return (
{item.course} {isLive && ( {t("badge.live")} )}
{item.className} {item.location && ( <> · {item.location} )}
{item.startTime} – {item.endTime}
{!isLast && (
)}
) })} {items.length > 3 ? (
{t("schedule.scrollForMore")}
) : (
{t("schedule.noMoreClasses")}
)}
)} ) }