threads in sidebar
This commit is contained in:
@@ -1,13 +1,22 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import Header from "./Header";
|
import Header from "./Header";
|
||||||
import useModuleStore, { useSubModuleStore } from "../../../store/ui/useModuleStore";
|
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 { useToggleStore } from "../../../store/ui/useUIToggleStore";
|
||||||
import Visualization from "./visualization/Visualization";
|
import Visualization from "./visualization/Visualization";
|
||||||
import Analysis from "./analysis/Analysis";
|
import Analysis from "./analysis/Analysis";
|
||||||
import Simulations from "./simulation/Simulations";
|
import Simulations from "./simulation/Simulations";
|
||||||
import { useIsComparing, useToolMode } from "../../../store/builder/store";
|
import { useActiveTool, useIsComparing, useToolMode } from "../../../store/builder/store";
|
||||||
import { useSelectedEventData, useSelectedEventSphere } from "../../../store/simulation/useSimulationStore";
|
import {
|
||||||
|
useSelectedEventData,
|
||||||
|
useSelectedEventSphere,
|
||||||
|
} from "../../../store/simulation/useSimulationStore";
|
||||||
import { useBuilderStore } from "../../../store/builder/useBuilderStore";
|
import { useBuilderStore } from "../../../store/builder/useBuilderStore";
|
||||||
import GlobalProperties from "./properties/GlobalProperties";
|
import GlobalProperties from "./properties/GlobalProperties";
|
||||||
import AssetProperties from "./properties/AssetProperties";
|
import AssetProperties from "./properties/AssetProperties";
|
||||||
@@ -25,6 +34,7 @@ import SelectedZoneProperties from "./properties/SelectedZoneProperties";
|
|||||||
|
|
||||||
import ResourceManagement from "./resourceManagement/ResourceManagement";
|
import ResourceManagement from "./resourceManagement/ResourceManagement";
|
||||||
import { useSceneContext } from "../../../modules/scene/sceneContext";
|
import { useSceneContext } from "../../../modules/scene/sceneContext";
|
||||||
|
import ThreadDetails from "./properties/eventProperties/components/ThreadDetails";
|
||||||
|
|
||||||
type DisplayComponent =
|
type DisplayComponent =
|
||||||
| "versionHistory"
|
| "versionHistory"
|
||||||
@@ -44,20 +54,26 @@ type DisplayComponent =
|
|||||||
| "analysis"
|
| "analysis"
|
||||||
| "visualization"
|
| "visualization"
|
||||||
| "resourceManagement"
|
| "resourceManagement"
|
||||||
|
| "threadDetails"
|
||||||
| "none";
|
| "none";
|
||||||
|
|
||||||
const SideBarRight: React.FC = () => {
|
const SideBarRight: React.FC = () => {
|
||||||
const { activeModule } = useModuleStore();
|
const { activeModule } = useModuleStore();
|
||||||
|
const { activeTool } = useActiveTool();
|
||||||
|
console.log("activeTool: ", activeTool);
|
||||||
const { toggleUIRight } = useToggleStore();
|
const { toggleUIRight } = useToggleStore();
|
||||||
const { toolMode } = useToolMode();
|
const { toolMode } = useToolMode();
|
||||||
const { subModule, setSubModule } = useSubModuleStore();
|
const { subModule, setSubModule } = useSubModuleStore();
|
||||||
const { selectedWall, selectedFloor, selectedAisle, selectedZone, selectedDecal } = useBuilderStore();
|
const { selectedWall, selectedFloor, selectedAisle, selectedZone, selectedDecal } =
|
||||||
|
useBuilderStore();
|
||||||
const { selectedEventData } = useSelectedEventData();
|
const { selectedEventData } = useSelectedEventData();
|
||||||
const { selectedEventSphere } = useSelectedEventSphere();
|
const { selectedEventSphere } = useSelectedEventSphere();
|
||||||
const { versionStore, assetStore } = useSceneContext();
|
const { versionStore, assetStore, threadStore } = useSceneContext();
|
||||||
const { selectedAssets } = assetStore();
|
const { selectedAssets } = assetStore();
|
||||||
const { viewVersionHistory, setVersionHistoryVisible } = versionStore();
|
const { viewVersionHistory, setVersionHistoryVisible } = versionStore();
|
||||||
const { isComparing } = useIsComparing();
|
const { isComparing } = useIsComparing();
|
||||||
|
const { threads } = threadStore();
|
||||||
|
console.log("threads: ", threads);
|
||||||
|
|
||||||
const [displayComponent, setDisplayComponent] = useState<DisplayComponent>("none");
|
const [displayComponent, setDisplayComponent] = useState<DisplayComponent>("none");
|
||||||
|
|
||||||
@@ -104,7 +120,10 @@ const SideBarRight: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeModule === "simulation" || activeModule === "builder") {
|
if (
|
||||||
|
activeModule === "simulation" ||
|
||||||
|
(activeModule === "builder" && activeTool !== "comment")
|
||||||
|
) {
|
||||||
if (subModule === "resourceManagement") {
|
if (subModule === "resourceManagement") {
|
||||||
setDisplayComponent("resourceManagement");
|
setDisplayComponent("resourceManagement");
|
||||||
return;
|
return;
|
||||||
@@ -116,31 +135,81 @@ const SideBarRight: React.FC = () => {
|
|||||||
setDisplayComponent("assetProperties");
|
setDisplayComponent("assetProperties");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedAssets.length !== 1 && !selectedFloor && !selectedAisle && !selectedDecal && !selectedZone && selectedWall) {
|
if (
|
||||||
|
selectedAssets.length !== 1 &&
|
||||||
|
!selectedFloor &&
|
||||||
|
!selectedAisle &&
|
||||||
|
!selectedDecal &&
|
||||||
|
!selectedZone &&
|
||||||
|
selectedWall
|
||||||
|
) {
|
||||||
setDisplayComponent("selectedWallProperties");
|
setDisplayComponent("selectedWallProperties");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedAssets.length !== 1 && !selectedWall && !selectedAisle && !selectedDecal && !selectedZone && selectedFloor) {
|
if (
|
||||||
|
selectedAssets.length !== 1 &&
|
||||||
|
!selectedWall &&
|
||||||
|
!selectedAisle &&
|
||||||
|
!selectedDecal &&
|
||||||
|
!selectedZone &&
|
||||||
|
selectedFloor
|
||||||
|
) {
|
||||||
setDisplayComponent("selectedFloorProperties");
|
setDisplayComponent("selectedFloorProperties");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (viewVersionHistory && selectedAssets.length !== 1 && !selectedWall && !selectedAisle && !selectedFloor && !selectedDecal && !selectedZone) {
|
if (
|
||||||
|
viewVersionHistory &&
|
||||||
|
selectedAssets.length !== 1 &&
|
||||||
|
!selectedWall &&
|
||||||
|
!selectedAisle &&
|
||||||
|
!selectedFloor &&
|
||||||
|
!selectedDecal &&
|
||||||
|
!selectedZone
|
||||||
|
) {
|
||||||
setDisplayComponent("versionHistory");
|
setDisplayComponent("versionHistory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedAssets.length !== 1 && !selectedFloor && !selectedAisle && !selectedWall && !selectedZone && selectedDecal) {
|
if (
|
||||||
|
selectedAssets.length !== 1 &&
|
||||||
|
!selectedFloor &&
|
||||||
|
!selectedAisle &&
|
||||||
|
!selectedWall &&
|
||||||
|
!selectedZone &&
|
||||||
|
selectedDecal
|
||||||
|
) {
|
||||||
setDisplayComponent("selectedDecalProperties");
|
setDisplayComponent("selectedDecalProperties");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedAssets.length !== 1 && !selectedFloor && !selectedWall && !selectedDecal && !selectedZone && selectedAisle) {
|
if (
|
||||||
|
selectedAssets.length !== 1 &&
|
||||||
|
!selectedFloor &&
|
||||||
|
!selectedWall &&
|
||||||
|
!selectedDecal &&
|
||||||
|
!selectedZone &&
|
||||||
|
selectedAisle
|
||||||
|
) {
|
||||||
setDisplayComponent("selectedAisleProperties");
|
setDisplayComponent("selectedAisleProperties");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedAssets.length !== 1 && !selectedFloor && !selectedWall && !selectedDecal && !selectedAisle && selectedZone) {
|
if (
|
||||||
|
selectedAssets.length !== 1 &&
|
||||||
|
!selectedFloor &&
|
||||||
|
!selectedWall &&
|
||||||
|
!selectedDecal &&
|
||||||
|
!selectedAisle &&
|
||||||
|
selectedZone
|
||||||
|
) {
|
||||||
setDisplayComponent("selectedZoneProperties");
|
setDisplayComponent("selectedZoneProperties");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedAssets.length !== 1 && !selectedFloor && !selectedWall && !selectedDecal && !selectedAisle && !selectedZone) {
|
if (
|
||||||
|
selectedAssets.length !== 1 &&
|
||||||
|
!selectedFloor &&
|
||||||
|
!selectedWall &&
|
||||||
|
!selectedDecal &&
|
||||||
|
!selectedAisle &&
|
||||||
|
!selectedZone
|
||||||
|
) {
|
||||||
if (toolMode === "Aisle") {
|
if (toolMode === "Aisle") {
|
||||||
setDisplayComponent("aisleProperties");
|
setDisplayComponent("aisleProperties");
|
||||||
return;
|
return;
|
||||||
@@ -161,10 +230,26 @@ const SideBarRight: React.FC = () => {
|
|||||||
setDisplayComponent("globalProperties");
|
setDisplayComponent("globalProperties");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (activeModule === "builder" && activeTool === "comment") {
|
||||||
|
setDisplayComponent("threadDetails");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setDisplayComponent("none");
|
setDisplayComponent("none");
|
||||||
}, [viewVersionHistory, activeModule, subModule, isComparing, selectedAssets, selectedWall, selectedFloor, selectedAisle, toolMode, selectedDecal, selectedZone]);
|
}, [
|
||||||
|
viewVersionHistory,
|
||||||
|
activeModule,
|
||||||
|
subModule,
|
||||||
|
isComparing,
|
||||||
|
selectedAssets,
|
||||||
|
selectedWall,
|
||||||
|
selectedFloor,
|
||||||
|
selectedAisle,
|
||||||
|
toolMode,
|
||||||
|
selectedDecal,
|
||||||
|
selectedZone,
|
||||||
|
activeTool,
|
||||||
|
]);
|
||||||
|
|
||||||
const renderComponent = () => {
|
const renderComponent = () => {
|
||||||
switch (displayComponent) {
|
switch (displayComponent) {
|
||||||
@@ -202,13 +287,20 @@ const SideBarRight: React.FC = () => {
|
|||||||
return <Visualization />;
|
return <Visualization />;
|
||||||
case "resourceManagement":
|
case "resourceManagement":
|
||||||
return <ResourceManagement />;
|
return <ResourceManagement />;
|
||||||
|
case "threadDetails":
|
||||||
|
return <ThreadDetails />;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`sidebar-right-wrapper ${toggleUIRight && (!isComparing || activeModule !== "simulation") ? "open" : "closed"}`} onPointerDown={(e) => e.stopPropagation()}>
|
<div
|
||||||
|
className={`sidebar-right-wrapper ${
|
||||||
|
toggleUIRight && (!isComparing || activeModule !== "simulation") ? "open" : "closed"
|
||||||
|
}`}
|
||||||
|
onPointerDown={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
<Header />
|
<Header />
|
||||||
{toggleUIRight && (
|
{toggleUIRight && (
|
||||||
<>
|
<>
|
||||||
@@ -218,7 +310,9 @@ const SideBarRight: React.FC = () => {
|
|||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
id="sidebar-action-list-properties"
|
id="sidebar-action-list-properties"
|
||||||
className={`sidebar-action-list ${subModule === "properties" ? "active" : ""}`}
|
className={`sidebar-action-list ${
|
||||||
|
subModule === "properties" ? "active" : ""
|
||||||
|
}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSubModule("properties");
|
setSubModule("properties");
|
||||||
setVersionHistoryVisible(false);
|
setVersionHistoryVisible(false);
|
||||||
@@ -234,7 +328,9 @@ const SideBarRight: React.FC = () => {
|
|||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
id="sidebar-action-list-simulation"
|
id="sidebar-action-list-simulation"
|
||||||
className={`sidebar-action-list ${subModule === "simulations" ? "active" : ""}`}
|
className={`sidebar-action-list ${
|
||||||
|
subModule === "simulations" ? "active" : ""
|
||||||
|
}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSubModule("simulations");
|
setSubModule("simulations");
|
||||||
setVersionHistoryVisible(false);
|
setVersionHistoryVisible(false);
|
||||||
@@ -245,7 +341,9 @@ const SideBarRight: React.FC = () => {
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
id="sidebar-action-list-mechanics"
|
id="sidebar-action-list-mechanics"
|
||||||
className={`sidebar-action-list ${subModule === "mechanics" ? "active" : ""}`}
|
className={`sidebar-action-list ${
|
||||||
|
subModule === "mechanics" ? "active" : ""
|
||||||
|
}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSubModule("mechanics");
|
setSubModule("mechanics");
|
||||||
setVersionHistoryVisible(false);
|
setVersionHistoryVisible(false);
|
||||||
@@ -256,7 +354,9 @@ const SideBarRight: React.FC = () => {
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
id="sidebar-action-list-analysis"
|
id="sidebar-action-list-analysis"
|
||||||
className={`sidebar-action-list ${subModule === "analysis" ? "active" : ""}`}
|
className={`sidebar-action-list ${
|
||||||
|
subModule === "analysis" ? "active" : ""
|
||||||
|
}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSubModule("analysis");
|
setSubModule("analysis");
|
||||||
setVersionHistoryVisible(false);
|
setVersionHistoryVisible(false);
|
||||||
@@ -271,18 +371,26 @@ const SideBarRight: React.FC = () => {
|
|||||||
{(activeModule === "builder" || activeModule === "simulation") && (
|
{(activeModule === "builder" || activeModule === "simulation") && (
|
||||||
<button
|
<button
|
||||||
id="sidebar-action-list-properties"
|
id="sidebar-action-list-properties"
|
||||||
className={`sidebar-action-list ${subModule === "resourceManagement" ? "active" : ""}`}
|
className={`sidebar-action-list ${
|
||||||
|
subModule === "resourceManagement" ? "active" : ""
|
||||||
|
}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSubModule("resourceManagement");
|
setSubModule("resourceManagement");
|
||||||
setVersionHistoryVisible(false);
|
setVersionHistoryVisible(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="tooltip">Resource Management</div>
|
<div className="tooltip">Resource Management</div>
|
||||||
<FilePackageIcon isActive={subModule === "resourceManagement"} />
|
<FilePackageIcon
|
||||||
|
isActive={subModule === "resourceManagement"}
|
||||||
|
/>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{/* {activeModule === "builder" &&
|
||||||
|
activeTool === "comment" &&
|
||||||
|
threads &&
|
||||||
|
threads.map((val) => <p>{val.threadTitle}</p>)} */}
|
||||||
|
|
||||||
{displayComponent !== "none" && (
|
{displayComponent !== "none" && (
|
||||||
<div className="sidebar-right-container">
|
<div className="sidebar-right-container">
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const ThreadDetails = () => {
|
||||||
|
return <div></div>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ThreadDetails;
|
||||||
@@ -546,6 +546,8 @@ function BuilderResponses() {
|
|||||||
}, [builderSocket, selectedZone]);
|
}, [builderSocket, selectedZone]);
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ interface ThreadSocketProps {
|
|||||||
|
|
||||||
const ThreadSocketResponsesDev = ({ setMessages, modeRef, messages }: ThreadSocketProps) => {
|
const ThreadSocketResponsesDev = ({ setMessages, modeRef, messages }: ThreadSocketProps) => {
|
||||||
const { threadSocket } = useSocketStore();
|
const { threadSocket } = useSocketStore();
|
||||||
const { selectedComment, setSelectedComment, setCommentPositionState, commentPositionState } = useSelectedComment();
|
const { selectedComment, setSelectedComment, setCommentPositionState, commentPositionState } =
|
||||||
|
useSelectedComment();
|
||||||
const { threadStore } = useSceneContext();
|
const { threadStore } = useSceneContext();
|
||||||
const { threads, removeReply, addThread, addReply, updateThread, updateReply } = threadStore();
|
const { threads, removeReply, addThread, addReply, updateThread, updateReply } = threadStore();
|
||||||
const { userId } = getUserData();
|
const { userId } = getUserData();
|
||||||
@@ -73,7 +74,9 @@ const ThreadSocketResponsesDev = ({ setMessages, modeRef, messages }: ThreadSock
|
|||||||
setMessages((prev) =>
|
setMessages((prev) =>
|
||||||
prev.map((message) => {
|
prev.map((message) => {
|
||||||
// 👈 log each message
|
// 👈 log each message
|
||||||
return message.replyId === data.data?._id ? { ...message, comment: data.data?.comment } : message;
|
return message.replyId === data.data?._id
|
||||||
|
? { ...message, comment: data.data?.comment }
|
||||||
|
: message;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -143,7 +146,17 @@ const ThreadSocketResponsesDev = ({ setMessages, modeRef, messages }: ThreadSock
|
|||||||
threadSocket.off("v1-thread:response:delete", handleDeleteThread);
|
threadSocket.off("v1-thread:response:delete", handleDeleteThread);
|
||||||
threadSocket.off("v1-thread:response:updateTitle", handleEditThread);
|
threadSocket.off("v1-thread:response:updateTitle", handleEditThread);
|
||||||
};
|
};
|
||||||
}, [threadSocket, selectedComment, commentPositionState, userId, setSelectedComment, setCommentPositionState, threads, modeRef.current, messages]);
|
}, [
|
||||||
|
threadSocket,
|
||||||
|
selectedComment,
|
||||||
|
commentPositionState,
|
||||||
|
userId,
|
||||||
|
setSelectedComment,
|
||||||
|
setCommentPositionState,
|
||||||
|
threads,
|
||||||
|
modeRef.current,
|
||||||
|
messages,
|
||||||
|
]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export const getAllThreads = async (projectId: string, versionId: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
console.log('result: ', result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user