import { Clock, User, MapPin } from "lucide-react"; import { shortAddress } from "./constants"; import type { ScheduleDayMerged, ScheduleClassWithLocation } from "./constants"; interface DayCardProps { day: ScheduleDayMerged; typeDots: Record; showLocation?: boolean; filterTrainer: string | null; setFilterTrainer: (trainer: string | null) => void; filterType: string | null; setFilterType: (type: string | null) => void; } function ClassRow({ cls, typeDots, filterTrainer, setFilterTrainer, filterType, setFilterType, }: { cls: ScheduleClassWithLocation; typeDots: Record; filterTrainer: string | null; setFilterTrainer: (trainer: string | null) => void; filterType: string | null; setFilterType: (type: string | null) => void; }) { return (
{cls.time}
{cls.hasSlots && ( есть места )} {cls.recruiting && ( набор )}
{cls.level && ( {cls.level} )}
); } export function DayCard({ day, typeDots, showLocation, filterTrainer, setFilterTrainer, filterType, setFilterType }: 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-neutral-200 dark:border-white/[0.06]" : ""}`}> {locName} {address && · {shortAddress(address)}}
{classes.map((cls, i) => ( ))}
))}
) : ( // Single location — no sub-headers
{day.classes.map((cls, i) => ( ))}
)}
); }