-
+
handleSelectZone(item.id)}>
@@ -26,9 +50,11 @@ const List: React.FC
= ({ items = [] }) => {
-
-
-
+ {remove && (
+
+
+
+ )}
diff --git a/app/src/components/ui/realTimeVis/charts/LineGraphComponent.tsx b/app/src/components/ui/realTimeVis/charts/LineGraphComponent.tsx
index 5911842..07a387f 100644
--- a/app/src/components/ui/realTimeVis/charts/LineGraphComponent.tsx
+++ b/app/src/components/ui/realTimeVis/charts/LineGraphComponent.tsx
@@ -1,5 +1,107 @@
-import { useMemo } from "react";
-import { Line } from "react-chartjs-2";
+// import { useMemo } from "react";
+// import { Line } from "react-chartjs-2";
+
+// interface ChartComponentProps {
+// type: any;
+// title: string;
+// fontFamily?: string;
+// fontSize?: string;
+// fontWeight?: "Light" | "Regular" | "Bold";
+// data: any;
+// }
+
+// const LineGraphComponent = ({
+// title,
+// fontFamily,
+// fontSize,
+// fontWeight = "Regular",
+// }: ChartComponentProps) => {
+// // Memoize Font Weight Mapping
+// const chartFontWeightMap = useMemo(
+// () => ({
+// Light: "lighter" as const,
+// Regular: "normal" as const,
+// Bold: "bold" as const,
+// }),
+// []
+// );
+
+// // Parse and Memoize Font Size
+// const fontSizeValue = useMemo(
+// () => (fontSize ? parseInt(fontSize) : 12),
+// [fontSize]
+// );
+
+// // Determine and Memoize Font Weight
+// const fontWeightValue = useMemo(
+// () => chartFontWeightMap[fontWeight],
+// [fontWeight, chartFontWeightMap]
+// );
+
+// // Memoize Chart Font Style
+// const chartFontStyle = useMemo(
+// () => ({
+// family: fontFamily || "Arial",
+// size: fontSizeValue,
+// weight: fontWeightValue,
+// }),
+// [fontFamily, fontSizeValue, fontWeightValue]
+// );
+
+// const options = useMemo(
+// () => ({
+// responsive: true,
+// maintainAspectRatio: false,
+// plugins: {
+// title: {
+// display: true,
+// text: title,
+// font: chartFontStyle,
+// },
+// legend: {
+// display: false,
+// },
+// },
+// scales: {
+// x: {
+// ticks: {
+// display: true, // This hides the x-axis labels
+// },
+// },
+// },
+// }),
+// [title, chartFontStyle]
+// );
+
+// const chartData = {
+// labels: ["January", "February", "March", "April", "May", "June", "July"],
+// datasets: [
+// {
+// label: "My First Dataset",
+// data: [65, 59, 80, 81, 56, 55, 40],
+// backgroundColor: "#6f42c1", // Updated to #6f42c1 (Purple)
+// borderColor: "#ffffff", // Keeping border color white
+// borderWidth: 2,
+// fill: false,
+// },
+// ],
+// };
+
+// return
;
+// };
+
+// export default LineGraphComponent;
+
+
+import React, { useEffect, useRef, useMemo, useState } from "react";
+import { Chart } from "chart.js/auto";
+import { useThemeStore } from "../../../../store/useThemeStore";
+import io from "socket.io-client";
+import { Line } from 'react-chartjs-2';
+import useChartStore from "../../../../store/useChartStore";
+
+// WebSocket Connection
+// const socket = io("http://localhost:5000"); // Adjust to your backend URL
interface ChartComponentProps {
type: any;
@@ -11,86 +113,153 @@ interface ChartComponentProps {
}
const LineGraphComponent = ({
+ type,
title,
fontFamily,
fontSize,
fontWeight = "Regular",
+ data,
}: ChartComponentProps) => {
- // Memoize Font Weight Mapping
- const chartFontWeightMap = useMemo(
- () => ({
- Light: "lighter" as const,
- Regular: "normal" as const,
- Bold: "bold" as const,
- }),
- []
- );
+ const canvasRef = useRef
(null);
+ const { themeColor } = useThemeStore();
+ const [chartData, setChartData] = useState<{ labels: string[]; datasets: any[] }>({
+ labels: [],
+ datasets: [],
+ });
- // Parse and Memoize Font Size
- const fontSizeValue = useMemo(
- () => (fontSize ? parseInt(fontSize) : 12),
- [fontSize]
- );
-
- // Determine and Memoize Font Weight
- const fontWeightValue = useMemo(
- () => chartFontWeightMap[fontWeight],
- [fontWeight, chartFontWeightMap]
- );
-
- // Memoize Chart Font Style
- const chartFontStyle = useMemo(
- () => ({
- family: fontFamily || "Arial",
- size: fontSizeValue,
- weight: fontWeightValue,
- }),
- [fontFamily, fontSizeValue, fontWeightValue]
- );
-
- const options = useMemo(
- () => ({
- responsive: true,
- maintainAspectRatio: false,
- plugins: {
- title: {
- display: true,
- text: title,
- font: chartFontStyle,
- },
- legend: {
- display: false,
- },
- },
- scales: {
- x: {
- ticks: {
- display: true, // This hides the x-axis labels
+ // Memoize Theme Colors to Prevent Unnecessary Recalculations
+ const buttonActionColor = useMemo(
+ () => themeColor[0] || "#5c87df",
+ [themeColor]
+ );
+ const buttonAbortColor = useMemo(
+ () => themeColor[1] || "#ffffff",
+ [themeColor]
+ );
+
+ // Memoize Font Weight Mapping
+ const chartFontWeightMap = useMemo(
+ () => ({
+ Light: "lighter" as const,
+ Regular: "normal" as const,
+ Bold: "bold" as const,
+ }),
+ []
+ );
+
+ // Parse and Memoize Font Size
+ const fontSizeValue = useMemo(
+ () => (fontSize ? parseInt(fontSize) : 12),
+ [fontSize]
+ );
+
+ // Determine and Memoize Font Weight
+ const fontWeightValue = useMemo(
+ () => chartFontWeightMap[fontWeight],
+ [fontWeight, chartFontWeightMap]
+ );
+
+ // Memoize Chart Font Style
+ const chartFontStyle = useMemo(
+ () => ({
+ family: fontFamily || "Arial",
+ size: fontSizeValue,
+ weight: fontWeightValue,
+ }),
+ [fontFamily, fontSizeValue, fontWeightValue]
+ );
+
+ // Memoize Chart Data
+ // const data = useMemo(() => propsData, [propsData]);
+
+ // Memoize Chart Options
+ const options = useMemo(
+ () => ({
+ responsive: true,
+ maintainAspectRatio: false,
+ plugins: {
+ title: {
+ display: true,
+ text: title,
+ font: chartFontStyle,
+ },
+ legend: {
+ display: false,
},
},
- },
- }),
- [title, chartFontStyle]
- );
+ scales: {
+ x: {
+ ticks: {
+ display: true, // This hides the x-axis labels
+ },
+ },
+ },
+ }),
+ [title, chartFontStyle]
+ );
- const chartData = {
- labels: ["January", "February", "March", "April", "May", "June", "July"],
- datasets: [
- {
- label: "My First Dataset",
- data: [65, 59, 80, 81, 56, 55, 40],
- backgroundColor: "#6f42c1", // Updated to #6f42c1 (Purple)
- borderColor: "#ffffff", // Keeping border color white
+ const { measurements, setMeasurements, updateDuration, duration } = useChartStore();
+
+ useEffect(() => {
+ if ( measurements.length > 0 ) {
+ const socket = io("http://192.168.0.192:5010");
+
+ var inputes = {
+ measurements: measurements,
+ duration: duration,
+ interval: 1000,
+ }
+
+ console.log('graphHHHHHHHHHHHHHHHHHHHHHHHHHHHHH',inputes);
+
+
+ // Start stream
+ const startStream = () => {
+ socket.emit("lineInput", inputes);
+ }
+
+ socket.on('connect', startStream);
+
+ socket.on("lineOutput", (response) => {
+ const responceData = response.data;
+ console.log("Received data:", responceData);
+
+ // Extract timestamps and values
+ const labels = responceData.time;
+ const datasets = data.measurements.map((measurement: any) => ({
+ label: `${measurement.name}.${measurement.fields}`,
+ data: responceData[`${measurement.name}.${measurement.fields}`]?.values || [],
+ backgroundColor: themeColor[0] || "#5c87df",
+ borderColor: themeColor[1] || "#ffffff",
borderWidth: 2,
- fill: false,
- },
- ],
- };
+ // fill: false,
+ }));
+
+ setChartData({ labels, datasets });
+ });
+
+ return () => {
+ socket.off("lineOutput");
+ socket.emit("stop_stream"); // Stop streaming when component unmounts
+ };
+ }
+ }, [measurements, duration]);
+
+ // useEffect(() => {
+ // if (!canvasRef.current) return;
+ // const ctx = canvasRef.current.getContext("2d");
+ // if (!ctx) return;
+
+ // const chart = new Chart(ctx, {
+ // type,
+ // data: chartData,
+ // options: options,
+ // });
+
+ // return () => chart.destroy();
+ // }, [chartData, type, title]);
return ;
};
-export default LineGraphComponent;
-
-
-// like this
\ No newline at end of file
+export default LineGraphComponent;
\ No newline at end of file
diff --git a/app/src/components/ui/realTimeVis/floating/SimpleCard.tsx b/app/src/components/ui/realTimeVis/floating/SimpleCard.tsx
index d67e87f..ef3d85c 100644
--- a/app/src/components/ui/realTimeVis/floating/SimpleCard.tsx
+++ b/app/src/components/ui/realTimeVis/floating/SimpleCard.tsx
@@ -13,8 +13,22 @@ const SimpleCard: React.FC = ({
value,
per,
}) => {
+
+ const handleDragStart = (event: React.DragEvent) => {
+ const cardData = JSON.stringify({
+ header,
+ value,
+ per,
+ className: event.currentTarget.className,
+ });
+
+ console.log("Dragging Data:", cardData); // ✅ Debugging log
+
+ event.dataTransfer.setData("text/plain", cardData);
+ };
+
return (
-
+
{header}
diff --git a/app/src/modules/builder/geomentries/assets/assetManager.ts b/app/src/modules/builder/geomentries/assets/assetManager.ts
index f083395..38d0721 100644
--- a/app/src/modules/builder/geomentries/assets/assetManager.ts
+++ b/app/src/modules/builder/geomentries/assets/assetManager.ts
@@ -112,7 +112,7 @@ export default async function assetManager(
) {
if (!activePromises.get(taskId)) return; // Stop processing if task is canceled
- const existingModel = itemsGroup.current.getObjectByProperty("uuid", item.modeluuid);
+ const existingModel = itemsGroup?.current?.getObjectByProperty("uuid", item.modeluuid);
if (existingModel) {
// console.log(`Model ${item.modelname} already exists in the scene.`);
resolve();
diff --git a/app/src/modules/builder/groups/zoneGroup.tsx b/app/src/modules/builder/groups/zoneGroup.tsx
index 9e0bc15..3d47a7e 100644
--- a/app/src/modules/builder/groups/zoneGroup.tsx
+++ b/app/src/modules/builder/groups/zoneGroup.tsx
@@ -65,6 +65,8 @@ const ZoneGroup: React.FC = () => {
zoneId: zone.zoneId,
zoneName: zone.zoneName,
points: zone.points,
+ viewPortCenter: zone.viewPortCenter,
+ viewPortposition: zone.viewPortposition,
layer: zone.layer
}));
@@ -145,7 +147,7 @@ const ZoneGroup: React.FC = () => {
const target: [number, number, number] | null = calculateCenter(zone.points);
if (!target) return;
- const position = [target[0], 75, target[2]];
+ const position = [target[0], 10, target[2]];
const input = {
userId: userId,
@@ -186,7 +188,7 @@ const ZoneGroup: React.FC = () => {
const target: [number, number, number] | null = calculateCenter(zone.points);
if (!target) return;
- const position = [target[0], 75, target[2]];
+ const position = [target[0], 10, target[2]];
const input = {
userId: userId,
diff --git a/app/src/modules/collaboration/socketResponses.dev.tsx b/app/src/modules/collaboration/socketResponses.dev.tsx
index e9ca9e0..031629f 100644
--- a/app/src/modules/collaboration/socketResponses.dev.tsx
+++ b/app/src/modules/collaboration/socketResponses.dev.tsx
@@ -745,6 +745,7 @@ export default function SocketResponses({
return
}
if (data.message === "zone deleted") {
+ console.log('data: ', data);
const updatedZones = zones.filter((zone: any) => zone.zoneId !== data.data.zoneId);
setZones(updatedZones);
diff --git a/app/src/modules/market/AssetPreview.tsx b/app/src/modules/market/AssetPreview.tsx
new file mode 100644
index 0000000..a3c1cb0
--- /dev/null
+++ b/app/src/modules/market/AssetPreview.tsx
@@ -0,0 +1,95 @@
+import React from "react";
+import assetImage from "../../assets/image/image.png";
+import { FiileedStarsIconSmall } from "../../components/icons/marketPlaceIcons";
+
+// Define the shape of the selected card
+interface SelectedCard {
+ assetName: string;
+ uploadedOn: string;
+ price: number;
+ rating: number;
+ views: number;
+}
+
+// Define the props type for AssetPreview
+interface AssetPreviewProps {
+ selectedCard: SelectedCard;
+ setSelectedCard: React.Dispatch
>; // Type for setter function
+}
+
+const AssetPreview: React.FC = ({
+ selectedCard,
+ setSelectedCard,
+}) => {
+ // Ensure rating is a valid number between 0 and 5
+ const rating = Math.max(
+ 0,
+ Math.min(5, isNaN(selectedCard.rating) ? 0 : selectedCard.rating)
+ );
+
+ console.log("selectedCard: ", selectedCard);
+
+ // Ensure that the rating is a valid positive integer for array length
+ const starsArray = Array.from({ length: rating }, (_, index) => index);
+
+ return (
+
+
+
+

+
+
+
+
+
H
+
+
HERX FACTORY
+
Follow +
+
+
+
+ {/* asset details */}
+
+
{selectedCard.assetName}
+
+ Lorem ipsum dolor sit amet consectetur adipisicing elit.
+ Doloremque nisi beatae facilis architecto quaerat delectus velit
+ aliquid assumenda cumque vitae! Tempore quibusdam ab natus in
+ minima voluptates, aliquid corrupti excepturi consectetur
+ distinctio sequi beatae odit autem? Distinctio ab, voluptatem
+ omnis quibusdam, incidunt eum ipsa aliquid enim eaque eveniet nisi
+ autem, accusantium vel! Laborum in iste voluptates ad! Harum eum
+ amet pariatur fugit laudantium dolorem maxime voluptates atque
+ molestiae modi inventore quidem maiores dolore numquam, natus
+ quisquam optio distinctio eveniet aliquam, aut eligendi laboriosam
+ eaque! Porro cumque cum distinctio ullam debitis, dolorum
+ similique! Harum cupiditate perferendis voluptatum molestiae,
+ fugiat quisquam assumenda!
+
+
+
+
+ {selectedCard.rating}
+
+
{selectedCard.views} views
+
+
₹ {selectedCard.price}
+
+
+ {/* buttons */}
+
+
Add to cart
+
Buy now
+
+
+ {/* close button */}
+
setSelectedCard(null)}>
+ {`<-back`}
+
+
+
+
+ );
+};
+
+export default AssetPreview;
diff --git a/app/src/modules/market/CardsContainer.tsx b/app/src/modules/market/CardsContainer.tsx
index 204ef6d..27d4a6b 100644
--- a/app/src/modules/market/CardsContainer.tsx
+++ b/app/src/modules/market/CardsContainer.tsx
@@ -15,4 +15,4 @@ const CardsContainer: React.FC = () => {
);
};
-export default CardsContainer;
\ No newline at end of file
+export default CardsContainer;
diff --git a/app/src/modules/market/MarketPlace.tsx b/app/src/modules/market/MarketPlace.tsx
index 71dc0a5..a68bfc3 100644
--- a/app/src/modules/market/MarketPlace.tsx
+++ b/app/src/modules/market/MarketPlace.tsx
@@ -1,18 +1,18 @@
-import React from "react";
-import FilterSearch from "./FilterSearch";
-import CardsContainer from "./CardsContainer";
-
-const MarketPlace = () => {
- return (
-
- );
-};
-
-export default MarketPlace;
+import React from "react";
+import FilterSearch from "./FilterSearch";
+import CardsContainer from "./CardsContainer";
+
+const MarketPlace = () => {
+ return (
+
+ );
+};
+
+export default MarketPlace;
diff --git a/app/src/modules/scene/scene.tsx b/app/src/modules/scene/scene.tsx
index 6d291b1..66ca9e7 100644
--- a/app/src/modules/scene/scene.tsx
+++ b/app/src/modules/scene/scene.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from "react";
+import { useMemo, useState } from "react";
import { Canvas } from "@react-three/fiber";
import { Environment, KeyboardControls } from "@react-three/drei";
@@ -15,6 +15,12 @@ import background from "../../assets/textures/hdr/mudroadpuresky2k.hdr";
import SelectionControls from "./controls/selection/selectionControls";
import MeasurementTool from "./tools/measurementTool";
import Simulation from "../simulation/simulation";
+import ZoneCentreTarget from "../../components/ui/componets/zoneCameraTarget";
+
+import { useThree } from "@react-three/fiber";
+import * as THREE from "three";
+import DroppedObjects from "../../components/ui/componets/DroppedFloatingWidgets";
+
// import Simulation from "./simulationtemp/simulation";
export default function Scene() {
@@ -27,6 +33,9 @@ export default function Scene() {
// { name: "jump", keys: ["Space"] },
], [])
+
+
+
return (