refactor: Remove unnecessary setIsPlaying calls and clean up event handling in simulation components
This commit is contained in:
parent
e2ef19ca4e
commit
5f9d2b4106
|
@ -22,7 +22,6 @@ function ComparisonScene() {
|
|||
const product = products.find((product) => product.productName === option);
|
||||
if (product) {
|
||||
setComparisonProduct(product.productUuid, product.productName);
|
||||
setIsPlaying(true);
|
||||
setIsPaused(true);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -118,7 +118,6 @@ const CompareLayOut = () => {
|
|||
if (product) {
|
||||
setComparisonProduct(product.productUuid, product.productName);
|
||||
setLoadingProgress(1);
|
||||
setIsPlaying(true);
|
||||
setIsPaused(true);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -59,6 +59,9 @@ const SimulationPlayer: React.FC = () => {
|
|||
};
|
||||
const handlePlayStop = () => {
|
||||
setIsPaused(!isPaused);
|
||||
if (isPaused) {
|
||||
setIsPlaying(true);
|
||||
}
|
||||
echo.warn(`Simulation is ${isPaused ? "Resumed" : "Paused"}`);
|
||||
};
|
||||
const handleExit = () => {
|
||||
|
|
|
@ -15,6 +15,7 @@ function Simulator() {
|
|||
|
||||
useEffect(() => {
|
||||
if (!isPlaying || isReset || !selectedProduct.productUuid) return;
|
||||
console.log('selectedProduct: ', selectedProduct);
|
||||
|
||||
const product = getProductById(selectedProduct.productUuid);
|
||||
if (!product) return;
|
||||
|
|
|
@ -8,11 +8,20 @@ import DashboardTrash from "../components/Dashboard/DashboardTrash";
|
|||
import { getUserData } from "../components/Dashboard/functions/getUserData";
|
||||
import SidePannel from "../components/Dashboard/SidePannel";
|
||||
import DashboardTutorial from "../components/Dashboard/DashboardTutorial";
|
||||
import { useProductStore } from "../store/simulation/useProductStore";
|
||||
import { useEventsStore } from "../store/simulation/useEventsStore";
|
||||
|
||||
const Dashboard: React.FC = () => {
|
||||
const [activeTab, setActiveTab] = useState<string>("Home");
|
||||
const { socket } = useSocketStore();
|
||||
const { userId, organization, email, userName } = getUserData();
|
||||
const { clearProducts } = useProductStore();
|
||||
const { clearEvents } = useEventsStore();
|
||||
|
||||
useEffect(() => {
|
||||
clearEvents();
|
||||
clearProducts();
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const token = localStorage.getItem("token");
|
||||
|
|
|
@ -34,7 +34,6 @@ import { setFloorItemApi } from "../services/factoryBuilder/assest/floorAsset/se
|
|||
import { useAssetsStore } from "../store/builder/useAssetStore";
|
||||
import ComparisonSceneProvider from "../components/layout/scenes/ComparisonSceneProvider";
|
||||
import MainSceneProvider from "../components/layout/scenes/MainSceneProvider";
|
||||
import { useEventsStore } from "../store/simulation/useEventsStore";
|
||||
|
||||
const Project: React.FC = () => {
|
||||
let navigate = useNavigate();
|
||||
|
@ -47,8 +46,7 @@ const Project: React.FC = () => {
|
|||
const { setWallItems } = useWallItems();
|
||||
const { setZones } = useZones();
|
||||
const { isVersionSaved } = useSaveVersion();
|
||||
const { setProducts, clearProducts } = useProductStore();
|
||||
const { clearEvents } = useEventsStore();
|
||||
const { setProducts } = useProductStore();
|
||||
const { projectId } = useParams();
|
||||
const { setProjectName } = useProjectName();
|
||||
|
||||
|
@ -107,8 +105,6 @@ const Project: React.FC = () => {
|
|||
setWallItems([]);
|
||||
setZones([]);
|
||||
setProducts([]);
|
||||
clearProducts();
|
||||
clearEvents();
|
||||
setActiveModule("builder");
|
||||
const email = localStorage.getItem("email");
|
||||
if (email) {
|
||||
|
|
Loading…
Reference in New Issue