Refactor code by removing unnecessary lines and comments, and update wall thickness in builder store

This commit is contained in:
2025-06-23 10:54:17 +05:30
parent e38f17a18d
commit 329acbe397
8 changed files with 9 additions and 18 deletions

View File

@@ -13,7 +13,6 @@ import { deleteThreadApi } from "../../../services/factoryBuilder/comments/delet
import { createThreadApi } from "../../../services/factoryBuilder/comments/createThreadApi"; import { createThreadApi } from "../../../services/factoryBuilder/comments/createThreadApi";
import { getRelativeTime } from "./function/getRelativeTime"; import { getRelativeTime } from "./function/getRelativeTime";
const ThreadChat: React.FC = () => { const ThreadChat: React.FC = () => {
const { userId, organization } = getUserData(); const { userId, organization } = getUserData();
const [openThreadOptions, setOpenThreadOptions] = useState(false); const [openThreadOptions, setOpenThreadOptions] = useState(false);
@@ -42,7 +41,6 @@ const ThreadChat: React.FC = () => {
useEffect(() => { useEffect(() => {
if (comments.length > 0 && selectedComment) { if (comments.length > 0 && selectedComment) {
const allMessages = comments const allMessages = comments
.flatMap((val: any) => .flatMap((val: any) =>
@@ -60,7 +58,7 @@ const ThreadChat: React.FC = () => {
}); });
setMessages(allMessages); setMessages(allMessages);
} }
}, [selectedComment]) }, [selectedComment])
@@ -251,9 +249,6 @@ const ThreadChat: React.FC = () => {
threadTitle: value threadTitle: value
}; };
if (threadSocket) { if (threadSocket) {
setInputActive(false); setInputActive(false);

View File

@@ -274,7 +274,7 @@ export default function Builder() {
<LayoutImage /> <LayoutImage />
</Bvh> </Bvh>
{/* <WallGroup /> */} <WallGroup />
</> </>
); );
} }

View File

@@ -148,7 +148,7 @@ const FloorPlanGroup = ({ floorPlanGroup, floorPlanGroupLine, floorPlanGroupPoin
} }
if (toolMode === "Wall") { 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") { if (toolMode === "Floor") {

View File

@@ -39,7 +39,7 @@ const ZoneGroup: React.FC = () => {
const { selectedVersionStore } = useVersionContext(); const { selectedVersionStore } = useVersionContext();
const { selectedVersion } = selectedVersionStore(); const { selectedVersion } = selectedVersionStore();
const { projectId } = useParams(); const { projectId } = useParams();
const { userId, organization, email } = getUserData(); const { userId, organization } = getUserData();
const groupsRef = useRef<any>(); const groupsRef = useRef<any>();

View File

@@ -8,8 +8,8 @@ import { useWallStore } from '../../../../../store/builder/useWallStore';
import { useWallClassification } from './helpers/useWallClassification'; import { useWallClassification } from './helpers/useWallClassification';
import { useFrame, useThree } from '@react-three/fiber'; import { useFrame, useThree } from '@react-three/fiber';
import { useWallVisibility } from '../../../../../store/builder/store'; import { useWallVisibility } from '../../../../../store/builder/store';
import { Decal, PivotControls } from '@react-three/drei'; import { Decal } from '@react-three/drei';
import { Base, Geometry, Subtraction } from '@react-three/csg'; import { Base } from '@react-three/csg';
function Wall({ wall }: { readonly wall: Wall }) { function Wall({ wall }: { readonly wall: Wall }) {
const { walls } = useWallStore(); const { walls } = useWallStore();

View File

@@ -1,18 +1,16 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useThree } from "@react-three/fiber"; import { useThree } from "@react-three/fiber";
import { MathUtils, Vector3 } from "three"; import { Vector3 } from "three";
import CommentInstances from "./instances/commentInstances"; import CommentInstances from "./instances/commentInstances";
import { Sphere } from "@react-three/drei"; import { Sphere } from "@react-three/drei";
import { useActiveTool, useSelectedComment } from "../../../store/builder/store"; import { useActiveTool, useSelectedComment } from "../../../store/builder/store";
function CommentsGroup() { function CommentsGroup() {
const { gl, raycaster, camera, scene, pointer, size } = useThree(); const { gl, raycaster, camera, scene, pointer, size } = useThree();
const { activeTool } = useActiveTool(); const { activeTool } = useActiveTool();
const [hoverPos, setHoverPos] = useState<Vector3 | null>(null); const [hoverPos, setHoverPos] = useState<Vector3 | null>(null);
const { setSelectedComment, setCommentPositionState, setPosition2Dstate } = useSelectedComment(); const { setSelectedComment, setCommentPositionState, setPosition2Dstate } = useSelectedComment();
useEffect(() => { useEffect(() => {
const canvasElement = gl.domElement; const canvasElement = gl.domElement;

View File

@@ -6,17 +6,16 @@ import { useParams } from 'react-router-dom';
import { getUserData } from '../../../../functions/getUserData'; import { getUserData } from '../../../../functions/getUserData';
import { getRelativeTime } from '../../../../components/ui/collaboration/function/getRelativeTime'; import { getRelativeTime } from '../../../../components/ui/collaboration/function/getRelativeTime';
function CommentInstances() { function CommentInstances() {
const { comments, setComments } = useCommentStore(); const { comments, setComments } = useCommentStore();
const { projectId } = useParams(); const { projectId } = useParams();
const { userId } = getUserData() const { userId } = getUserData()
const getThreads = async () => { const getThreads = async () => {
if (!projectId) return; if (!projectId) return;
try { try {
const getComments = await getAllThreads(projectId); const getComments = await getAllThreads(projectId);
const formattedThreads = Array.isArray(getComments.data) const formattedThreads = Array.isArray(getComments.data)
? getComments.data.map((thread: any) => ({ ? getComments.data.map((thread: any) => ({
...thread, ...thread,
@@ -32,7 +31,6 @@ function CommentInstances() {
: [], : [],
})) }))
: []; : [];
// console.log('formattedThreads: ', formattedThreads);
setComments(formattedThreads); setComments(formattedThreads);
} catch (err) { } catch (err) {
// console.error("Failed to fetch threads:", err); // console.error("Failed to fetch threads:", err);

View File

@@ -83,7 +83,7 @@ export const useBuilderStore = create<BuilderState>()(
// Wall // Wall
wallThickness: 0.1, wallThickness: 0.5,
wallHeight: 7, wallHeight: 7,
outsideMaterial: 'Default Material', outsideMaterial: 'Default Material',
insideMaterial: 'Default Material', insideMaterial: 'Default Material',