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

View File

@@ -1,6 +1,6 @@
"use client";
import { useState } from "react";
import { useState, useEffect, useCallback } from "react";
import { SectionHeading } from "@/components/ui/SectionHeading";
import { Reveal } from "@/components/ui/Reveal";
import { TeamCarousel } from "@/components/sections/team/TeamCarousel";
@@ -17,6 +17,27 @@ export function Team({ data: team, schedule }: TeamProps) {
const [activeIndex, setActiveIndex] = useState(0);
const [showProfile, setShowProfile] = useState(false);
const openTrainerByName = useCallback((name: string) => {
const idx = team.members.findIndex((m) => m.name === name);
if (idx >= 0) {
setActiveIndex(idx);
setShowProfile(true);
setTimeout(() => {
const el = document.getElementById("team");
if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
}, 50);
}
}, [team.members]);
useEffect(() => {
function handler(e: Event) {
const name = (e as CustomEvent<string>).detail;
if (name) openTrainerByName(name);
}
window.addEventListener("openTrainerProfile", handler);
return () => window.removeEventListener("openTrainerProfile", handler);
}, [openTrainerByName]);
return (
<section
id="team"