From 699a10ea85983c313b383a55a7351485e1771605 Mon Sep 17 00:00:00 2001 From: Bohdan Hrabynskyi Date: Sun, 8 Dec 2024 21:08:12 +0100 Subject: [PATCH] Delete redundant elements in the SearchBar --- server/src/data/bookings.json | 7 ++++++- server/src/data/reservations.json | 21 +++++++++++++++++++++ src/components/SearchBar/SearchBar.jsx | 19 +++---------------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/server/src/data/bookings.json b/server/src/data/bookings.json index fc5d024..1f4955e 100644 --- a/server/src/data/bookings.json +++ b/server/src/data/bookings.json @@ -20,7 +20,12 @@ "petsNumber": 2 } }, - "alreadyBookedDates": [] + "alreadyBookedDates": [ + { + "startDate": "12/10/2024", + "endDate": "12/13/2024" + } + ] }, { "id": 2, diff --git a/server/src/data/reservations.json b/server/src/data/reservations.json index 9948956..451a424 100644 --- a/server/src/data/reservations.json +++ b/server/src/data/reservations.json @@ -82,5 +82,26 @@ "cleaningFee": 10, "longStayDiscount": 0 } + }, + { + "reservationId": 5, + "productId": 1, + "checkInDate": "12/10/2024", + "checkOutDate": "12/13/2024", + "guestCounts": { + "adults": 2, + "children": 1, + "infants": 1, + "pets": 1 + }, + "totalPrice": 458, + "breakdown": { + "nights": 3, + "pricePerNight": 146, + "basePrice": 438, + "airbnbServiceFee": 10, + "cleaningFee": 10, + "longStayDiscount": 0 + } } ] \ No newline at end of file diff --git a/src/components/SearchBar/SearchBar.jsx b/src/components/SearchBar/SearchBar.jsx index 44f27e6..2582f0a 100644 --- a/src/components/SearchBar/SearchBar.jsx +++ b/src/components/SearchBar/SearchBar.jsx @@ -29,7 +29,6 @@ const SearchBar = ({ searchType, onSearch }) => { const [showCalendar, setShowCalendar] = useState(false); const [showWhoDropdown, setShowWhoDropdown] = useState(false); const [closing, setClosing] = useState(false); - // const [handelGuestsPopUp, setHandelGuestsPopUp] = useState(false); const [handelDestinationPopUp, setHandelDestinationPopUp] = useState(false); const [hoverStates, setHoverStates] = useState({ location: false, @@ -124,15 +123,10 @@ const SearchBar = ({ searchType, onSearch }) => { } const closeCalendarPopup = () => setShowCalendar(false) - const closeDestinationPopup = () => setHandelDestinationPopUp(false) // - // const closeGuestPopup = () => setHandelGuestsPopUp(false) - - // const searchBarRef = useOutsideClick(disableSearchBarFocus); - // const calendarRef = useOutsideClick(closeCalendarPopup) - const destinationRef = useOutsideClick(closeDestinationPopup) - // const guestRef = useOutsideClick(closeGuestPopup) + const closeDestinationPopup = () => setHandelDestinationPopUp(false) const closeWhoDropdown = () => setShowWhoDropdown(false) + const destinationRef = useOutsideClick(closeDestinationPopup) const searchBarRef = useOutsideClick(disableSearchBarFocus); const calendarRef = useOutsideClick(closeCalendarPopup) const whoRef = useOutsideClick(closeWhoDropdown) @@ -223,9 +217,7 @@ const SearchBar = ({ searchType, onSearch }) => { onSearch(searchParams); }; - // const handelWhoPopup = () => { - // setHandelGuestsPopUp(!handelGuestsPopUp); - // } + const handelDestinationClick = () =>{ setHandelDestinationPopUp(!handelDestinationPopUp); } @@ -505,11 +497,6 @@ const SearchBar = ({ searchType, onSearch }) => { -
- -
{showWhoDropdown && (