import Link from "next/link" import { Calendar, ChevronRight, Clock, MapPin } from "lucide-react" import { Button } from "@/shared/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/shared/components/ui/card" import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/shared/components/ui/hover-card" import type { ClassScheduleItem } from "@/modules/classes/types" interface ClassScheduleWidgetProps { classId: string schedule: ClassScheduleItem[] } const WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] const WEEKDAY_INDICES = [1, 2, 3, 4, 5, 6, 7] // 1=Mon, 7=Sun export function ClassScheduleGrid({ schedule, compact = false }: { schedule: ClassScheduleItem[], compact?: boolean }) { // Group by weekday const groupedSchedule = schedule.reduce((acc, item) => { const day = item.weekday if (!acc[day]) acc[day] = [] acc[day].push(item) return acc }, {} as Record) // Sort items within each day by start time Object.keys(groupedSchedule).forEach(key => { groupedSchedule[Number(key)].sort((a, b) => a.startTime.localeCompare(b.startTime)) }) if (schedule.length === 0) { return (

No sessions scheduled.

) } return (
{WEEKDAYS.slice(0, 5).map((day) => (
{day}
))} {WEEKDAY_INDICES.slice(0, 5).map((dayNum) => { const items = groupedSchedule[dayNum] || [] return (
{items.length === 0 ? (
) : ( items.map(item => (
{item.course}
{item.startTime}-{item.endTime}
{item.course}
{item.startTime} - {item.endTime}
{item.location && (
{item.location}
)}
)) )}
) })}
) } export function ClassScheduleWidget({ classId, schedule }: ClassScheduleWidgetProps) { return ( Weekly Schedule
* Showing Mon-Fri schedule
) }