Refactor code by removing unnecessary lines and comments, and update wall thickness in builder store
This commit is contained in:
@@ -13,7 +13,6 @@ import { deleteThreadApi } from "../../../services/factoryBuilder/comments/delet
|
||||
import { createThreadApi } from "../../../services/factoryBuilder/comments/createThreadApi";
|
||||
import { getRelativeTime } from "./function/getRelativeTime";
|
||||
|
||||
|
||||
const ThreadChat: React.FC = () => {
|
||||
const { userId, organization } = getUserData();
|
||||
const [openThreadOptions, setOpenThreadOptions] = useState(false);
|
||||
@@ -42,7 +41,6 @@ const ThreadChat: React.FC = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (comments.length > 0 && selectedComment) {
|
||||
|
||||
|
||||
const allMessages = comments
|
||||
.flatMap((val: any) =>
|
||||
@@ -60,7 +58,7 @@ const ThreadChat: React.FC = () => {
|
||||
});
|
||||
|
||||
setMessages(allMessages);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}, [selectedComment])
|
||||
@@ -251,9 +249,6 @@ const ThreadChat: React.FC = () => {
|
||||
threadTitle: value
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
if (threadSocket) {
|
||||
|
||||
setInputActive(false);
|
||||
|
||||
@@ -274,7 +274,7 @@ export default function Builder() {
|
||||
<LayoutImage />
|
||||
</Bvh>
|
||||
|
||||
{/* <WallGroup /> */}
|
||||
<WallGroup />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ const FloorPlanGroup = ({ floorPlanGroup, floorPlanGroupLine, floorPlanGroupPoin
|
||||
}
|
||||
|
||||
if (toolMode === "Wall") {
|
||||
drawWall(raycaster, plane, floorPlanGroupPoint, snappedPoint, isSnapped, isSnappedUUID, line, ispreSnapped, anglesnappedPoint, isAngleSnapped, lines, floorPlanGroupLine, floorPlanGroup, ReferenceLineMesh, LineCreated, currentLayerPoint, dragPointControls, setNewLines, setDeletedLines, activeLayer, socket, projectId, selectedVersion?.versionId || '',);
|
||||
// drawWall(raycaster, plane, floorPlanGroupPoint, snappedPoint, isSnapped, isSnappedUUID, line, ispreSnapped, anglesnappedPoint, isAngleSnapped, lines, floorPlanGroupLine, floorPlanGroup, ReferenceLineMesh, LineCreated, currentLayerPoint, dragPointControls, setNewLines, setDeletedLines, activeLayer, socket, projectId, selectedVersion?.versionId || '',);
|
||||
}
|
||||
|
||||
if (toolMode === "Floor") {
|
||||
|
||||
@@ -39,7 +39,7 @@ const ZoneGroup: React.FC = () => {
|
||||
const { selectedVersionStore } = useVersionContext();
|
||||
const { selectedVersion } = selectedVersionStore();
|
||||
const { projectId } = useParams();
|
||||
const { userId, organization, email } = getUserData();
|
||||
const { userId, organization } = getUserData();
|
||||
|
||||
const groupsRef = useRef<any>();
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import { useWallStore } from '../../../../../store/builder/useWallStore';
|
||||
import { useWallClassification } from './helpers/useWallClassification';
|
||||
import { useFrame, useThree } from '@react-three/fiber';
|
||||
import { useWallVisibility } from '../../../../../store/builder/store';
|
||||
import { Decal, PivotControls } from '@react-three/drei';
|
||||
import { Base, Geometry, Subtraction } from '@react-three/csg';
|
||||
import { Decal } from '@react-three/drei';
|
||||
import { Base } from '@react-three/csg';
|
||||
|
||||
function Wall({ wall }: { readonly wall: Wall }) {
|
||||
const { walls } = useWallStore();
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useThree } from "@react-three/fiber";
|
||||
import { MathUtils, Vector3 } from "three";
|
||||
import { Vector3 } from "three";
|
||||
import CommentInstances from "./instances/commentInstances";
|
||||
import { Sphere } from "@react-three/drei";
|
||||
import { useActiveTool, useSelectedComment } from "../../../store/builder/store";
|
||||
|
||||
|
||||
function CommentsGroup() {
|
||||
const { gl, raycaster, camera, scene, pointer, size } = useThree();
|
||||
const { activeTool } = useActiveTool();
|
||||
const [hoverPos, setHoverPos] = useState<Vector3 | null>(null);
|
||||
const { setSelectedComment, setCommentPositionState, setPosition2Dstate } = useSelectedComment();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const canvasElement = gl.domElement;
|
||||
|
||||
|
||||
@@ -6,17 +6,16 @@ import { useParams } from 'react-router-dom';
|
||||
import { getUserData } from '../../../../functions/getUserData';
|
||||
import { getRelativeTime } from '../../../../components/ui/collaboration/function/getRelativeTime';
|
||||
|
||||
|
||||
function CommentInstances() {
|
||||
const { comments, setComments } = useCommentStore();
|
||||
const { projectId } = useParams();
|
||||
const { userId } = getUserData()
|
||||
|
||||
const getThreads = async () => {
|
||||
if (!projectId) return;
|
||||
try {
|
||||
const getComments = await getAllThreads(projectId);
|
||||
|
||||
|
||||
const formattedThreads = Array.isArray(getComments.data)
|
||||
? getComments.data.map((thread: any) => ({
|
||||
...thread,
|
||||
@@ -32,7 +31,6 @@ function CommentInstances() {
|
||||
: [],
|
||||
}))
|
||||
: [];
|
||||
// console.log('formattedThreads: ', formattedThreads);
|
||||
setComments(formattedThreads);
|
||||
} catch (err) {
|
||||
// console.error("Failed to fetch threads:", err);
|
||||
|
||||
@@ -83,7 +83,7 @@ export const useBuilderStore = create<BuilderState>()(
|
||||
|
||||
// Wall
|
||||
|
||||
wallThickness: 0.1,
|
||||
wallThickness: 0.5,
|
||||
wallHeight: 7,
|
||||
outsideMaterial: 'Default Material',
|
||||
insideMaterial: 'Default Material',
|
||||
|
||||
Reference in New Issue
Block a user