feat: UI improvements — scrollbar, multi-filters, pricing fix, routing, modals
- Global page scrollbar styled with gold theme - Schedule: multi-select for class types and status tags - Pricing: fix tab switch blink (display toggle vs conditional render) - OpenDay: trainer name more prominent, section divider added - Team: browser back button closes trainer bio (history API) - Modals: block scroll + compensate scrollbar width to prevent layout shift - Header: remove booking button from desktop nav
This commit is contained in:
@@ -17,17 +17,38 @@ export function Team({ data: team, schedule }: TeamProps) {
|
||||
const [activeIndex, setActiveIndex] = useState(0);
|
||||
const [showProfile, setShowProfile] = useState(false);
|
||||
|
||||
const openProfile = useCallback((index: number) => {
|
||||
setActiveIndex(index);
|
||||
setShowProfile(true);
|
||||
history.pushState({ trainerProfile: true }, "");
|
||||
}, []);
|
||||
|
||||
const closeProfile = useCallback(() => {
|
||||
setShowProfile(false);
|
||||
}, []);
|
||||
|
||||
const openTrainerByName = useCallback((name: string) => {
|
||||
const idx = team.members.findIndex((m) => m.name === name);
|
||||
if (idx >= 0) {
|
||||
setActiveIndex(idx);
|
||||
setShowProfile(true);
|
||||
openProfile(idx);
|
||||
setTimeout(() => {
|
||||
const el = document.getElementById("team");
|
||||
if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
}, 50);
|
||||
}
|
||||
}, [team.members]);
|
||||
}, [team.members, openProfile]);
|
||||
|
||||
// Handle browser back button
|
||||
useEffect(() => {
|
||||
function onPopState(e: PopStateEvent) {
|
||||
if (showProfile) {
|
||||
e.preventDefault();
|
||||
setShowProfile(false);
|
||||
}
|
||||
}
|
||||
window.addEventListener("popstate", onPopState);
|
||||
return () => window.removeEventListener("popstate", onPopState);
|
||||
}, [showProfile]);
|
||||
|
||||
useEffect(() => {
|
||||
function handler(e: Event) {
|
||||
@@ -75,14 +96,14 @@ export function Team({ data: team, schedule }: TeamProps) {
|
||||
members={team.members}
|
||||
activeIndex={activeIndex}
|
||||
onSelect={setActiveIndex}
|
||||
onOpenBio={() => setShowProfile(true)}
|
||||
onOpenBio={() => openProfile(activeIndex)}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<TeamProfile
|
||||
member={team.members[activeIndex]}
|
||||
onBack={() => setShowProfile(false)}
|
||||
onBack={() => { history.back(); }}
|
||||
schedule={schedule}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user