import { Clock, User, MapPin } from "lucide-react"; import { shortAddress, findStatusConfig } from "./constants"; import { ScheduleBadge } from "@/components/ui/ScheduleBadge"; import type { ScheduleDayMerged, ScheduleClassWithLocation } from "./constants"; interface DayCardProps { day: ScheduleDayMerged; typeDots: Record; showLocation?: boolean; filterTrainerSet: Set; toggleFilterTrainer: (trainer: string | null) => void; filterTypes: Set; toggleFilterType: (type: string) => void; statuses?: { key: string; label: string; description: string }[]; } function ClassRow({ cls, typeDots, filterTrainerSet, toggleFilterTrainer, filterTypes, toggleFilterType, statuses, }: { cls: ScheduleClassWithLocation; typeDots: Record; filterTrainerSet: Set; toggleFilterTrainer: (trainer: string | null) => void; filterTypes: Set; toggleFilterType: (type: string) => void; statuses?: { key: string; label: string; description: string }[]; }) { return (
{cls.time}
{cls.status && (() => { const cfg = findStatusConfig(statuses, cls.status); return {cfg?.label || cls.status}; })()} {cls.level && {cls.level}}
); } export function DayCard({ day, typeDots, showLocation, filterTrainerSet, toggleFilterTrainer, filterTypes, toggleFilterType, statuses }: DayCardProps) { // Group classes by location when showLocation is true const locationGroups = showLocation ? Array.from( day.classes.reduce((map, cls) => { const loc = cls.locationName ?? ""; if (!map.has(loc)) { map.set(loc, { address: cls.locationAddress, classes: [] }); } map.get(loc)!.classes.push(cls); return map; }, new Map()) ) : null; return (
{/* Day header */}
{day.dayShort} {day.day}
{/* Classes */} {locationGroups ? ( // Split by location
{locationGroups.map(([locName, { address, classes }], gi) => (
{/* Location sub-header */}
0 ? "border-t border-gold/10" : ""}`}> {locName} {address && shortAddress(address) !== locName && ( · {shortAddress(address)} )}
{classes.map((cls, i) => ( ))}
))}
) : ( // Single location — no sub-headers
{day.classes.map((cls, i) => ( ))}
)}
); }