Refactor version management: Replace useSaveVersion with useIsComparing across components
- Updated MainScene, SideBarLeft, SideBarRight, Simulations, and CompareLayOut to utilize isComparing state instead of isVersionSaved. - Adjusted conditional rendering and logic to reflect the new comparison state. - Introduced SyncCam component to synchronize camera state during comparisons. - Created useSceneStore to manage camera state with position and target vectors. - Cleaned up imports and ensured consistent formatting across affected files.
This commit is contained in:
@@ -8,7 +8,7 @@ import useModuleStore from "../../../store/ui/useModuleStore";
|
||||
import Widgets from "./visualization/widgets/Widgets";
|
||||
import Templates from "../../../modules/visualization/template/Templates";
|
||||
import Search from "../../ui/inputs/Search";
|
||||
import { useSaveVersion } from "../../../store/builder/store";
|
||||
import { useIsComparing } from "../../../store/builder/store";
|
||||
|
||||
const SideBarLeft: React.FC = () => {
|
||||
const [activeOption, setActiveOption] = useState("Widgets");
|
||||
@@ -16,7 +16,7 @@ const SideBarLeft: React.FC = () => {
|
||||
const { toggleUILeft } = useToggleStore();
|
||||
const { activeModule } = useModuleStore();
|
||||
|
||||
const { isVersionSaved } = useSaveVersion();
|
||||
const { isComparing } = useIsComparing();
|
||||
|
||||
// Reset activeOption whenever activeModule changes
|
||||
useEffect(() => {
|
||||
@@ -35,7 +35,7 @@ const SideBarLeft: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`sidebar-left-wrapper ${toggleUILeft && (!isVersionSaved || activeModule !== "simulation") ? "open" : "closed"
|
||||
className={`sidebar-left-wrapper ${toggleUILeft && (!isComparing || activeModule !== "simulation") ? "open" : "closed"
|
||||
}`}
|
||||
>
|
||||
<Header />
|
||||
@@ -74,7 +74,7 @@ const SideBarLeft: React.FC = () => {
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
{!isVersionSaved && (
|
||||
{!isComparing && (
|
||||
<>
|
||||
<ToggleHeader
|
||||
options={["Outline"]}
|
||||
|
||||
Reference in New Issue
Block a user