2025-04-29 07:20:14 +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";
|
2025-03-31 05:41:44 +00:00
|
|
|
import useModuleStore, { useThreeDStore } from "../store/useModuleStore";
|
2025-04-11 12:38:47 +00:00
|
|
|
import RealTimeVisulization from "../modules/visualization/RealTimeVisulization";
|
2025-03-25 06:17:41 +00:00
|
|
|
import Tools from "../components/ui/Tools";
|
2025-03-25 10:03:38 +00:00
|
|
|
import {
|
|
|
|
useSocketStore,
|
|
|
|
useFloorItems,
|
|
|
|
useOrganization,
|
|
|
|
useUserName,
|
|
|
|
useWallItems,
|
|
|
|
useZones,
|
2025-03-26 13:03:51 +00:00
|
|
|
useLoadingProgress,
|
2025-03-25 10:03:38 +00:00
|
|
|
} from "../store/store";
|
2025-03-25 08:30:03 +00:00
|
|
|
import { useNavigate } from "react-router-dom";
|
2025-03-27 09:44:29 +00:00
|
|
|
import { usePlayButtonStore } from "../store/usePlayButtonStore";
|
|
|
|
import MarketPlace from "../modules/market/MarketPlace";
|
2025-03-26 13:03:51 +00:00
|
|
|
import LoadingPage from "../components/templates/LoadingPage";
|
2025-03-27 05:25:44 +00:00
|
|
|
import SimulationPlayer from "../components/ui/simulation/simulationPlayer";
|
2025-04-09 12:13:44 +00:00
|
|
|
import KeyPressListener from "../utils/shortcutkeys/handleShortcutKeys";
|
2025-04-29 07:20:14 +00:00
|
|
|
import { useSelectedUserStore } from "../store/useCollabStore";
|
|
|
|
import FollowPerson from "../components/templates/FollowPerson";
|
2025-04-30 12:50:36 +00:00
|
|
|
import ProductionCapacity from "../components/ui/analysis/ProductionCapacity";
|
|
|
|
import ThroughputSummary from "../components/ui/analysis/ThroughputSummary";
|
|
|
|
import ROISummary from "../components/ui/analysis/ROISummary";
|
2025-03-25 06:17:41 +00:00
|
|
|
|
|
|
|
const Project: React.FC = () => {
|
2025-03-25 08:30:03 +00:00
|
|
|
let navigate = useNavigate();
|
2025-04-14 12:46:53 +00:00
|
|
|
const { activeModule, setActiveModule } = useModuleStore();
|
2025-04-09 12:13:44 +00:00
|
|
|
const { loadingProgress } = useLoadingProgress();
|
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-04-28 06:56:31 +00:00
|
|
|
setActiveModule("builder");
|
2025-03-25 10:03:38 +00:00
|
|
|
const email = localStorage.getItem("email");
|
2025-03-25 08:30:03 +00:00
|
|
|
if (email) {
|
2025-04-29 07:20:14 +00:00
|
|
|
const Organization = email.split("@")[1].split(".")[0];
|
2025-03-31 14:08:23 +00:00
|
|
|
useSocketStore.getState().initializeSocket(email, Organization);
|
2025-03-25 10:03:38 +00:00
|
|
|
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:03:38 +00:00
|
|
|
}, []);
|
2025-04-29 07:20:14 +00:00
|
|
|
|
2025-03-27 09:44:29 +00:00
|
|
|
const { isPlaying } = usePlayButtonStore();
|
2025-03-31 05:41:44 +00:00
|
|
|
const { toggleThreeD } = useThreeDStore();
|
2025-04-29 07:20:14 +00:00
|
|
|
const { selectedUser } = useSelectedUserStore();
|
2025-03-25 08:30:03 +00:00
|
|
|
|
2025-03-25 06:17:41 +00:00
|
|
|
return (
|
|
|
|
<div className="project-main">
|
2025-04-28 06:56:31 +00:00
|
|
|
{/* <div className="analysis">
|
2025-04-30 12:50:36 +00:00
|
|
|
<div className="analysis-wrapper">
|
|
|
|
<ProductionCapacity />
|
|
|
|
<ThroughputSummary />
|
|
|
|
</div>
|
2025-04-28 06:56:31 +00:00
|
|
|
<ROISummary />
|
|
|
|
</div> */}
|
2025-04-09 12:13:44 +00:00
|
|
|
<KeyPressListener />
|
2025-04-29 13:11:31 +00:00
|
|
|
{loadingProgress > 0 && <LoadingPage progress={loadingProgress} />}
|
2025-03-27 09:44:29 +00:00
|
|
|
{!isPlaying && (
|
|
|
|
<>
|
2025-03-31 05:41:44 +00:00
|
|
|
{toggleThreeD && <ModuleToggle />}
|
2025-03-27 09:44:29 +00:00
|
|
|
<SideBarLeft />
|
|
|
|
<SideBarRight />
|
|
|
|
</>
|
|
|
|
)}
|
2025-04-02 12:21:44 +00:00
|
|
|
{/* <RenderOverlay>
|
|
|
|
<MenuBar setOpenMenu={setOpenMenu} />
|
|
|
|
</RenderOverlay> */}
|
2025-03-27 09:44:29 +00:00
|
|
|
{activeModule === "market" && <MarketPlace />}
|
2025-03-26 05:48:23 +00:00
|
|
|
<RealTimeVisulization />
|
|
|
|
{activeModule !== "market" && <Tools />}
|
2025-03-27 05:25:44 +00:00
|
|
|
{isPlaying && activeModule === "simulation" && <SimulationPlayer />}
|
2025-04-30 12:50:36 +00:00
|
|
|
{/* {<SimulationPlayer />} */}
|
2025-04-29 07:20:14 +00:00
|
|
|
{selectedUser && <FollowPerson />}
|
2025-03-25 06:17:41 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Project;
|