- {currentVilla &&
- currentVilla.perspectiveWorkings.map((image) => (
-
-

-
- ))}
+ <>
+
+
+ {currentVilla &&
+ currentVilla.perspectiveWorkings.map((image) => (
+
+

+
+ ))}
+
-
+ >
);
};
diff --git a/src/components/desktop/Appartment/LayoutModal.tsx b/src/components/desktop/Appartment/LayoutModal.tsx
index a0751a3..e6637a7 100644
--- a/src/components/desktop/Appartment/LayoutModal.tsx
+++ b/src/components/desktop/Appartment/LayoutModal.tsx
@@ -1,4 +1,5 @@
-import { useEffect, useState } from "react";
+import { useEffect, useState, useRef } from "react";
+import gsap from "gsap";
import useStore from "../../../store/store";
import UnitList from "../../UnitList";
import LayoutSlider from "../../mobile/Appartment/LayoutSlider";
@@ -11,6 +12,25 @@ const LayoutModal = () => {
const [currentUnits, setCurrentUnits] = useState(
currentVilla?.groundFloorUnits
);
+
+ const modalRef = useRef(null);
+
+ useEffect(() => {
+ if (!modalRef) return;
+ gsap.fromTo(
+ modalRef.current,
+ {
+ left: "100vw",
+ bottom: "100vh",
+ },
+ {
+ left: 0,
+ bottom: 0,
+ duration: 0.3,
+ }
+ );
+ }, []);
+
useEffect(() => {
if (currentVilla) {
switch (currentView) {
@@ -28,31 +48,59 @@ const LayoutModal = () => {
}, [currentView, currentVilla]);
const handleOnCloseClick = () => {
- setModal(null);
+ const onAnimationComplete = () => {
+ const timeout = setTimeout(() => {
+ setModal(null);
+ clearTimeout(timeout);
+ }, 200);
+ };
+
+ gsap.fromTo(
+ modalRef.current,
+ {
+ left: 0,
+ bottom: 0,
+ },
+ {
+ left: "100vw",
+ bottom: "100vh",
+ duration: 0.5,
+ onComplete: onAnimationComplete,
+ }
+ );
};
+
return (
-
-
+ //
+ <>
+
+
+
+ {currentUnits && }
+
+
+
+
+
+
+
+
-
-
- {currentUnits && }
-
-
-
-
-
-
-
+ {/*
+ <>> */}
+ >
);
};
diff --git a/src/pages/Desktop/DesktopApartmentPage.tsx b/src/pages/Desktop/DesktopApartmentPage.tsx
index 00e1b9a..9bf0aa4 100644
--- a/src/pages/Desktop/DesktopApartmentPage.tsx
+++ b/src/pages/Desktop/DesktopApartmentPage.tsx
@@ -2,7 +2,6 @@
import { Unity } from "react-unity-webgl";
import { useEffect, useState } from "react";
import { ReactUnityEventParameter } from "react-unity-webgl/distribution/types/react-unity-event-parameters";
-import { FullScreen, useFullScreenHandle } from "react-full-screen";
import useStore from "../../store/store";
import LoaderModal from "../../components/LoaderModal";
import ButtonPanel from "../../components/desktop/Appartment/ButtonPanel";
@@ -12,8 +11,13 @@ import ViewToggle from "../../components/ViewToggle";
import ParameterDescription from "../../components/desktop/Appartment/ParameterDescription";
const DesktopApartmentPage = () => {
- const { setCurrentView, setSendMessageToUnity, setLoader, setIs3DTour } =
- useStore();
+ const {
+ setCurrentView,
+ setSendMessageToUnity,
+ setLoader,
+ setIs3DTour,
+ onFullscreen,
+ } = useStore();
const { villa } = useVilla();
@@ -66,27 +70,19 @@ const DesktopApartmentPage = () => {
}
}, [isContainerLoaded]);
- const onFullscreenHandle = useFullScreenHandle();
-
return (
<>
-
-
-
-
-
-
-
-
+
>
);
};
diff --git a/src/store/store.ts b/src/store/store.ts
index 5de0fe1..575b444 100644
--- a/src/store/store.ts
+++ b/src/store/store.ts
@@ -2,9 +2,12 @@ import { create } from "zustand";
import { ReactUnityEventParameter } from "react-unity-webgl/distribution/types/react-unity-event-parameters";
import { Villa } from "../types/appartment";
import { VILLAS } from "../consts/villas";
+import { FullScreenHandle } from "react-full-screen";
interface StoreType {
currentVilla: Villa | null;
+ modalAnimation: number;
+ onFullscreen: FullScreenHandle | null;
selectedOnMapVilla: Villa | null;
loader: React.ReactNode | null;
panel: React.ReactNode | null;
@@ -19,6 +22,9 @@ interface StoreType {
currentView: number;
is3DTour: boolean;
+
+ setModalAnimation: (animation: number) => void;
+ setOnFullscreen: (onFullscreen: FullScreenHandle) => void;
setIs3DTour: (is3D: boolean) => void;
setCurrentVilla: (villa: Villa) => void;
setSelectedOnMapVilla: (villa: Villa | null) => void;
@@ -36,7 +42,8 @@ interface StoreType {
}
const useStore = create
((set) => ({
- // currentVilla: null,
+ modalAnimation: 0,
+ onFullscreen: null,
currentVilla: VILLAS[0],
is3DTour: false,
selectedOnMapVilla: null,
@@ -46,7 +53,8 @@ const useStore = create((set) => ({
loader: null,
currentView: 1,
-
+ setModalAnimation: (anim) => set(() => ({modalAnimation: anim})),
+ setOnFullscreen: (onFullscreen) => set(() => ({onFullscreen: onFullscreen})),
setIs3DTour: (is3DTour) => set(() => ({ is3DTour: is3DTour })),
setSelectedOnMapVilla: (villa) => set(() => ({ selectedOnMapVilla: villa })),
setCurrentVilla: (villa) => set(() => ({ currentVilla: villa })),