From 355dffc3c0e902967eff760ac66ea80271c7afee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Cie=C5=9Blik?= Date: Sun, 21 Jun 2026 06:33:55 +0200 Subject: [PATCH] Ukryj AvailabilitySearch i SlotFinder po przejsciu do kroku 3 wizarda --- src/components/BookingWizard.jsx | 7 ++++--- src/pages/DashboardPage.jsx | 11 ++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/BookingWizard.jsx b/src/components/BookingWizard.jsx index a881366..1201887 100644 --- a/src/components/BookingWizard.jsx +++ b/src/components/BookingWizard.jsx @@ -12,7 +12,7 @@ import styles from './BookingWizard.module.scss'; const STEPS = ['Service', 'Date & Time', 'Requirements', 'Summary']; const todayISO = () => new Date().toISOString().split('T')[0]; -const BookingWizard = ({ prefillSlot, onPrefillUsed }) => { +const BookingWizard = ({ prefillSlot, onPrefillUsed, onStepChange }) => { const { user } = useAuth(); const [step, setStep] = useState(1); const [data, setData] = useState({ serviceId: '', date: '', time: '', specialRequirements: '' }); @@ -57,8 +57,8 @@ const BookingWizard = ({ prefillSlot, onPrefillUsed }) => { return Object.keys(errs).length === 0; }; - const next = () => { if (validate()) setStep((s) => s + 1); }; - const back = () => { setFieldErrors({}); setStep((s) => s - 1); }; + const next = () => { if (validate()) { const s = step + 1; setStep(s); onStepChange?.(s); } }; + const back = () => { setFieldErrors({}); const s = step - 1; setStep(s); onStepChange?.(s); }; const handlePaymentSuccess = (paymentData) => { createReservation({ @@ -79,6 +79,7 @@ const BookingWizard = ({ prefillSlot, onPrefillUsed }) => { setFieldErrors({}); setDone(false); setReceipt(null); + onStepChange?.(1); }; const selectedService = services.find((s) => s.id === data.serviceId); diff --git a/src/pages/DashboardPage.jsx b/src/pages/DashboardPage.jsx index e529308..df0c7a5 100644 --- a/src/pages/DashboardPage.jsx +++ b/src/pages/DashboardPage.jsx @@ -18,6 +18,7 @@ const DashboardPage = () => { const { user, logout } = useAuth(); // useState do przechowywania stanu prefillSlot, który jest używany do wstępnego wypełnienia formularza rezerwacji wybranym slotem const [prefillSlot, setPrefillSlot] = useState(null); + const [wizardStep, setWizardStep] = useState(1); // useState do przechowywania stanu profileOpen, który jest używany do otwierania i zamykania modala edycji profilu const [profileOpen, setProfileOpen] = useState(false); // custom hook useUserReservations pobiera rezerwacje zalogowanego użytkownika z API i zwraca je w data @@ -57,15 +58,19 @@ const DashboardPage = () => {
- - - + {wizardStep < 3 && ( + <> + + + + )}
setPrefillSlot(null)} + onStepChange={setWizardStep} />