feat: schedule group view — trainer photos, today badge, click-to-bio
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user