Merge remote-tracking branch 'origin/v3' into dashboard

This commit is contained in:
Poovizhi99 2025-06-04 17:16:08 +05:30
commit c8fe8f05fb
13 changed files with 33 additions and 55 deletions

View File

@ -26,7 +26,6 @@ const DashboardProjects: React.FC = () => {
{} {}
); );
const [projectDuplicateData, setProjectDuplicateData] = useState<Object>({}); const [projectDuplicateData, setProjectDuplicateData] = useState<Object>({});
console.log("projectDuplicateData: ", projectDuplicateData);
const [isSearchActive, setIsSearchActive] = useState<boolean>(false); const [isSearchActive, setIsSearchActive] = useState<boolean>(false);
const [activeFolder, setActiveFolder] = useState<string>("myProjects"); const [activeFolder, setActiveFolder] = useState<string>("myProjects");
const { projectSocket } = useSocketStore(); const { projectSocket } = useSocketStore();

View File

@ -19,7 +19,6 @@ import {
} from "../../../../store/builder/store"; } from "../../../../store/builder/store";
import { setEnvironment } from "../../../../services/factoryBuilder/environment/setEnvironment"; import { setEnvironment } from "../../../../services/factoryBuilder/environment/setEnvironment";
import * as CONSTANTS from "../../../../types/world/worldConstants"; import * as CONSTANTS from "../../../../types/world/worldConstants";
import { validateBBox } from "@turf/helpers";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
const GlobalProperties: React.FC = () => { const GlobalProperties: React.FC = () => {
const { toggleView, setToggleView } = useToggleView(); const { toggleView, setToggleView } = useToggleView();

View File

@ -12,7 +12,7 @@ import Scene from "../../../modules/scene/scene";
import { useComparisonProduct } from "../../../store/simulation/useSimulationStore"; import { useComparisonProduct } from "../../../store/simulation/useSimulationStore";
const CompareLayOut = () => { const CompareLayOut = () => {
const { comparisonProduct, setComparisonProduct } = useComparisonProduct(); const { comparisonProduct, setComparisonProduct, clearComparisonProduct } = useComparisonProduct();
const { products } = useProductStore(); const { products } = useProductStore();
const { setLoadingProgress } = useLoadingProgress(); const { setLoadingProgress } = useLoadingProgress();
const [width, setWidth] = useState("50vw"); const [width, setWidth] = useState("50vw");
@ -63,6 +63,7 @@ const CompareLayOut = () => {
if (finalWidthVw <= 10) { if (finalWidthVw <= 10) {
setWidth("0px"); setWidth("0px");
setIsVersionSaved(false); setIsVersionSaved(false);
clearComparisonProduct();
} else { } else {
setWidth(`${finalWidthVw}vw`); setWidth(`${finalWidthVw}vw`);
} }

View File

@ -31,6 +31,9 @@ function AssetsGroup({ floorGroup, plane }: { readonly floorGroup: RefGroup, rea
const { setSelectedFloorItem } = useSelectedFloorItem(); const { setSelectedFloorItem } = useSelectedFloorItem();
const { selectedItem, setSelectedItem } = useSelectedItem(); const { selectedItem, setSelectedItem } = useSelectedItem();
const { projectId } = useParams(); const { projectId } = useParams();
const email = localStorage.getItem("email");
const organization = email!.split("@")[1].split(".")[0];
const userId = localStorage.getItem("userId")!;
const loader = new GLTFLoader(); const loader = new GLTFLoader();
const dracoLoader = new DRACOLoader(); const dracoLoader = new DRACOLoader();
@ -41,8 +44,6 @@ function AssetsGroup({ floorGroup, plane }: { readonly floorGroup: RefGroup, rea
loader.setDRACOLoader(dracoLoader); loader.setDRACOLoader(dracoLoader);
useEffect(() => { useEffect(() => {
const email = localStorage.getItem("email");
const organization = email!.split("@")[1].split(".")[0];
let totalAssets = 0; let totalAssets = 0;
let loadedAssets = 0; let loadedAssets = 0;
@ -254,7 +255,6 @@ function AssetsGroup({ floorGroup, plane }: { readonly floorGroup: RefGroup, rea
}; };
}, []); }, []);
const userId = localStorage.getItem("userId");
useEffect(() => { useEffect(() => {
const canvasElement = gl.domElement; const canvasElement = gl.domElement;
const onDrop = (event: any) => { const onDrop = (event: any) => {
@ -265,8 +265,7 @@ function AssetsGroup({ floorGroup, plane }: { readonly floorGroup: RefGroup, rea
pointer.x = (event.clientX / window.innerWidth) * 2 - 1; pointer.x = (event.clientX / window.innerWidth) * 2 - 1;
pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;
addAssetModel(raycaster, camera, pointer, floorGroup, socket, selectedItem, setSelectedItem, addEvent, addAsset, plane, projectId ?? undefined, // convert null to undefined addAssetModel(raycaster, camera, pointer, floorGroup, socket, selectedItem, setSelectedItem, addEvent, addAsset, plane, projectId, userId);
userId ?? undefined);
} }
}; };

View File

@ -53,15 +53,15 @@ async function addAssetModel(
intersectPoint = intersectPoint =
intersectedFloor.distance < intersectedPlane.distance intersectedFloor.distance < intersectedPlane.distance
? new THREE.Vector3( ? new THREE.Vector3(
intersectedFloor.point.x, intersectedFloor.point.x,
Math.round(intersectedFloor.point.y), Math.round(intersectedFloor.point.y),
intersectedFloor.point.z intersectedFloor.point.z
) )
: new THREE.Vector3( : new THREE.Vector3(
intersectedPlane.point.x, intersectedPlane.point.x,
0, 0,
intersectedPlane.point.z intersectedPlane.point.z
); );
} else if (intersectedFloor) { } else if (intersectedFloor) {
intersectPoint = new THREE.Vector3( intersectPoint = new THREE.Vector3(
intersectedFloor.point.x, intersectedFloor.point.x,

View File

@ -156,16 +156,13 @@ export default function Builder() {
const organization = email!.split("@")[1].split(".")[0]; const organization = email!.split("@")[1].split(".")[0];
async function fetchVisibility() { async function fetchVisibility() {
const visibility = await findEnvironment( const data = await findEnvironment(organization, localStorage.getItem("userId")!, projectId);
organization, if (data) {
localStorage.getItem("userId")!,projectId setRoofVisibility(data.roofVisibility);
); setWallVisibility(data.wallVisibility);
if (visibility) { setShadows(data.shadowVisibility);
setRoofVisibility(visibility.roofVisibility); setRenderDistance(data.renderDistance);
setWallVisibility(visibility.wallVisibility); setLimitDistance(data.limitDistance);
setShadows(visibility.shadowVisibility);
setRenderDistance(visibility.renderDistance);
setLimitDistance(visibility.limitDistance);
} }
} }
fetchVisibility(); fetchVisibility();

View File

@ -92,14 +92,12 @@ export default function SocketResponses({
}); });
socket.on("v1:model-asset:response:add", async (data: any) => { socket.on("v1:model-asset:response:add", async (data: any) => {
//
if (socket.id === data.socketId) { if (socket.id === data.socketId) {
return; return;
} }
if (organization !== data.organization) { if (organization !== data.organization) {
return; return;
} }
console.log('data.data: ', data);
if (data.message === "Model created successfully") { if (data.message === "Model created successfully") {
try { try {

View File

@ -30,7 +30,10 @@ export default function Controls() {
} }
const email = localStorage.getItem("email"); const email = localStorage.getItem("email");
const organization = email!.split("@")[1].split(".")[0]; const organization = email!.split("@")[1].split(".")[0];
getCamera(organization, localStorage.getItem("userId")!,projectId).then((data) => { const userId = localStorage.getItem("userId")!;
getCamera(organization, userId, projectId).then((data) => {
// console.log('data: ', data);
if (data && data.position && data.target) { if (data && data.position && data.target) {
controlsRef.current?.setPosition(data.position.x, data.position.y, data.position.z); controlsRef.current?.setPosition(data.position.x, data.position.y, data.position.z);
controlsRef.current?.setTarget(data.target.x, data.target.y, data.target.z); controlsRef.current?.setTarget(data.target.x, data.target.y, data.target.z);
@ -80,7 +83,7 @@ export default function Controls() {
if (hasInteracted && controlsRef.current && state.camera.position && !toggleView) { if (hasInteracted && controlsRef.current && state.camera.position && !toggleView) {
const position = state.camera.position; const position = state.camera.position;
if (position.x === 0 && position.y === 0 && position.z === 0) return; if (position.x === 0 && position.y === 0 && position.z === 0) return;
updateCamPosition(controlsRef, socket, position, state.camera.rotation,projectId); updateCamPosition(controlsRef, socket, position, state.camera.rotation, projectId);
stopInterval(); stopInterval();
} }
}; };

View File

@ -21,6 +21,7 @@ export const getFloorAssets = async (organization: string,projectId?:string) =>
} }
const result = await response.json(); const result = await response.json();
// console.log('result: ', result);
return result; return result;
} catch (error) { } catch (error) {

View File

@ -1,9 +1,6 @@
import { setCamera } from "./setCameraApi";
import * as THREE from "three";
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`; let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const getCamera = async (organization: string, userId: string,projectId?:string) => { export const getCamera = async (organization: string, userId: string, projectId?: string) => {
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/V1/cameras/${projectId}`, `${url_Backend_dwinzo}/api/V1/cameras/${projectId}`,
@ -23,7 +20,6 @@ export const getCamera = async (organization: string, userId: string,projectId?:
} }
const result = await response.json(); const result = await response.json();
// console.log('result: ', result);
if (result === "user not found") { if (result === "user not found") {
return null; return null;
} else { } else {

View File

@ -1,4 +1,3 @@
import { setEnvironment } from "./setEnvironment";
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`; let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
@ -23,22 +22,7 @@ export const findEnvironment = async (organization: string, userId: string, proj
} }
const result = await response.json(); const result = await response.json();
// console.log('resultgetenv: ', result); return result;
if (result === "user not found") {
const userpos = setEnvironment(
organization,
userId,
false,
false,
false,
40,
true,
projectId
);
return userpos;
} else {
return result;
}
} catch (error) { } catch (error) {
echo.error("Failed to find env"); echo.error("Failed to find env");
if (error instanceof Error) { if (error instanceof Error) {

View File

@ -3,9 +3,9 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
export const setEnvironment = async ( export const setEnvironment = async (
organization: string, organization: string,
userId: string, userId: string,
wallVisibility: Boolean, wallVisibility: boolean,
roofVisibility: Boolean, roofVisibility: boolean,
shadowVisibility: Boolean, shadowVisibility: boolean,
renderDistance: number, renderDistance: number,
limitDistance: boolean, limitDistance: boolean,
projectId?: string projectId?: string

View File

@ -21,6 +21,7 @@ export const getZonesApi = async (organization: string, projectId?: string) => {
} }
const result = await response.json(); const result = await response.json();
// console.log('result:zone ', result);
return result; return result;
} catch (error) { } catch (error) {