diff --git a/app/src/components/Dashboard/DashboardCard.tsx b/app/src/components/Dashboard/DashboardCard.tsx index c15765e..5a6a00f 100644 --- a/app/src/components/Dashboard/DashboardCard.tsx +++ b/app/src/components/Dashboard/DashboardCard.tsx @@ -3,11 +3,7 @@ import { createPortal } from "react-dom"; import { useNavigate } from "react-router-dom"; import img from "../../assets/image/image.png"; import { getUserData } from "../../functions/getUserData"; -import { - useLoadingProgress, - useProjectName, - useSocketStore, -} from "../../store/builder/store"; +import { useLoadingProgress, useProjectName, useSocketStore } from "../../store/builder/store"; import OuterClick from "../../utils/outerClick"; import { KebabIcon } from "../icons/ExportCommonIcons"; import { getAllProjects } from "../../services/dashboard/getAllProjects"; @@ -15,323 +11,275 @@ import { getAllProjects } from "../../services/dashboard/getAllProjects"; // import { updateProject } from "../../services/dashboard/updateProject"; interface DashBoardCardProps { - projectName: string; - thumbnail: string; - projectId: string; - createdAt?: string; - isViewed?: string; - createdBy?: { _id: string; userName: string }; - handleDeleteProject?: (projectId: string) => Promise; - handleTrashDeleteProject?: (projectId: string) => Promise; - handleRestoreProject?: (projectId: string) => Promise; - handleDuplicateWorkspaceProject?: ( - projectId: string, - projectName: string, - thumbnail: string, - userId?: string - ) => Promise; - handleDuplicateRecentProject?: ( - projectId: string, - projectName: string, - thumbnail: string - ) => Promise; - active?: "shared" | "trash" | "recent" | string; - setIsSearchActive?: React.Dispatch>; - setRecentDuplicateData?: React.Dispatch>; - setProjectDuplicateData?: React.Dispatch>; - setActiveFolder?: React.Dispatch>; - openKebabProjectId: string | null; - setOpenKebabProjectId: React.Dispatch>; + projectName: string; + thumbnail: string; + projectId: string; + createdAt?: string; + isViewed?: string; + createdBy?: { _id: string; userName: string }; + handleDeleteProject?: (projectId: string) => Promise; + handleTrashDeleteProject?: (projectId: string) => Promise; + handleRestoreProject?: (projectId: string) => Promise; + handleDuplicateWorkspaceProject?: (projectId: string, projectName: string, thumbnail: string, userId?: string) => Promise; + handleDuplicateRecentProject?: (projectId: string, projectName: string, thumbnail: string) => Promise; + active?: "shared" | "trash" | "recent" | string; + setIsSearchActive?: React.Dispatch>; + setRecentDuplicateData?: React.Dispatch>; + setProjectDuplicateData?: React.Dispatch>; + setActiveFolder?: React.Dispatch>; + openKebabProjectId: string | null; + setOpenKebabProjectId: React.Dispatch>; } -type RelativeTimeFormatUnit = - | "year" - | "month" - | "week" - | "day" - | "hour" - | "minute" - | "second"; +type RelativeTimeFormatUnit = "year" | "month" | "week" | "day" | "hour" | "minute" | "second"; const kebabOptionsMap: Record = { - default: ["rename", "delete", "duplicate", "open in new tab"], - trash: ["restore", "delete"], - shared: ["duplicate", "open in new tab"], + default: ["rename", "delete", "duplicate", "open in new tab"], + trash: ["restore", "delete"], + shared: ["duplicate", "open in new tab"], }; const DashboardCard: React.FC = ({ - projectName, - thumbnail, - projectId, - active, - handleDeleteProject, - handleRestoreProject, - handleTrashDeleteProject, - handleDuplicateWorkspaceProject, - handleDuplicateRecentProject, - createdAt, - createdBy, - setRecentDuplicateData, - setProjectDuplicateData, - setActiveFolder, - openKebabProjectId, - setOpenKebabProjectId, -}) => { - const navigate = useNavigate(); - const { setProjectName } = useProjectName(); - const { userId, organization, userName } = getUserData(); - const { projectSocket } = useSocketStore(); - const { setLoadingProgress } = useLoadingProgress(); - - const isKebabOpen = openKebabProjectId === projectId; - const [renameValue, setRenameValue] = useState(projectName); - const [isRenaming, setIsRenaming] = useState(false); - const kebabRef = useRef(null); - - // Close kebab when clicking outside - OuterClick({ - contextClassName: [`tag-${projectId}`], - setMenuVisible: () => { - if (isKebabOpen) setOpenKebabProjectId(null); - }, - }); - - const navigateToProject = useCallback(() => { - if (active === "trash") return; - setLoadingProgress(1); - setProjectName(projectName); - navigate(`/projects/${projectId}`); - }, [ - active, - projectId, projectName, - navigate, - setLoadingProgress, - setProjectName, - ]); + thumbnail, + projectId, + active, + handleDeleteProject, + handleRestoreProject, + handleTrashDeleteProject, + handleDuplicateWorkspaceProject, + handleDuplicateRecentProject, + createdAt, + createdBy, + setRecentDuplicateData, + setProjectDuplicateData, + setActiveFolder, + openKebabProjectId, + setOpenKebabProjectId, +}) => { + const navigate = useNavigate(); + const { setProjectName } = useProjectName(); + const { userId, organization, userName } = getUserData(); + const { projectSocket } = useSocketStore(); + const { setLoadingProgress } = useLoadingProgress(); - const getOptions = useCallback(() => { - if (active === "trash") return kebabOptionsMap.trash; - if (active === "shared" || (createdBy && createdBy._id !== userId)) { - return kebabOptionsMap.shared; - } - return kebabOptionsMap.default; - }, [active, createdBy, userId]); + const isKebabOpen = openKebabProjectId === projectId; + const [renameValue, setRenameValue] = useState(projectName); + const [isRenaming, setIsRenaming] = useState(false); + const kebabRef = useRef(null); - const handleProjectName = useCallback( - async (newName: string) => { - setRenameValue(newName); - if (!projectId) return; + // Close kebab when clicking outside + OuterClick({ + contextClassName: [`tag-${projectId}`], + setMenuVisible: () => { + if (isKebabOpen) setOpenKebabProjectId(null); + }, + }); - try { - const projects = await getAllProjects(userId, organization); - const projectUuid = projects?.Projects?.find( - (val: any) => val.projectUuid === projectId || val._id === projectId - ); - if (!projectUuid) return; + const navigateToProject = useCallback(() => { + if (active === "trash") return; + setLoadingProgress(1); + setProjectName(projectName); + navigate(`/projects/${projectId}`); + }, [active, projectId, projectName, navigate, setLoadingProgress, setProjectName]); - const updatePayload = { - projectId: projectUuid._id, - organization, - userId, - projectName: newName, + const getOptions = useCallback(() => { + if (active === "trash") return kebabOptionsMap.trash; + if (active === "shared" || (createdBy && createdBy._id !== userId)) { + return kebabOptionsMap.shared; + } + return kebabOptionsMap.default; + }, [active, createdBy, userId]); + + const handleProjectName = useCallback( + async (newName: string) => { + setRenameValue(newName); + if (!projectId) return; + + try { + const projects = await getAllProjects(userId, organization); + const projectUuid = projects?.Projects?.find((val: any) => val.projectUuid === projectId || val._id === projectId); + if (!projectUuid) return; + + const updatePayload = { + projectId: projectUuid._id, + organization, + userId, + projectName: newName, + }; + + if (projectSocket) { + projectSocket.emit("v1:project:update", updatePayload); + } + } catch { + // silent fail + } + }, + [projectId, userId, organization, projectSocket] + ); + + const handleOptionClick = useCallback( + async (option: string) => { + switch (option) { + case "delete": + await (active === "trash" ? handleTrashDeleteProject?.(projectId) : handleDeleteProject?.(projectId)); + break; + case "restore": + await handleRestoreProject?.(projectId); + break; + case "open in new tab": + setProjectName(projectName); + window.open(`/projects/${projectId}`, "_blank"); + break; + case "rename": + setIsRenaming(true); + break; + case "duplicate": + if (handleDuplicateWorkspaceProject) { + setProjectDuplicateData?.({ projectId, projectName, thumbnail }); + await handleDuplicateWorkspaceProject(projectId, projectName, thumbnail, userId); + if (active === "shared") { + setActiveFolder?.("myProjects"); + } + } else if (handleDuplicateRecentProject) { + setRecentDuplicateData?.({ + projectId, + projectName, + thumbnail, + userId, + }); + await handleDuplicateRecentProject(projectId, projectName, thumbnail); + } + break; + } + }, + [ + projectId, + projectName, + thumbnail, + userId, + active, + handleDeleteProject, + handleTrashDeleteProject, + handleRestoreProject, + handleDuplicateWorkspaceProject, + handleDuplicateRecentProject, + setProjectName, + setProjectDuplicateData, + setRecentDuplicateData, + setActiveFolder, + ] + ); + + const getRelativeTime = useCallback((dateString: string): string => { + const date = new Date(dateString); + const now = new Date(); + const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000); + + const intervals: Record = { + year: 31536000, + month: 2592000, + week: 604800, + day: 86400, + hour: 3600, + minute: 60, + second: 1, }; - if (projectSocket) { - projectSocket.emit("v1:project:update", updatePayload); + const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" }); + for (const [unit, seconds] of Object.entries(intervals)) { + const diff = Math.floor(diffInSeconds / seconds); + if (diff >= 1) return rtf.format(-diff, unit as RelativeTimeFormatUnit); } - } catch { - // silent fail - } - }, - [projectId, userId, organization, projectSocket] - ); + return "just now"; + }, []); - const handleOptionClick = useCallback( - async (option: string) => { - switch (option) { - case "delete": - await (handleDeleteProject?.(projectId) ?? - handleTrashDeleteProject?.(projectId)); - break; - case "restore": - await handleRestoreProject?.(projectId); - break; - case "open in new tab": - setProjectName(projectName); - window.open(`/projects/${projectId}`, "_blank"); - break; - case "rename": - setIsRenaming(true); - break; - case "duplicate": - if (handleDuplicateWorkspaceProject) { - setProjectDuplicateData?.({ projectId, projectName, thumbnail }); - await handleDuplicateWorkspaceProject( - projectId, - projectName, - thumbnail, - userId - ); - if (active === "shared") { - setActiveFolder?.("myProjects"); - } - } else if (handleDuplicateRecentProject) { - setRecentDuplicateData?.({ - projectId, - projectName, - thumbnail, - userId, + const [kebabPosition, setKebabPosition] = useState({ top: 0, left: 0 }); + + useEffect(() => { + if (isKebabOpen && kebabRef.current) { + const rect = kebabRef.current.getBoundingClientRect(); + setKebabPosition({ + top: rect.bottom + window.scrollY, + left: rect.left + window.scrollX - 80, }); - await handleDuplicateRecentProject( - projectId, - projectName, - thumbnail - ); - } - break; - } - }, - [ - projectId, - projectName, - thumbnail, - userId, - active, - handleDeleteProject, - handleTrashDeleteProject, - handleRestoreProject, - handleDuplicateWorkspaceProject, - handleDuplicateRecentProject, - setProjectName, - setProjectDuplicateData, - setRecentDuplicateData, - setActiveFolder, - ] - ); + } + }, [isKebabOpen]); - const getRelativeTime = useCallback((dateString: string): string => { - const date = new Date(dateString); - const now = new Date(); - const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000); + return ( +
+
+
+ {`${projectName} +
- const intervals: Record = { - year: 31536000, - month: 2592000, - week: 604800, - day: 86400, - hour: 3600, - minute: 60, - second: 1, - }; +
e.stopPropagation()}> +
+ {isRenaming ? ( + handleProjectName(e.target.value)} + onBlur={() => { + setIsRenaming(false); + setProjectName(renameValue); + }} + onKeyDown={(e) => { + if (e.key === "Enter") { + setIsRenaming(false); + setProjectName(renameValue); + } + }} + aria-label="Rename project" + autoFocus + /> + ) : ( + {renameValue} + )} + {createdAt && ( +
+ {active === "trash" ? "Trashed" : "Edited"} {getRelativeTime(createdAt)} +
+ )} +
- const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" }); - for (const [unit, seconds] of Object.entries(intervals)) { - const diff = Math.floor(diffInSeconds / seconds); - if (diff >= 1) return rtf.format(-diff, unit as RelativeTimeFormatUnit); - } - return "just now"; - }, []); - - const [kebabPosition, setKebabPosition] = useState({ top: 0, left: 0 }); - - useEffect(() => { - if (isKebabOpen && kebabRef.current) { - const rect = kebabRef.current.getBoundingClientRect(); - setKebabPosition({ - top: rect.bottom + window.scrollY, - left: rect.left + window.scrollX - 80, - }); - } - }, [isKebabOpen]); - - return ( -
-
-
- {`${projectName} -
- -
e.stopPropagation()} - > -
- {isRenaming ? ( - handleProjectName(e.target.value)} - onBlur={() => { - setIsRenaming(false); - setProjectName(renameValue); - }} - onKeyDown={(e) => { - if (e.key === "Enter") { - setIsRenaming(false); - setProjectName(renameValue); - } - }} - aria-label="Rename project" - autoFocus - /> - ) : ( - {renameValue} - )} - {createdAt && ( -
- {active === "trash" ? "Trashed" : "Edited"}{" "} - {getRelativeTime(createdAt)} -
- )} -
- -
-
- {(createdBy?.userName || userName || "A").charAt(0).toUpperCase()} +
+
{(createdBy?.userName || userName || "A").charAt(0).toUpperCase()}
+ +
+
- -
-
-
- {isKebabOpen && - createPortal( -
- {getOptions().map((option) => ( - - ))} -
, - document.body - )} -
- ); + {isKebabOpen && + createPortal( +
+ {getOptions().map((option) => ( + + ))} +
, + document.body + )} +
+ ); }; export default DashboardCard; diff --git a/app/src/components/Dashboard/SidePannel.tsx b/app/src/components/Dashboard/SidePannel.tsx index f384d99..50dda20 100644 --- a/app/src/components/Dashboard/SidePannel.tsx +++ b/app/src/components/Dashboard/SidePannel.tsx @@ -1,13 +1,5 @@ import React from "react"; -import { - DocumentationIcon, - HelpIcon, - HomeIcon, - LogoutIcon, - NotificationIcon, - ProjectsIcon, - TutorialsIcon, -} from "../icons/DashboardIcon"; +import { DocumentationIcon, HelpIcon, HomeIcon, LogoutIcon, NotificationIcon, ProjectsIcon, TutorialsIcon } from "../icons/DashboardIcon"; import { useNavigate } from "react-router-dom"; import darkThemeImage from "../../assets/image/darkThemeProject.png"; import lightThemeImage from "../../assets/image/lightThemeProject.png"; @@ -54,7 +46,6 @@ const SidePannel: React.FC = ({ setActiveTab, activeTab }) => { projectUuid: projectId, }; - console.log('addProject: ', addProject); projectSocket.emit("v1:project:add", addProject); } else { // API @@ -72,11 +63,7 @@ const SidePannel: React.FC = ({ setActiveTab, activeTab }) => {
{userName?.charAt(0).toUpperCase()}
-
- {userName - ? userName.charAt(0).toUpperCase() + userName.slice(1).toLowerCase() - : "Anonymous"} -
+
{userName ? userName.charAt(0).toUpperCase() + userName.slice(1).toLowerCase() : "Anonymous"}
@@ -87,26 +74,15 @@ const SidePannel: React.FC = ({ setActiveTab, activeTab }) => {
- - - @@ -123,9 +99,7 @@ const SidePannel: React.FC = ({ setActiveTab, activeTab }) => { Tutorials +
+ +
{ + setVersionHistoryVisible(true); + setSubModule("properties"); + setActiveModule("builder"); + }} + > + {selectedVersion?.version ?? "v 0.0.0"} +
+ +
+
+ +
+
+ +
+
{isOnline ? "Online" : "Offline"}
+
+
- ))} + + {/* Shortcut Helper */} + {!isPlaying && showShortcuts && ( +
+ +
+ )}
- - {/* Logs and Version */} -
-
-
- -
- -
- -
{ - setVersionHistoryVisible(true); - setSubModule("properties"); - setActiveModule("builder"); - }} - > - {selectedVersion?.version ?? "v 0.0.0"} -
- -
-
- -
-
- -
-
{isOnline ? "Online" : "Offline"}
-
-
-
- - {/* Shortcut Helper */} - {!isPlaying && showShortcuts && ( -
- -
- )} -
- ); + ); }; export default Footer; diff --git a/app/src/components/layout/sidebarRight/SideBarRight.tsx b/app/src/components/layout/sidebarRight/SideBarRight.tsx index ef9f1a2..66dd729 100644 --- a/app/src/components/layout/sidebarRight/SideBarRight.tsx +++ b/app/src/components/layout/sidebarRight/SideBarRight.tsx @@ -1,13 +1,13 @@ import React, { useEffect, useState } from "react"; import Header from "./Header"; import useModuleStore, { useSubModuleStore } from "../../../store/ui/useModuleStore"; -import { AnalysisIcon, FilePackageIcon, MechanicsIcon, PropertiesIcon, SimulationIcon, } from "../../icons/SimulationIcons"; +import { AnalysisIcon, FilePackageIcon, MechanicsIcon, PropertiesIcon, SimulationIcon } from "../../icons/SimulationIcons"; import { useToggleStore } from "../../../store/ui/useUIToggleStore"; import Visualization from "./visualization/Visualization"; import Analysis from "./analysis/Analysis"; import Simulations from "./simulation/Simulations"; -import useVersionHistoryVisibleStore, { useIsComparing, useToolMode } from "../../../store/builder/store"; -import { useSelectedEventData, useSelectedEventSphere, } from "../../../store/simulation/useSimulationStore"; +import { useIsComparing, useToolMode } from "../../../store/builder/store"; +import { useSelectedEventData, useSelectedEventSphere } from "../../../store/simulation/useSimulationStore"; import { useBuilderStore } from "../../../store/builder/useBuilderStore"; import GlobalProperties from "./properties/GlobalProperties"; import AssetProperties from "./properties/AssetProperties"; @@ -22,6 +22,7 @@ import SelectedFloorProperties from "./properties/SelectedFloorProperties"; import SelectedDecalProperties from "./properties/SelectedDecalProperties"; import SelectedAisleProperties from "./properties/SelectedAisleProperties"; import ResourceManagement from "./resourceManagement/ResourceManagement"; +import { useSceneContext } from "../../../modules/scene/sceneContext"; type DisplayComponent = | "versionHistory" @@ -51,7 +52,8 @@ const SideBarRight: React.FC = () => { const { selectedWall, selectedFloor, selectedAisle, selectedFloorAsset } = useBuilderStore(); const { selectedEventData } = useSelectedEventData(); const { selectedEventSphere } = useSelectedEventSphere(); - const { viewVersionHistory, setVersionHistoryVisible } = useVersionHistoryVisibleStore(); + const { versionStore } = useSceneContext(); + const { viewVersionHistory, setVersionHistoryVisible } = versionStore(); const { isComparing } = useIsComparing(); const [displayComponent, setDisplayComponent] = useState("none"); @@ -207,8 +209,7 @@ const SideBarRight: React.FC = () => { <> - )} + {(activeModule === "builder" || activeModule === "simulation") && ( + + )} )} diff --git a/app/src/components/layout/sidebarRight/versionHisory/VersionHistory.tsx b/app/src/components/layout/sidebarRight/versionHisory/VersionHistory.tsx index 14e862f..cd5b400 100644 --- a/app/src/components/layout/sidebarRight/versionHisory/VersionHistory.tsx +++ b/app/src/components/layout/sidebarRight/versionHisory/VersionHistory.tsx @@ -2,7 +2,6 @@ import { useParams } from "react-router-dom"; import { AddIcon, ArrowIcon, CloseIcon, KebabIcon, LocationIcon } from "../../../icons/ExportCommonIcons"; import { useSubModuleStore } from "../../../../store/ui/useModuleStore"; import { useSceneContext } from "../../../../modules/scene/sceneContext"; -import useVersionHistoryVisibleStore from "../../../../store/builder/store"; import RenameInput from "../../../ui/inputs/RenameInput"; import { getVersionDataApi } from "../../../../services/factoryBuilder/versionControl/getVersionDataApi"; @@ -10,8 +9,7 @@ import { getVersionDataApi } from "../../../../services/factoryBuilder/versionCo const VersionHistory = () => { const { setSubModule } = useSubModuleStore(); const { versionStore } = useSceneContext(); - const { setVersionHistoryVisible } = useVersionHistoryVisibleStore(); - const { versionHistory, setCreateNewVersion, selectedVersion, setSelectedVersion } = versionStore(); + const { versionHistory, setCreateNewVersion, selectedVersion, setSelectedVersion, setVersionHistoryVisible } = versionStore(); const { projectId } = useParams(); const addNewVersion = () => { @@ -21,16 +19,16 @@ const VersionHistory = () => { const handleSelectVersion = (version: Version) => { if (!projectId) return; - getVersionDataApi(projectId, version.versionId).then((versionData) => { - setSelectedVersion(version); - }).catch((err) => { - echo.error(err); - }) + getVersionDataApi(projectId, version.versionId) + .then((versionData) => { + setSelectedVersion(version); + }) + .catch((err) => { + echo.error(err); + }); }; - const handleVersionNameChange = (newName: string, versionId: string) => { - - }; + const handleVersionNameChange = (newName: string, versionId: string) => {}; return (
@@ -38,11 +36,7 @@ const VersionHistory = () => {
Version History
-
@@ -64,9 +58,7 @@ const VersionHistory = () => { {/* Shortcut Info */}
i
-
- Press Ctrl + Alt + S to add to version history while editing -
+
Press Ctrl + Alt + S to add to version history while editing
{/* Current Version Display */} @@ -76,12 +68,8 @@ const VersionHistory = () => {
-
- Current Version ({selectedVersion.version}) -
-
- {versionHistory.length} Saved History -
+
Current Version ({selectedVersion.version})
+
{versionHistory.length} Saved History
)} @@ -93,16 +81,8 @@ const VersionHistory = () => { ) : ( versionHistory.map((version) => { const key = `version-${version.versionId}`; - return ( - - ); + return ; }) - )}
@@ -119,22 +99,14 @@ type VersionHistoryItemProps = { const VersionHistoryItem: React.FC = ({ version, onSelect, onRename }) => { return ( - + + + -
Builder
- - - - - - ); + ); }; export default ModuleToggle; diff --git a/app/src/components/ui/Tools.tsx b/app/src/components/ui/Tools.tsx index ede444a..82328fa 100644 --- a/app/src/components/ui/Tools.tsx +++ b/app/src/components/ui/Tools.tsx @@ -6,7 +6,7 @@ import { handleSaveTemplate } from "../../modules/visualization/functions/handle import { usePlayButtonStore } from "../../store/ui/usePlayButtonStore"; import useTemplateStore from "../../store/ui/useTemplateStore"; import { useSelectedZoneStore } from "../../store/visualization/useZoneStore"; -import { useActiveTool, useAddAction, useSocketStore, useToggleView, useToolMode, useActiveSubTool, useShortcutStore } from "../../store/builder/store"; +import { useActiveTool, useSocketStore, useToggleView, useToolMode, useActiveSubTool, useShortcutStore } from "../../store/builder/store"; import { useToggleStore } from "../../store/ui/useUIToggleStore"; import { use3DWidget, useFloatingWidget } from "../../store/visualization/useDroppedObjectsStore"; import { useParams } from "react-router-dom"; @@ -34,7 +34,7 @@ const Tools: React.FC = () => { const { toggleThreeD, setToggleThreeD } = useThreeDStore(); const { isPlaying, setIsPlaying } = usePlayButtonStore(); const { showShortcuts } = useShortcutStore(); - const { activeTool, setActiveTool, setToolMode, setAddAction } = useStoreHooks(); + const { activeTool, setActiveTool, setToolMode } = useStoreHooks(); const { setSelectedWallAsset } = useBuilderStore(); const { setActiveSubTool, activeSubTool } = useActiveSubTool(); const { setToggleUI } = useToggleStore(); @@ -86,7 +86,6 @@ const Tools: React.FC = () => { const resetTools = () => { setToolMode(null); - setAddAction(null); }; const updateToolBehavior = (tool: string, is2D: boolean) => { @@ -116,7 +115,7 @@ const Tools: React.FC = () => { setToolMode("MeasurementScale"); break; case "Add pillar": - if (!is2D) setAddAction("Pillar"); + if (!is2D) setToolMode("Pillar"); break; case "delete": is2D ? setToolMode("2D-Delete") : setToolMode("3D-Delete"); @@ -131,7 +130,6 @@ const Tools: React.FC = () => { setToggleUI(toggleTo2D, toggleTo2D); if (toggleTo2D) { setSelectedWallAsset(null); - setAddAction(null); } setActiveTool("cursor"); setActiveSubTool("cursor"); @@ -242,7 +240,19 @@ const Tools: React.FC = () => {
{/* Tool Picker (cursor, delete, etc.) */} - {["cursor", "free-hand", "delete"].map((tool) => activeSubTool === tool && setActiveTool(tool)} />)} + {["cursor", "free-hand", "delete"].map( + (tool) => + activeSubTool === tool && ( + setActiveTool(tool)} + /> + ) + )} {/* Dropdown Menu */} {activeModule !== "visualization" && (