(null);
+ const { selectedPath, setSelectedPath } = useSelectedPath();
useEffect(() => {
isPausedRef.current = isPaused;
@@ -57,12 +58,14 @@ function VehicleInstance({ agvDetail }: Readonly<{ agvDetail: VehicleStatus }>)
Math.round(segmentPath[segmentPath.length - 1].x) == Math.round(end.x) &&
Math.round(segmentPath[segmentPath.length - 1].z) == Math.round(end.z)
) {
+ console.log('segmentPath: ', segmentPath);
return segmentPath?.map(({ x, y, z }) => [x, 0, z] as [number, number, number]) || [];
} else {
console.log("There is no path here...Choose valid path")
const { path: segmentPaths } = navMeshQuery.computePath(start, start);
return segmentPaths.map(({ x, y, z }) => [x, 0, z] as [number, number, number]) || [];
}
+
} catch {
console.error("Failed to compute path");
return [];
@@ -97,7 +100,7 @@ function VehicleInstance({ agvDetail }: Readonly<{ agvDetail: VehicleStatus }>)
}
useEffect(() => {
- if (isPlaying) {
+ if (isPlaying || selectedPath === "auto") {
if (!agvDetail.point.action.unLoadPoint || !agvDetail.point.action.pickUpPoint) return;
if (!agvDetail.isActive && agvDetail.state === 'idle' && currentPhase === 'stationed') {
@@ -105,10 +108,7 @@ function VehicleInstance({ agvDetail }: Readonly<{ agvDetail: VehicleStatus }>)
new THREE.Vector3(agvDetail?.position[0], agvDetail?.position[1], agvDetail?.position[2]),
agvDetail?.point?.action?.pickUpPoint?.position
);
- // const toPickupPath = computePath(
- // new THREE.Vector3(agvDetail?.position[0], agvDetail?.position[1], agvDetail?.position[2]),
- // new THREE.Vector3(agvDetail?.position[0], agvDetail?.position[1], agvDetail?.position[2])
- // );
+
setPath(toPickupPath);
setCurrentPhase('stationed-pickup');
setVehicleState(agvDetail.modelUuid, 'running');
@@ -149,8 +149,7 @@ function VehicleInstance({ agvDetail }: Readonly<{ agvDetail: VehicleStatus }>)
else {
reset()
}
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [vehicles, currentPhase, path, isPlaying]);
+ }, [vehicles, currentPhase, path, isPlaying, selectedPath]);
function animate(currentTime: number) {
if (previousTimeRef.current === null) {
@@ -600,6 +599,7 @@ function VehicleInstance({ agvDetail }: Readonly<{ agvDetail: VehicleStatus }>)
reset={reset}
startUnloadingProcess={startUnloadingProcess}
/>
+ {selectedPath === "manual" && ()}
>
);
diff --git a/app/src/pages/Dashboard.tsx b/app/src/pages/Dashboard.tsx
index 15959c1..606765c 100644
--- a/app/src/pages/Dashboard.tsx
+++ b/app/src/pages/Dashboard.tsx
@@ -16,8 +16,9 @@ const Dashboard: React.FC = () => {
useEffect(() => {
const token = localStorage.getItem("token");
+ const refreshToken = localStorage.getItem("refreshToken")
if (token) {
- useSocketStore.getState().initializeSocket(email, organization, token);
+ useSocketStore.getState().initializeSocket(email, organization, token, refreshToken);
} else {
}
diff --git a/app/src/pages/Project.tsx b/app/src/pages/Project.tsx
index bf01b3a..bd4e2bc 100644
--- a/app/src/pages/Project.tsx
+++ b/app/src/pages/Project.tsx
@@ -1,17 +1,14 @@
import React, { useEffect } from "react";
import useModuleStore from "../store/useModuleStore";
import {
- useSocketStore,
- useOrganization,
- useUserName,
- useWallItems,
- useSaveVersion,
- useViewSceneStore,
- useProjectName,
- useRenameModeStore,
- useSelectedFloorItem,
- useZones,
- useSelectedComment,
+ useSocketStore,
+ useOrganization,
+ useUserName,
+ useWallItems,
+ useSaveVersion,
+ useProjectName,
+ useZones,
+ useActiveTool,
} from "../store/builder/store";
import { useNavigate, useParams } from "react-router-dom";
import { useSelectedUserStore } from "../store/collaboration/useCollabStore";
@@ -30,124 +27,136 @@ import { getVersionHistoryApi } from "../services/factoryBuilder/versionControl/
import { useVersionHistoryStore } from "../store/builder/useVersionHistoryStore";
import { VersionProvider } from "../modules/builder/version/versionContext";
import { sharedWithMeProjects } from "../services/dashboard/sharedWithMeProject";
+import { handleCanvasCursors } from "../utils/handleCanvasCursors";
const Project: React.FC = () => {
- let navigate = useNavigate();
- const echo = useLogger();
- const { setToggleUI } = useToggleStore();
- const { setActiveModule } = useModuleStore();
- const { setUserName } = useUserName();
- const { setOrganization } = useOrganization();
- const { setWallItems } = useWallItems();
- const { setZones } = useZones();
- const { isVersionSaved } = useSaveVersion();
- const { projectId } = useParams();
- const { setProjectName } = useProjectName();
- const { userId, email, organization, userName } = getUserData();
- const { selectedUser } = useSelectedUserStore();
- const { isLogListVisible } = useLogger();
- const { setVersions } = useVersionHistoryStore();
+ let navigate = useNavigate();
+ const echo = useLogger();
+ const { setToggleUI } = useToggleStore();
+ const { setActiveModule } = useModuleStore();
+ const { setUserName } = useUserName();
+ const { setOrganization } = useOrganization();
+ const { setWallItems } = useWallItems();
+ const { setZones } = useZones();
+ const { isVersionSaved } = useSaveVersion();
+ const { projectId } = useParams();
+ const { setProjectName } = useProjectName();
+ const { userId, email, organization, userName } = getUserData();
+ const { selectedUser } = useSelectedUserStore();
+ const { isLogListVisible } = useLogger();
+ const { setVersions } = useVersionHistoryStore();
+ const { activeTool } = useActiveTool();
+ useEffect(() => {
+ if (!email || !userId) {
+ console.error("User data not found in localStorage");
+ return;
+ }
- useEffect(() => {
- if (!email || !userId) {
- console.error("User data not found in localStorage");
- return;
- }
+ const fetchProjects = async () => {
+ try {
+ const projects = await getAllProjects(userId, organization);
+ const shared = await sharedWithMeProjects();
- const fetchProjects = async () => {
- try {
- const projects = await getAllProjects(userId, organization);
- const shared = await sharedWithMeProjects();
+ const allProjects = [...(projects?.Projects || []), ...(shared || [])];
- const allProjects = [...(projects?.Projects || []), ...(shared || [])];
+ const matchedProject = allProjects.find(
+ (val: any) => val.projectUuid === projectId || val._id === projectId
+ );
- const matchedProject = allProjects.find(
- (val: any) => val.projectUuid === projectId || val._id === projectId
- );
+ if (matchedProject) {
+ setProjectName(matchedProject.projectName);
+ await viewProject(organization, matchedProject._id, userId);
+ } else {
+ console.warn("Project not found with given ID:", projectId);
+ }
+ } catch (error) {
+ console.error("Error fetching projects:", error);
+ }
+ };
- if (matchedProject) {
- setProjectName(matchedProject.projectName);
- await viewProject(organization, matchedProject._id, userId);
- } else {
- console.warn("Project not found with given ID:", projectId);
- }
- } catch (error) {
- console.error("Error fetching projects:", error);
- }
- };
+ fetchProjects();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
- fetchProjects();
- }, []);
+ useEffect(() => {
+ if (!projectId) return;
+ getVersionHistoryApi(projectId)
+ .then((data) => {
+ const versions: VersionHistory = [];
+ data.versions.forEach((version: any) => {
+ versions.push({
+ version: version.version,
+ versionId: version.versionId,
+ versionName: version.versionName,
+ versionDescription: version.description,
+ timeStamp: version.createdAt,
+ createdBy: version.createdBy.userName,
+ });
+ });
+ setVersions(versions);
+ })
+ .catch(() => {
+ console.error("Error fetching version history");
+ });
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [projectId]);
+ useEffect(() => {
+ if (!isVersionSaved) {
+ setToggleUI(true, true);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [isVersionSaved]);
- useEffect(() => {
- if (!projectId) return;
- getVersionHistoryApi(projectId).then((data) => {
- const versions: VersionHistory = [];
- data.versions.forEach((version: any) => {
- versions.push({
- version: version.version,
- versionId: version.versionId,
- versionName: version.versionName,
- versionDescription: version.description,
- timeStamp: version.createdAt,
- createdBy: version.createdBy.userName
- })
- })
- setVersions(versions);
- }).catch(() => {
- console.error("Error fetching version history")
- })
- }, [projectId])
+ useEffect(() => {
+ setWallItems([]);
+ setZones([]);
+ setActiveModule("builder");
+ if (email) {
+ const token = localStorage.getItem("token");
+ const refreshToken = localStorage.getItem("refreshToken");
+ if (token) {
+ useSocketStore
+ .getState()
+ .initializeSocket(email, organization, token, refreshToken);
+ }
+ if (organization && userName) {
+ setOrganization(organization);
+ setUserName(userName);
+ }
+ echo.success("Log in successful");
+ } else {
+ navigate("/");
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
- useEffect(() => {
- if (!isVersionSaved) {
- setToggleUI(true, true);
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [isVersionSaved]);
+ useEffect(() => {
+ handleCanvasCursors(activeTool);
+ console.log('activeTool: ', activeTool);
+ }, [activeTool]);
- useEffect(() => {
- setWallItems([]);
- setZones([]);
- setActiveModule("builder");
- if (email) {
- const token = localStorage.getItem("token");
- if (token) {
- useSocketStore.getState().initializeSocket(email, organization, token);
- }
- if (organization && userName) {
- setOrganization(organization);
- setUserName(userName);
- }
- echo.success("Log in successful");
- } else {
- navigate("/");
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
-
- return (
-
-
-
-
-
-
-
-
-
-
-
- {selectedUser && }
- {isLogListVisible && (
-
-
-
- )}
-
- );
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ {selectedUser && }
+ {isLogListVisible && (
+
+
+
+ )}
+
+ );
};
export default Project;
diff --git a/app/src/store/builder/store.ts b/app/src/store/builder/store.ts
index 06cb1fb..529e42f 100644
--- a/app/src/store/builder/store.ts
+++ b/app/src/store/builder/store.ts
@@ -5,7 +5,12 @@ import * as CONSTANTS from "../../types/world/worldConstants";
export const useSocketStore = create((set: any, get: any) => ({
socket: null,
- initializeSocket: (email?: string, organization?: string, token?: string) => {
+ initializeSocket: (
+ email?: string,
+ organization?: string,
+ token?: string,
+ refreshToken?: string
+ ) => {
const existingSocket = get().socket;
if (existingSocket) {
return;
@@ -15,7 +20,7 @@ export const useSocketStore = create((set: any, get: any) => ({
`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}/Builder_v1`,
{
reconnection: true,
- auth: { token },
+ auth: { token, refreshToken },
}
);
@@ -23,7 +28,7 @@ export const useSocketStore = create((set: any, get: any) => ({
`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}/Visualization_v1`,
{
reconnection: true,
- auth: { token },
+ auth: { token, refreshToken },
}
);
@@ -31,21 +36,21 @@ export const useSocketStore = create((set: any, get: any) => ({
`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}/dashboard`,
{
reconnection: true,
- auth: { token },
+ auth: { token, refreshToken },
}
);
const projectSocket = io(
`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}/project`,
{
reconnection: true,
- auth: { token },
+ auth: { token, refreshToken },
}
);
const threadSocket = io(
`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}/thread`,
{
reconnection: true,
- auth: { token },
+ auth: { token, refreshToken },
}
);
@@ -724,3 +729,7 @@ export const useSelectedComment = create((set: any) => ({
commentPositionState: null,
setCommentPositionState: (x: any) => set({ commentPositionState: x }),
}));
+export const useSelectedPath = create((set: any) => ({
+ selectedPath: "",
+ setSelectedPath: (x: any) => set({ selectedPath: x }),
+}));
diff --git a/app/src/styles/main.scss b/app/src/styles/main.scss
index 3de3896..df75860 100644
--- a/app/src/styles/main.scss
+++ b/app/src/styles/main.scss
@@ -45,4 +45,5 @@
//
@use "./scene/scene";
-@use "./scene/comments";
\ No newline at end of file
+@use "./scene/comments";
+@use "./scene/cursors.scss";
diff --git a/app/src/styles/pages/dashboard.scss b/app/src/styles/pages/dashboard.scss
index 474c060..5a628a4 100644
--- a/app/src/styles/pages/dashboard.scss
+++ b/app/src/styles/pages/dashboard.scss
@@ -84,12 +84,6 @@
font-weight: var(--font-weight-medium);
background: var(--background-color-button);
- svg {
- path {
- stroke: var(--background-color-selected);
- }
- }
-
&:hover {
background: var(--background-color-button);
}
diff --git a/app/src/styles/scene/cursors.scss b/app/src/styles/scene/cursors.scss
new file mode 100644
index 0000000..cef9b92
--- /dev/null
+++ b/app/src/styles/scene/cursors.scss
@@ -0,0 +1,47 @@
+$cursor-default: url("../../assets/cursors/default.svg") 0 0, default;
+$cursor-pen: url("../../assets/cursors/pen.svg") 0 0, default;
+$cursor-delete: url("../../assets/cursors/pointing.svg") 4 0, default;
+$cursor-draw: url("../../assets/cursors/cell.svg") 8 8, default;
+$cursor-cross: url("../../assets/cursors/cross.svg") 8 8, default;
+$cursor-grab: url("../../assets/cursors/open.svg") 8 8, default;
+$cursor-grabing: url("../../assets/cursors/close.svg") 8 8, default;
+
+.scene-container {
+ canvas {
+ cursor: $cursor-default !important;
+ }
+}
+
+.scene-container.draw {
+ canvas {
+ cursor: $cursor-draw !important;
+ }
+}
+
+.scene-container.pointer {
+ canvas {
+ cursor: $cursor-delete !important;
+ }
+}
+
+.scene-container.pen {
+ canvas {
+ cursor: $cursor-pen !important;
+ }
+}
+
+.scene-container.measure {
+ canvas {
+ cursor: $cursor-cross !important;
+ }
+}
+
+.scene-container.hand {
+ canvas {
+ cursor: $cursor-grab !important;
+ &:active{
+ cursor: $cursor-grabing !important;
+ }
+ }
+}
+
diff --git a/app/src/utils/handleCanvasCursors.ts b/app/src/utils/handleCanvasCursors.ts
new file mode 100644
index 0000000..72e2bd6
--- /dev/null
+++ b/app/src/utils/handleCanvasCursors.ts
@@ -0,0 +1,31 @@
+export const handleCanvasCursors = (name: string) => {
+ const canvas = document.getElementById('work-space-three-d-canvas');
+ if (!canvas) return;
+
+ const cursorMap: Record = {
+ 'draw-wall': 'draw',
+ 'draw-aisle': 'draw',
+ 'draw-zone': 'draw',
+ 'draw-floor': 'draw',
+ measure: 'measure',
+ delete: 'pointer',
+ pen: 'pen',
+ 'free-hand': 'hand',
+ // Add more mappings as needed
+ };
+
+ const validCursorClasses = new Set(Object.values(cursorMap));
+
+ // Remove previously applied cursor-related classes
+ canvas.classList.forEach((cls) => {
+ if (validCursorClasses.has(cls)) {
+ canvas.classList.remove(cls);
+ }
+ });
+
+ // Add the new cursor class
+ const newCursorClass = cursorMap[name];
+ if (newCursorClass) {
+ canvas.classList.add(newCursorClass);
+ }
+};
diff --git a/compose.yaml b/compose.yaml
index 60ae66f..3697f47 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -4,13 +4,13 @@ services:
context: ./app
dockerfile: Dockerfile
args:
- - REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:7999
- - REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:4999
+ - REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:9902
+ - REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:9901
- REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011
- container_name: aalai-beta-Demo
+ container_name: aalaiDemoTwo
stdin_open: true
tty: true
ports:
- - "8300:80"
+ - "8400:80"
volumes:
- ./app:/app