diff --git a/client/public/images/layouts/layout-1.jpg b/client/public/images/layouts/layout-1.jpg new file mode 100644 index 0000000..0319fb2 Binary files /dev/null and b/client/public/images/layouts/layout-1.jpg differ diff --git a/client/public/images/layouts/layout-1.png b/client/public/images/layouts/layout-1.png new file mode 100644 index 0000000..cd06273 Binary files /dev/null and b/client/public/images/layouts/layout-1.png differ diff --git a/client/public/images/layouts/layout-2.jpg b/client/public/images/layouts/layout-2.jpg new file mode 100644 index 0000000..3f68841 Binary files /dev/null and b/client/public/images/layouts/layout-2.jpg differ diff --git a/client/public/images/layouts/layout-3.jpg b/client/public/images/layouts/layout-3.jpg new file mode 100644 index 0000000..8bdab70 Binary files /dev/null and b/client/public/images/layouts/layout-3.jpg differ diff --git a/client/public/images/layouts/layout-4.jpg b/client/public/images/layouts/layout-4.jpg new file mode 100644 index 0000000..596edfe Binary files /dev/null and b/client/public/images/layouts/layout-4.jpg differ diff --git a/client/public/images/layouts/layout-5.jpg b/client/public/images/layouts/layout-5.jpg new file mode 100644 index 0000000..c55bbab Binary files /dev/null and b/client/public/images/layouts/layout-5.jpg differ diff --git a/client/public/images/layouts/layout-6.jpg b/client/public/images/layouts/layout-6.jpg new file mode 100644 index 0000000..c79cd67 Binary files /dev/null and b/client/public/images/layouts/layout-6.jpg differ diff --git a/client/public/images/layouts/layout-7.jpg b/client/public/images/layouts/layout-7.jpg new file mode 100644 index 0000000..e34309a Binary files /dev/null and b/client/public/images/layouts/layout-7.jpg differ diff --git a/client/public/images/layouts/layout-8.jpg b/client/public/images/layouts/layout-8.jpg new file mode 100644 index 0000000..3f1064f Binary files /dev/null and b/client/public/images/layouts/layout-8.jpg differ diff --git a/client/public/images/loader.png b/client/public/images/loader.png new file mode 100644 index 0000000..707d19d Binary files /dev/null and b/client/public/images/loader.png differ diff --git a/client/public/videos/studio_flex_bed.mp4 b/client/public/videos/studio_flex_bed.mp4 new file mode 100644 index 0000000..8df14b4 Binary files /dev/null and b/client/public/videos/studio_flex_bed.mp4 differ diff --git a/client/src/components/ApartmentSidebar.tsx b/client/src/components/ApartmentSidebar.tsx index c04fc2a..61d1283 100644 --- a/client/src/components/ApartmentSidebar.tsx +++ b/client/src/components/ApartmentSidebar.tsx @@ -1,13 +1,26 @@ import { useNavigate } from "react-router-dom"; import Button from "./Button"; -import { formatNumber } from "../calc/formatNumber"; +// import { formatNumber } from "../calc/formatNumber"; +import { IAparmentRes } from "../types/apartmentsRes"; +import { apartmentRoutes } from "../consts/apartmentsRoutes"; -const ApartmentSidebar = () => { +interface ApartmentSidebarProps { + currentApartment: IAparmentRes; +} + +const ApartmentSidebar = ({ currentApartment }: ApartmentSidebarProps) => { const navigate = useNavigate(); + const route = apartmentRoutes.find( + (aprt) => aprt.type === currentApartment.Unit_Type + )?.virtualTour; + const unitNo = currentApartment.Unit_No.split("-")[1]; + const wing = + currentApartment.Unit_No.split("-")[0] === "E" ? "East Wing" : "West Wing"; const handleOn3DTourClick = () => { - navigate(`../virtual-tour/apartments-studio-1`); + navigate(`../virtual-tour/${route ? route : "apartments-studio-1"}`); }; + return (
@@ -28,29 +41,32 @@ const ApartmentSidebar = () => {

Complex

-

ROVE Home Marasi Drive

+

{currentApartment.Project_Name}

Section

-

East Wing

+

{wing}

Floor

-

11

+

{currentApartment.Floor}

Number

-

213

+

{unitNo}

Size

-

609 Sqft

+

+ {currentApartment.Total_Area_Sqft} Sqft +

- AED {formatNumber(1668888, ",", 3, 1)} + Unvailiable + {/* AED {formatNumber(1668888, ",", 3, 1)} */}

diff --git a/client/src/components/complexWingPage/FloorSidebar/FloorWestWingHighlighting.tsx b/client/src/components/complexWingPage/FloorSidebar/EastWingHighlighting.tsx similarity index 98% rename from client/src/components/complexWingPage/FloorSidebar/FloorWestWingHighlighting.tsx rename to client/src/components/complexWingPage/FloorSidebar/EastWingHighlighting.tsx index 3e86995..d19f083 100644 --- a/client/src/components/complexWingPage/FloorSidebar/FloorWestWingHighlighting.tsx +++ b/client/src/components/complexWingPage/FloorSidebar/EastWingHighlighting.tsx @@ -1,4 +1,4 @@ -interface FloorWestWingHighlightingProps { +interface EastWingHighlightingProps { handleOnMouseOut: | (() => void) | ((event: React.MouseEvent) => void); @@ -10,11 +10,11 @@ interface FloorWestWingHighlightingProps { ) => void; } -const FloorWestWingHighlighting = ({ +const EastWingHighlighting = ({ handleOnMouseOut, handleOnMouseOver, handleOnApartmentClick, -}: FloorWestWingHighlightingProps) => { +}: EastWingHighlightingProps) => { return ( <> ( null ); + const [defaultApartments, setDefaultApartments] = useState( + [] + ); const [is3DTourAvailable] = useState(true); const { setModal } = useModal(); const descRef = useRef(null); @@ -46,7 +46,7 @@ const FloorSidebar = ({ event: React.MouseEvent ) { const apartmentType = event.currentTarget.dataset.type; - const apartment = floorApartments.find( + const apartment = defaultApartments.find( (aprt) => aprt.Unit_Type === apartmentType ); if (apartment) { @@ -58,11 +58,12 @@ const FloorSidebar = ({ function handleOnMouseOut(): void { setIsDescVisible(false); } + function handleOnMouseOver( event: React.MouseEvent ): void { const apartmentType = event.currentTarget.dataset.type; - const _hoveredApartment = floorApartments.find( + const _hoveredApartment = defaultApartments.find( (apart) => apart.Unit_Type === apartmentType ); if (_hoveredApartment) { @@ -81,6 +82,34 @@ const FloorSidebar = ({ }; }, []); + useEffect(() => { + if (!currentFloor) return; + const _defaultApartment: IAparmentRes[] = apartmentsWithoutVirtualTour.map( + (aprt, index) => { + const unitNo = `${currentFloor?.wing.slice(1)}-${index}`; + return { + id: unitNo, + Floor: currentFloor.floor, + Property_Status: "Available", + Unit_Type: aprt.type, + Project_Name: "Rove Home Marasi Drive", + Suite_Area_Sqft: 0, + Balcony_Area_Sqft: 0, + No_Of_Bedrooms: 1, + Unit_No: unitNo, + Total_Area_Sqft: 0, + No_of_Bathrooms: 0, + Property_Name: "-", + Unit_View: "-", + }; + } + ); + + setDefaultApartments([..._defaultApartment, ...floorApartments]); + + return () => {}; + }, [currentFloor, currentFloor?.floor, currentFloor?.wing, floorApartments]); + return ( <>
{currentFloor?.wing === "West Wing" ? ( + currentFloor && currentFloor.floor <= 21 ? ( + + + + + ) : ( + + + + + ) + ) : ( + + + + + )} + {/* {currentFloor?.wing === "West Wing" ? ( - ) : currentFloor && currentFloor.floor <= 21 ? ( - - - - - ) : ( - - - - - )} + ) : } */}
diff --git a/client/src/components/complexWingPage/FloorSidebar/FloorEastWingHighlighting.tsx b/client/src/components/complexWingPage/FloorSidebar/WestWingHighlighting.tsx similarity index 99% rename from client/src/components/complexWingPage/FloorSidebar/FloorEastWingHighlighting.tsx rename to client/src/components/complexWingPage/FloorSidebar/WestWingHighlighting.tsx index 45a8667..5247c79 100644 --- a/client/src/components/complexWingPage/FloorSidebar/FloorEastWingHighlighting.tsx +++ b/client/src/components/complexWingPage/FloorSidebar/WestWingHighlighting.tsx @@ -10,7 +10,7 @@ interface FloorEastWingHighlightingProps { ) => void; } -function FloorEastWingHighlighting({ +function WestWingHighlighting({ handleOnMouseOut, handleOnMouseOver, handleOnApartmentClick, @@ -79,6 +79,7 @@ function FloorEastWingHighlighting({ /> { +const WestWingLayout = () => { return ( <> { ); }; -export default FloorEastWingLayout; +export default WestWingLayout; diff --git a/client/src/components/complexWingPage/FloorSidebar/FloorEastWingTopHighlighting.tsx b/client/src/components/complexWingPage/FloorSidebar/WestWingTopLevelsHighlighting.tsx similarity index 92% rename from client/src/components/complexWingPage/FloorSidebar/FloorEastWingTopHighlighting.tsx rename to client/src/components/complexWingPage/FloorSidebar/WestWingTopLevelsHighlighting.tsx index 1b355c2..9613c5d 100644 --- a/client/src/components/complexWingPage/FloorSidebar/FloorEastWingTopHighlighting.tsx +++ b/client/src/components/complexWingPage/FloorSidebar/WestWingTopLevelsHighlighting.tsx @@ -1,4 +1,4 @@ -interface FloorEastWingTopHighlightingProps { +interface WestWingTopLevelsHighlightingProps { handleOnMouseOut: | (() => void) | ((event: React.MouseEvent) => void); @@ -10,11 +10,11 @@ interface FloorEastWingTopHighlightingProps { ) => void; } -function FloorEastWingTopHighlighting({ +function WestWingTopLevelsHighlighting({ handleOnMouseOut, handleOnMouseOver, handleOnApartmentClick, -}: FloorEastWingTopHighlightingProps) { +}: WestWingTopLevelsHighlightingProps) { return ( <> + + + + ); } -export default FloorEastWingTopHighlighting; +export default WestWingTopLevelsHighlighting; diff --git a/client/src/components/complexWingPage/FloorSidebar/FloorEastWingTopLayout.tsx b/client/src/components/complexWingPage/FloorSidebar/WestWingTopLevelsLayout.tsx similarity index 99% rename from client/src/components/complexWingPage/FloorSidebar/FloorEastWingTopLayout.tsx rename to client/src/components/complexWingPage/FloorSidebar/WestWingTopLevelsLayout.tsx index ae23575..24d867c 100644 --- a/client/src/components/complexWingPage/FloorSidebar/FloorEastWingTopLayout.tsx +++ b/client/src/components/complexWingPage/FloorSidebar/WestWingTopLevelsLayout.tsx @@ -1,4 +1,4 @@ -const FloorEastWingTopLayout = () => { +const WestWingTopLevelsLayout = () => { return ( <> { ); }; -export default FloorEastWingTopLayout; +export default WestWingTopLevelsLayout; diff --git a/client/src/components/complexWingPage/SequenceWing.tsx b/client/src/components/complexWingPage/SequenceWing.tsx index f3a30db..5446eed 100644 --- a/client/src/components/complexWingPage/SequenceWing.tsx +++ b/client/src/components/complexWingPage/SequenceWing.tsx @@ -12,9 +12,14 @@ import { mobileWidht, descriptions, } from "../../consts/masterplan"; -import { getApartments } from "../../api/apartments"; import { updateAccessToken } from "../../api/updateAccessToken"; -import { IAparmentRes, IApartmentsRes } from "../../types/apartmentsRes"; +import { IAparmentRes } from "../../types/apartmentsRes"; +import useMasterplanFilters from "../../store/useMasterplanFilters"; +import { initialRoveHomeCheckboxes } from "../../consts/initialMasterplanFilters"; +import { pageInitial } from "../../consts/initialMasterplanFilters"; +import { useDebounce } from "@uidotdev/usehooks"; +import { getFilteredApartments } from "../../calc/getFilteredApartments"; +import MasterplanLoaderModal from "../modals/MasterplanLoaderModal"; const skyGardenFloor = 22; @@ -27,6 +32,7 @@ const SequenceWing = () => { const [mousePos, setMousePos] = useState<[number, number]>([0, 0]); const [currentHoveredFloor, setHoverCurrentFloor] = useState(null); + const [isLoading, setIsLoading] = useState(true); const [currentFloor, setCurrentFloor] = useState( null ); @@ -41,6 +47,14 @@ const SequenceWing = () => { const [selectedApartments, setSelectedApartments] = useState( [] ); + const { + apartmentTypeCheckboxes, + switchers, + multirangeSliders, + viewCheckboxes, + sortList, + } = useMasterplanFilters(); + const debouncedSliders = useDebounce(multirangeSliders, 300); function handleResize() { const screenWidth = window.innerWidth; @@ -149,25 +163,60 @@ const SequenceWing = () => { useEffect(() => { const zohoToken = localStorage.getItem("ACCESS_TOKEN"); + setIsLoading(true); - getApartments(zohoToken) + getFilteredApartments( + zohoToken, + setApartments, + initialRoveHomeCheckboxes, + apartmentTypeCheckboxes, + debouncedSliders, + switchers, + viewCheckboxes, + sortList, + pageInitial, + 1000 + ) .catch((error) => { const errorStatus = error.response.status; if (errorStatus === 401) { updateAccessToken().then((token) => { if (token) { - getApartments(token); + getFilteredApartments( + token, + setApartments, + initialRoveHomeCheckboxes, + apartmentTypeCheckboxes, + debouncedSliders, + switchers, + viewCheckboxes, + sortList, + pageInitial, + 1000 + ); } }); } }) - .then((data) => { - const apartmentsData = (data as IApartmentsRes).apartments; - const updatedApartments = [...apartmentsData]; - setApartments(updatedApartments); + .finally(() => { + setIsLoading(false); }); - }, []); + }, [ + apartmentTypeCheckboxes, + debouncedSliders, + sortList, + switchers, + viewCheckboxes, + ]); + + useEffect(() => { + if (isLoading) { + setModal(); + } else { + setModal(null); + } + }, [isLoading, setModal]); return (
diff --git a/client/src/components/favoritesPage/FavoriteApartmentCard.tsx b/client/src/components/favoritesPage/FavoriteApartmentCard.tsx index 9f7d77c..55ae6b4 100644 --- a/client/src/components/favoritesPage/FavoriteApartmentCard.tsx +++ b/client/src/components/favoritesPage/FavoriteApartmentCard.tsx @@ -9,6 +9,7 @@ import { MobileModalWrapper } from "../modals/mobile/MobileModalWrapper"; import SendEnquiryMobileModal from "../modals/mobile/SendEnquiryMobileModal"; import { IAparmentRes } from "../../types/apartmentsRes"; import useFavorites from "../../store/useFavorites"; +import { apartmentRoutes } from "../../consts/apartmentsRoutes"; interface FavoriteAppartmentCardProps { card: IAparmentRes; @@ -19,6 +20,9 @@ const FavoriteAppartmentCard = ({ card }: FavoriteAppartmentCardProps) => { const wing = Unit_No.split("-")[0] === "E" ? "East" : "West"; const navigate = useNavigate(); const { setFavorites } = useFavorites(); + const layoutImage = apartmentRoutes.find( + (apr) => apr.type === card.Unit_Type + )?.layout; const { setModal } = useModal(); @@ -95,7 +99,11 @@ const FavoriteAppartmentCard = ({ card }: FavoriteAppartmentCardProps) => { />
- +
diff --git a/client/src/components/favoritesPage/FavoriteSliderCard.tsx b/client/src/components/favoritesPage/FavoriteSliderCard.tsx index 7ee01d4..172e98a 100644 --- a/client/src/components/favoritesPage/FavoriteSliderCard.tsx +++ b/client/src/components/favoritesPage/FavoriteSliderCard.tsx @@ -1,4 +1,5 @@ // import { formatNumber } from "../../calc/formatNumber"; +import { apartmentRoutes } from "../../consts/apartmentsRoutes"; import useFavorites from "../../store/useFavorites"; import { IAparmentRes } from "../../types/apartmentsRes"; import Button from "../Button"; @@ -13,6 +14,9 @@ interface FavoriteSliderCardProps { const FavoriteSliderCard = ({ card, elementRef }: FavoriteSliderCardProps) => { const wing = card.Unit_No.split("-")[0] === "E" ? "East" : "West"; const { setFavorites } = useFavorites(); + const layoutImage = apartmentRoutes.find( + (apr) => apr.type === card.Unit_Type + )?.layout; const handleOnAddFavoriteClick = ( e: React.MouseEvent @@ -58,9 +62,9 @@ const FavoriteSliderCard = ({ card, elementRef }: FavoriteSliderCardProps) => { />
diff --git a/client/src/components/header/Navbar/Navbar.tsx b/client/src/components/header/Navbar/Navbar.tsx index 489805f..465c83b 100644 --- a/client/src/components/header/Navbar/Navbar.tsx +++ b/client/src/components/header/Navbar/Navbar.tsx @@ -12,7 +12,7 @@ const Navbar = () => { const [tabs, setTabs] = useState(_tabs); const location = useLocation(); const navigate = useNavigate(); - const { favorites } = useFavorites(); + const { favorites, setFavorites } = useFavorites(); const onTabClick = (tab: Tab) => { setSelectedTab(tab); @@ -30,6 +30,13 @@ const Navbar = () => { } }, [location.pathname]); + useEffect(() => { + const _favorites = localStorage.getItem("Favorites"); + if (!_favorites) return; + const convertedFavorute = JSON.parse(_favorites); + setFavorites(convertedFavorute); + }, [setFavorites]); + useEffect(() => { const updatedTabs = _tabs.map((tab) => { if (tab.value === "Favorites") { diff --git a/client/src/components/icons/LoadingIcon.tsx b/client/src/components/icons/LoadingIcon.tsx new file mode 100644 index 0000000..589d328 --- /dev/null +++ b/client/src/components/icons/LoadingIcon.tsx @@ -0,0 +1,31 @@ +const LoadingIcon = () => { + return ( + + + + + + + + + + ); +}; + +export default LoadingIcon; diff --git a/client/src/components/modals/AboutComplexModal.tsx b/client/src/components/modals/AboutComplexModal.tsx index 7e140d9..ff4fa0d 100644 --- a/client/src/components/modals/AboutComplexModal.tsx +++ b/client/src/components/modals/AboutComplexModal.tsx @@ -8,35 +8,8 @@ import SwitchToggle from "../SwitchToggle"; import HeartIcon from "../icons/Heart"; import LeftArrowSliderIcon from "../icons/LeftArrowSliderIcon"; import { IAparmentRes } from "../../types/apartmentsRes"; - -interface IApartmentRoute { - type: string; - virtualTour: string; - id: string; -} - -const apartmentRoute: IApartmentRoute[] = [ - { - type: "1 BR Squared", - virtualTour: "apartments-studio-3", - id: "1", - }, - { - type: "Studio Squared", - virtualTour: "apartments-studio-2", - id: "2", - }, - { - type: "2 BR Squared", - virtualTour: "apartments-studio-4", - id: "3", - }, - { - type: "Studio Flex", - virtualTour: "apartments-studio-1", - id: "4", - }, -]; +import { apartmentsWithoutVirtualTour } from "../../consts/apartmentsWithoutVirtualTour"; +import { apartmentRoutes } from "../../consts/apartmentsRoutes"; interface AboutComplexModalProps { apartment: IAparmentRes; @@ -48,6 +21,15 @@ const AboutComplexModal = ({ apartment }: AboutComplexModalProps) => { const navigate = useNavigate(); const unitNumber = apartment.Unit_No.split("-")[1]; const wing = apartment.Unit_No.split("-")[0] === "E" ? "East" : "West"; + const isVirtualTourAvailialbe = !apartmentsWithoutVirtualTour.some( + (aprt) => aprt.type === apartment.Unit_Type + ); + + const layoutWithoutVirtualTour = isVirtualTourAvailialbe + ? apartmentRoutes.find((aprt) => aprt.type === apartment.Unit_Type)?.layout + : apartmentsWithoutVirtualTour.find( + (aprt) => aprt.type === apartment.Unit_Type + )?.layout; const handleOnBackClick = () => { setModal(false); @@ -59,7 +41,7 @@ const AboutComplexModal = ({ apartment }: AboutComplexModalProps) => { const handleOn3DTourClick = () => { setModal(null); - const virtualTour = apartmentRoute.find( + const virtualTour = apartmentRoutes.find( (route) => route.type === apartment.Unit_Type ); @@ -99,10 +81,10 @@ const AboutComplexModal = ({ apartment }: AboutComplexModalProps) => {
{/* Layout */}
-
+
@@ -172,6 +154,7 @@ const AboutComplexModal = ({ apartment }: AboutComplexModalProps) => { text="3D Tour" buttonType="secondary" className="w-full flex justify-center" + disabled={!isVirtualTourAvailialbe} />