feat: schedule group view — trainer photos, today badge, click-to-bio

This commit is contained in:
2026-03-26 12:06:46 +03:00
parent f65a6ed811
commit c9cfe63837
4 changed files with 154 additions and 88 deletions
+13 -1
View File
@@ -79,9 +79,10 @@ function scheduleReducer(state: ScheduleState, action: ScheduleAction): Schedule
interface ScheduleProps {
data: SiteContent["schedule"];
classItems?: { name: string; color?: string }[];
teamMembers?: { name: string; image: string }[];
}
export function Schedule({ data: schedule, classItems }: ScheduleProps) {
export function Schedule({ data: schedule, classItems, teamMembers }: ScheduleProps) {
const [state, dispatch] = useReducer(scheduleReducer, initialState);
const { locationMode, viewMode, filterTrainer, filterType, filterStatus, filterTime, filterDaySet, bookingGroup } = state;
@@ -109,6 +110,16 @@ export function Schedule({ data: schedule, classItems }: ScheduleProps) {
const typeDots = useMemo(() => buildTypeDots(classItems), [classItems]);
const trainerPhotos = useMemo(() => {
const map: Record<string, string> = {};
if (teamMembers) {
for (const m of teamMembers) {
if (m.image) map[m.name] = m.image;
}
}
return map;
}, [teamMembers]);
// Build days: either from one location or merged from all
const activeDays: ScheduleDayMerged[] = useMemo(() => {
if (locationMode !== "all") {
@@ -395,6 +406,7 @@ export function Schedule({ data: schedule, classItems }: ScheduleProps) {
setFilterTrainer={setFilterTrainerFromCard}
showLocation={isAllMode}
onBook={(v) => dispatch({ type: "SET_BOOKING", value: v })}
trainerPhotos={trainerPhotos}
/>
</Reveal>
)}