From 0ac2bde6d3f603242fe077d674f3ef71ce24867a Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Tue, 2 Sep 2025 09:16:41 +0530 Subject: [PATCH] code optimization --- .../scene/postProcessing/postProcessing.tsx | 11 +++-- app/src/pages/Dashboard.tsx | 44 +++++++++---------- app/src/store/builder/store.ts | 1 - 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/src/modules/scene/postProcessing/postProcessing.tsx b/app/src/modules/scene/postProcessing/postProcessing.tsx index 6f6cde8..0f307de 100644 --- a/app/src/modules/scene/postProcessing/postProcessing.tsx +++ b/app/src/modules/scene/postProcessing/postProcessing.tsx @@ -1,10 +1,15 @@ -import { DepthOfField, Bloom, EffectComposer, N8AO } from "@react-three/postprocessing"; +import { EffectComposer, N8AO } from "@react-three/postprocessing"; import OutlineInstances from "./outlineInstances/outlineInstances"; import { useDeletableEventSphere, useSelectedEventSphere } from "../../../store/simulation/useSimulationStore"; +import { useEffect } from "react"; export default function PostProcessing() { - const { } = useSelectedEventSphere(); - const { } = useDeletableEventSphere(); + const { selectedEventSphere } = useSelectedEventSphere(); + const { deletableEventSphere } = useDeletableEventSphere(); + + useEffect(() => { + + }, [selectedEventSphere, deletableEventSphere]) return ( diff --git a/app/src/pages/Dashboard.tsx b/app/src/pages/Dashboard.tsx index 606765c..c464be5 100644 --- a/app/src/pages/Dashboard.tsx +++ b/app/src/pages/Dashboard.tsx @@ -1,7 +1,5 @@ import React, { useEffect, useState } from "react"; -import { - useSocketStore -} from "../store/builder/store"; +import { useSocketStore } from "../store/builder/store"; import DashboardHome from "../components/Dashboard/DashboardHome"; import DashboardProjects from "../components/Dashboard/DashboardProjects"; import DashboardTrash from "../components/Dashboard/DashboardTrash"; @@ -10,29 +8,27 @@ import SidePannel from "../components/Dashboard/SidePannel"; import DashboardTutorial from "../components/Dashboard/DashboardTutorial"; const Dashboard: React.FC = () => { - const [activeTab, setActiveTab] = useState("Home"); - const { socket } = useSocketStore(); - const { organization, email } = getUserData(); + const [activeTab, setActiveTab] = useState("Home"); + const { socket } = useSocketStore(); + const { organization, email } = getUserData(); - useEffect(() => { - const token = localStorage.getItem("token"); - const refreshToken = localStorage.getItem("refreshToken") - if (token) { - useSocketStore.getState().initializeSocket(email, organization, token, refreshToken); - } else { + useEffect(() => { + const token = localStorage.getItem("token"); + const refreshToken = localStorage.getItem("refreshToken") + if (token) { + useSocketStore.getState().initializeSocket(email, organization, token, refreshToken); + } + }, [socket, email, organization]); - } - }, [socket]); - - return ( -
- - {activeTab == "Home" && } - {activeTab == "Projects" && } - {activeTab == "Trash" && } - {activeTab == "Tutorials" && } -
- ); + return ( +
+ + {activeTab === "Home" && } + {activeTab === "Projects" && } + {activeTab === "Trash" && } + {activeTab === "Tutorials" && } +
+ ); }; export default Dashboard; diff --git a/app/src/store/builder/store.ts b/app/src/store/builder/store.ts index d35ae36..c2c9648 100644 --- a/app/src/store/builder/store.ts +++ b/app/src/store/builder/store.ts @@ -1,4 +1,3 @@ -import { Object3D } from "three"; import { create } from "zustand"; import { io } from "socket.io-client"; import * as CONSTANTS from "../../types/world/worldConstants";