2025-05-08 08:12:42 +00:00
|
|
|
import React from "react";
|
2025-03-25 06:17:41 +00:00
|
|
|
import useModuleStore from "../../store/useModuleStore";
|
|
|
|
import {
|
|
|
|
BuilderIcon,
|
|
|
|
CartIcon,
|
|
|
|
SimulationIcon,
|
|
|
|
VisualizationIcon,
|
|
|
|
} from "../icons/ExportModuleIcons";
|
2025-03-26 05:48:23 +00:00
|
|
|
import useToggleStore from "../../store/useUIToggleStore";
|
2025-05-13 12:23:00 +00:00
|
|
|
import useVersionHistoryStore from "../../store/builder/store";
|
2025-03-25 06:17:41 +00:00
|
|
|
|
|
|
|
const ModuleToggle: React.FC = () => {
|
|
|
|
const { activeModule, setActiveModule } = useModuleStore();
|
2025-03-26 05:48:23 +00:00
|
|
|
const { setToggleUI } = useToggleStore();
|
2025-05-12 12:31:45 +00:00
|
|
|
const { setVersionHistory } = useVersionHistoryStore();
|
2025-03-25 06:17:41 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="module-toggle-container">
|
2025-05-08 08:12:42 +00:00
|
|
|
<button
|
2025-05-14 13:09:47 +00:00
|
|
|
id={"builder"}
|
2025-05-08 08:12:42 +00:00
|
|
|
className={`module-list ${activeModule === "builder" ? "active" : ""}`}
|
2025-03-26 05:48:23 +00:00
|
|
|
onClick={() => {
|
|
|
|
setActiveModule("builder");
|
2025-05-12 12:31:45 +00:00
|
|
|
setVersionHistory(false);
|
2025-05-08 08:12:42 +00:00
|
|
|
setToggleUI(
|
2025-05-13 05:02:24 +00:00
|
|
|
localStorage.getItem("navBarUiLeft")
|
|
|
|
? localStorage.getItem("navBarUiLeft") === "true"
|
|
|
|
: true,
|
|
|
|
localStorage.getItem("navBarUiRight")
|
|
|
|
? localStorage.getItem("navBarUiRight") === "true"
|
2025-05-08 08:12:42 +00:00
|
|
|
: true
|
|
|
|
);
|
2025-03-26 05:48:23 +00:00
|
|
|
}}
|
2025-03-25 06:17:41 +00:00
|
|
|
>
|
|
|
|
<div className="icon">
|
|
|
|
<BuilderIcon isActive={activeModule === "builder"} />
|
|
|
|
</div>
|
|
|
|
<div className="module">Builder</div>
|
2025-05-08 08:12:42 +00:00
|
|
|
</button>
|
|
|
|
<button
|
2025-05-14 13:09:47 +00:00
|
|
|
id={"simulation"}
|
2025-05-08 08:12:42 +00:00
|
|
|
className={`module-list ${
|
|
|
|
activeModule === "simulation" ? "active" : ""
|
|
|
|
}`}
|
2025-03-26 05:48:23 +00:00
|
|
|
onClick={() => {
|
|
|
|
setActiveModule("simulation");
|
2025-05-12 12:31:45 +00:00
|
|
|
setVersionHistory(false);
|
2025-05-08 08:12:42 +00:00
|
|
|
setToggleUI(
|
2025-05-13 05:02:24 +00:00
|
|
|
localStorage.getItem("navBarUiLeft")
|
|
|
|
? localStorage.getItem("navBarUiLeft") === "true"
|
|
|
|
: true,
|
|
|
|
localStorage.getItem("navBarUiRight")
|
|
|
|
? localStorage.getItem("navBarUiRight") === "true"
|
2025-05-08 08:12:42 +00:00
|
|
|
: true
|
|
|
|
);
|
2025-03-26 05:48:23 +00:00
|
|
|
}}
|
2025-03-25 06:17:41 +00:00
|
|
|
>
|
|
|
|
<div className="icon">
|
|
|
|
<SimulationIcon isActive={activeModule === "simulation"} />
|
|
|
|
</div>
|
|
|
|
<div className="module">Simulation</div>
|
2025-05-08 08:12:42 +00:00
|
|
|
</button>
|
|
|
|
<button
|
2025-05-14 13:09:47 +00:00
|
|
|
id={"visualization"}
|
2025-05-08 08:12:42 +00:00
|
|
|
className={`module-list ${
|
|
|
|
activeModule === "visualization" ? "active" : ""
|
|
|
|
}`}
|
2025-03-26 05:48:23 +00:00
|
|
|
onClick={() => {
|
|
|
|
setActiveModule("visualization");
|
2025-05-12 12:31:45 +00:00
|
|
|
setVersionHistory(false);
|
2025-05-08 08:12:42 +00:00
|
|
|
setToggleUI(
|
2025-05-13 05:02:24 +00:00
|
|
|
localStorage.getItem("navBarUiLeft")
|
|
|
|
? localStorage.getItem("navBarUiLeft") === "true"
|
|
|
|
: true,
|
|
|
|
localStorage.getItem("navBarUiRight")
|
|
|
|
? localStorage.getItem("navBarUiRight") === "true"
|
2025-05-08 08:12:42 +00:00
|
|
|
: true
|
|
|
|
);
|
2025-03-26 05:48:23 +00:00
|
|
|
}}
|
2025-03-25 06:17:41 +00:00
|
|
|
>
|
|
|
|
<div className="icon">
|
|
|
|
<VisualizationIcon isActive={activeModule === "visualization"} />
|
|
|
|
</div>
|
|
|
|
<div className="module">Visualization</div>
|
2025-05-08 08:12:42 +00:00
|
|
|
</button>
|
|
|
|
<button
|
2025-05-14 13:09:47 +00:00
|
|
|
id={"market"}
|
2025-05-08 08:12:42 +00:00
|
|
|
className={`module-list ${activeModule === "market" ? "active" : ""}`}
|
2025-03-26 05:48:23 +00:00
|
|
|
onClick={() => {
|
|
|
|
setActiveModule("market");
|
2025-05-12 12:31:45 +00:00
|
|
|
setVersionHistory(false);
|
2025-05-13 05:02:24 +00:00
|
|
|
setToggleUI(false, false);
|
2025-03-26 05:48:23 +00:00
|
|
|
}}
|
2025-03-25 06:17:41 +00:00
|
|
|
>
|
|
|
|
<div className="icon">
|
|
|
|
<CartIcon isActive={activeModule === "market"} />
|
|
|
|
</div>
|
|
|
|
<div className="module">Market Place</div>
|
2025-05-08 08:12:42 +00:00
|
|
|
</button>
|
2025-03-25 06:17:41 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ModuleToggle;
|