2025-03-25 08:30:03 +00:00
|
|
|
import React, { useEffect } from "react";
|
2025-03-25 06:17:41 +00:00
|
|
|
import ModuleToggle from "../components/ui/ModuleToggle";
|
|
|
|
import SideBarLeft from "../components/layout/sidebarLeft/SideBarLeft";
|
|
|
|
import SideBarRight from "../components/layout/sidebarRight/SideBarRight";
|
|
|
|
import useModuleStore from "../store/useModuleStore";
|
|
|
|
import RealTimeVisulization from "../components/ui/componets/RealTimeVisulization";
|
|
|
|
import Tools from "../components/ui/Tools";
|
2025-03-25 08:30:03 +00:00
|
|
|
import Scene from "../modules/scene/scene";
|
2025-03-25 10:25:48 +00:00
|
|
|
import {
|
|
|
|
useSocketStore,
|
|
|
|
useFloorItems,
|
|
|
|
useOrganization,
|
|
|
|
useUserName,
|
|
|
|
useWallItems,
|
|
|
|
useZones,
|
|
|
|
} from "../store/store";
|
2025-03-25 08:30:03 +00:00
|
|
|
import { useNavigate } from "react-router-dom";
|
2025-03-25 10:25:48 +00:00
|
|
|
import { usePlayButtonStore } from "../store/usePlayButtonStore";
|
2025-03-25 11:05:54 +00:00
|
|
|
import SimulationUI from "../modules/simulation/simulationUI";
|
2025-03-26 06:00:17 +00:00
|
|
|
import MarketPlace from "../modules/market/MarketPlace";
|
2025-03-25 06:17:41 +00:00
|
|
|
|
|
|
|
const Project: React.FC = () => {
|
2025-03-25 08:30:03 +00:00
|
|
|
let navigate = useNavigate();
|
2025-03-25 06:17:41 +00:00
|
|
|
const { activeModule } = useModuleStore();
|
|
|
|
|
2025-03-26 05:48:23 +00:00
|
|
|
const { setUserName } = useUserName();
|
|
|
|
const { setOrganization } = useOrganization();
|
2025-03-25 08:30:03 +00:00
|
|
|
const { setFloorItems } = useFloorItems();
|
|
|
|
const { setWallItems } = useWallItems();
|
|
|
|
const { setZones } = useZones();
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
setFloorItems([]);
|
|
|
|
setWallItems([]);
|
|
|
|
setZones([]);
|
2025-03-25 10:25:48 +00:00
|
|
|
const email = localStorage.getItem("email");
|
2025-03-25 08:30:03 +00:00
|
|
|
if (email) {
|
|
|
|
useSocketStore.getState().initializeSocket(email);
|
2025-03-25 10:25:48 +00:00
|
|
|
const Organization = email!.split("@")[1].split(".")[0];
|
|
|
|
const name = localStorage.getItem("userName");
|
2025-03-25 08:30:03 +00:00
|
|
|
if (Organization && name) {
|
|
|
|
setOrganization(Organization);
|
|
|
|
setUserName(name);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
navigate("/");
|
|
|
|
}
|
2025-03-25 10:25:48 +00:00
|
|
|
}, []);
|
|
|
|
const { isPlaying } = usePlayButtonStore();
|
2025-03-25 08:30:03 +00:00
|
|
|
|
2025-03-25 06:17:41 +00:00
|
|
|
return (
|
|
|
|
<div className="project-main">
|
2025-03-26 07:02:09 +00:00
|
|
|
{!isPlaying && (
|
|
|
|
<>
|
|
|
|
<ModuleToggle />
|
|
|
|
<SideBarLeft />
|
|
|
|
<SideBarRight />
|
|
|
|
</>
|
|
|
|
)}
|
2025-03-26 06:00:17 +00:00
|
|
|
{activeModule === "market" && <MarketPlace />}
|
2025-03-26 05:48:23 +00:00
|
|
|
<RealTimeVisulization />
|
|
|
|
{activeModule !== "market" && <Tools />}
|
2025-03-25 12:04:20 +00:00
|
|
|
{/* <SimulationUI /> */}
|
2025-03-25 06:17:41 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Project;
|