diff --git a/.env b/.env index 67c1687..e9e9623 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ -# VITE_API_URL=http://localhost:4002 +VITE_API_URL=http://localhost:4002 # VITE_API_URL=http://192.168.1.144:4002 # VITE_API_URL=http://194.26.138.94:4002 # VITE_API_URL=https://irthtest.online/api -VITE_API_URL=https://irth.graff.estate/api \ No newline at end of file +# VITE_API_URL=https://irth.graff.estate/api \ No newline at end of file diff --git a/public/images/floor-plans/compass.png b/public/images/floor-plans/compass.png new file mode 100644 index 0000000..f975539 Binary files /dev/null and b/public/images/floor-plans/compass.png differ diff --git a/public/images/floor-plans/dubai-marina/ground.png b/public/images/floor-plans/dubai-marina/ground.png index e1ed955..30866dd 100644 Binary files a/public/images/floor-plans/dubai-marina/ground.png and b/public/images/floor-plans/dubai-marina/ground.png differ diff --git a/public/images/floor-plans/dubai-marina/podium.png b/public/images/floor-plans/dubai-marina/podium.png index b781b35..59c3dfd 100644 Binary files a/public/images/floor-plans/dubai-marina/podium.png and b/public/images/floor-plans/dubai-marina/podium.png differ diff --git a/public/images/floor-plans/dubai-marina/rooftop.png b/public/images/floor-plans/dubai-marina/rooftop.png index 787eb5e..6516591 100644 Binary files a/public/images/floor-plans/dubai-marina/rooftop.png and b/public/images/floor-plans/dubai-marina/rooftop.png differ diff --git a/src/components/FloorPopup.tsx b/src/components/FloorPopup.tsx index 73ab120..2b33f05 100644 --- a/src/components/FloorPopup.tsx +++ b/src/components/FloorPopup.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import { formattedUnitTypes } from "../data/formattedUnitTypes"; import { usePopupStore } from "../stores/usePopupStore"; import getAmentiesCount, { AmentiesCount } from "../utils/getAmentiesCount"; @@ -16,8 +16,15 @@ interface FloorPopupProps { function FloorPopup({ title, complexName, data, onSelect }: FloorPopupProps) { const { setPopup } = usePopupStore(); + const initialState = useMemo( + () => + Number.isNaN(+title.split(" ").at(-1)!) + ? getAmentiesCount(complexName, title) + : null, + [title, complexName] + ); const [amentiesCount, setAmentiesCount] = useState( - null + initialState ); useEffect(() => { @@ -30,10 +37,6 @@ function FloorPopup({ title, complexName, data, onSelect }: FloorPopupProps) { return () => setAmentiesCount(null); }, [complexName, title]); - useEffect(() => { - console.log(amentiesCount); - }, [amentiesCount]); - return (
@@ -44,81 +47,80 @@ function FloorPopup({ title, complexName, data, onSelect }: FloorPopupProps) {

{title.split(" ")[0]} Wing

)}
- {amentiesCount !== null && ( - <> -
-

- {amentiesCount - ? `${amentiesCount?.total} Amenties` - : `${ - complexName === "marasi-drive" - ? data[ - title.split(" ")[0] === "East" - ? "East" - : title.split(" ")[0] === "West" - ? "West" - : "others" - ].totalUnits - : data.others.totalUnits - } apartments`} -

- {!amentiesCount && ( -
- - - -

Virtual Tour

+
+

+ {amentiesCount !== null + ? `${amentiesCount?.total} Amenties` + : `${ + complexName === "marasi-drive" && data + ? data[ + title.split(" ")[0] === "East" + ? "East" + : title.split(" ")[0] === "West" + ? "West" + : "others" + ]?.totalUnits + : data?.others.totalUnits + } apartments`} +

+ {!amentiesCount && ( +
+ + + +

Virtual Tour

+
+ )} +
+ {((amentiesCount?.indoor && amentiesCount?.outdoor) || + !amentiesCount) && ( +
+ )} +
+ {!amentiesCount && data ? ( + Object.entries( + data[ + title.split(" ")[0] === "East" + ? "East" + : title.split(" ")[0] === "West" + ? "West" + : "others" + ].types + ).map(([unitType, count]) => ( +
+

+ {count} +

+

+ {formattedUnitTypes.get(unitType)} +

+
+ )) + ) : ( + <> + {amentiesCount?.indoor && ( +
+

+ {amentiesCount.indoor} +

+

+ Indoor Amenties +

)} -
-
-
- {!amentiesCount ? ( - Object.entries( - data[ - title.split(" ")[0] === "East" - ? "East" - : title.split(" ")[0] === "West" - ? "West" - : "others" - ].types - ).map(([unitType, count]) => ( -
-

- {count} -

-

- {formattedUnitTypes.get(unitType)} -

-
- )) - ) : ( - <> - {amentiesCount?.indoor && ( -
-

- {amentiesCount.indoor} -

-

- Indoor Amenties -

-
- )} - {amentiesCount?.outdoor && ( -
-

- {amentiesCount.outdoor} -

-

- Outdoor Amenties -

-
- )} - + {amentiesCount?.outdoor && ( +
+

+ {amentiesCount.outdoor} +

+

+ Outdoor Amenties +

+
)} -
- - )} + + )} +
-
+
+ podium
-
+
+ podiumSky 44 - Rooftop

-
+
+ podiumGround Level

-
+
+ podium
-
+
+ podiumRooftop

-
+
+ podium
-
+
+ sky-garden api .get( - `units/on-floor?project=${slugToComplexName( - complexName! - )}&floor=${selectedFloor?.split(" ").at(-1)}${ + `units/on-floor?project=${slugToComplexName(complexName!)}&floor=${ + selectedFloor?.split(" ").at(-1)?.split("-")[0] + }${ complexName === "marasi-drive" ? `&wing=${selectedFloor?.split(" ")[0]}` : "" @@ -103,7 +102,15 @@ function FloorsPage() {