diff --git a/src/components/sections/Schedule.tsx b/src/components/sections/Schedule.tsx index 8bfbb96..d7cd562 100644 --- a/src/components/sections/Schedule.tsx +++ b/src/components/sections/Schedule.tsx @@ -1,6 +1,7 @@ "use client"; import { useState, useMemo, useCallback } from "react"; +import { BookingModal } from "@/components/ui/BookingModal"; import { CalendarDays, Users, LayoutGrid } from "lucide-react"; import { SectionHeading } from "@/components/ui/SectionHeading"; import { Reveal } from "@/components/ui/Reveal"; @@ -28,6 +29,7 @@ export function Schedule({ data: schedule, classItems }: ScheduleProps) { const [filterStatus, setFilterStatus] = useState("all"); const [filterTime, setFilterTime] = useState("all"); const [filterDaySet, setFilterDaySet] = useState>(new Set()); + const [bookingGroup, setBookingGroup] = useState(null); const isAllMode = locationMode === "all"; @@ -329,9 +331,15 @@ export function Schedule({ data: schedule, classItems }: ScheduleProps) { filterTrainer={filterTrainer} setFilterTrainer={setFilterTrainerFromCard} showLocation={isAllMode} + onBook={setBookingGroup} /> )} + setBookingGroup(null)} + groupInfo={bookingGroup ?? undefined} + /> ); } diff --git a/src/components/sections/schedule/GroupView.tsx b/src/components/sections/schedule/GroupView.tsx index 44d517c..6154959 100644 --- a/src/components/sections/schedule/GroupView.tsx +++ b/src/components/sections/schedule/GroupView.tsx @@ -55,6 +55,7 @@ interface GroupViewProps { filterTrainer: string | null; setFilterTrainer: (trainer: string | null) => void; showLocation?: boolean; + onBook?: (groupInfo: string) => void; } export function GroupView({ @@ -65,6 +66,7 @@ export function GroupView({ filterTrainer, setFilterTrainer, showLocation, + onBook, }: GroupViewProps) { const groups = buildGroups(filteredDays); @@ -177,6 +179,14 @@ export function GroupView({ ))} + {onBook && ( + + )} ); diff --git a/src/components/sections/team/TeamProfile.tsx b/src/components/sections/team/TeamProfile.tsx index 188b88f..857807a 100644 --- a/src/components/sections/team/TeamProfile.tsx +++ b/src/components/sections/team/TeamProfile.tsx @@ -2,6 +2,7 @@ import { useState, useEffect, useRef, useCallback } from "react"; import Image from "next/image"; import { ArrowLeft, Instagram, Trophy, GraduationCap, ExternalLink, X, Award, Scale, Clock, MapPin } from "lucide-react"; import type { TeamMember, RichListItem, VictoryItem, ScheduleLocation } from "@/types/content"; +import { BookingModal } from "@/components/ui/BookingModal"; interface TeamProfileProps { member: TeamMember; @@ -11,6 +12,7 @@ interface TeamProfileProps { export function TeamProfile({ member, onBack, schedule }: TeamProfileProps) { const [lightbox, setLightbox] = useState(null); + const [bookingGroup, setBookingGroup] = useState(null); useEffect(() => { function handleKeyDown(e: KeyboardEvent) { @@ -177,7 +179,7 @@ export function TeamProfile({ member, onBack, schedule }: TeamProfileProps) { {uniqueGroups.map((g, i) => ( -
+

{g.type}

@@ -195,6 +197,12 @@ export function TeamProfile({ member, onBack, schedule }: TeamProfileProps) { Набор открыт )} +
))} @@ -274,6 +282,12 @@ export function TeamProfile({ member, onBack, schedule }: TeamProfileProps) {
)} + + setBookingGroup(null)} + groupInfo={bookingGroup ?? undefined} + /> ); } diff --git a/src/components/ui/BookingModal.tsx b/src/components/ui/BookingModal.tsx index a09f0a9..7eec373 100644 --- a/src/components/ui/BookingModal.tsx +++ b/src/components/ui/BookingModal.tsx @@ -8,9 +8,10 @@ import { siteContent } from "@/data/content"; interface BookingModalProps { open: boolean; onClose: () => void; + groupInfo?: string; } -export function BookingModal({ open, onClose }: BookingModalProps) { +export function BookingModal({ open, onClose, groupInfo }: BookingModalProps) { const { contact } = siteContent; const [name, setName] = useState(""); const [phone, setPhone] = useState("+375 "); @@ -65,7 +66,8 @@ export function BookingModal({ open, onClose }: BookingModalProps) { (e: React.FormEvent) => { e.preventDefault(); // Build Instagram DM message with pre-filled text - const message = `Здравствуйте! Меня зовут ${name}, хочу записаться на занятие. Мой телефон: ${phone}`; + const groupText = groupInfo ? ` (${groupInfo})` : ""; + const message = `Здравствуйте! Меня зовут ${name}, хочу записаться на занятие${groupText}. Мой телефон: ${phone}`; const instagramUrl = `https://ig.me/m/blackheartdancehouse?text=${encodeURIComponent(message)}`; window.open(instagramUrl, "_blank"); setSubmitted(true);