2025-03-31 19:20:03 +05:30
|
|
|
|
2025-03-27 18:04:16 +05:30
|
|
|
import { WalletIcon } from "../../icons/3dChartIcons";
|
|
|
|
|
import { useEffect, useRef, useState } from "react";
|
2025-03-29 19:21:20 +05:30
|
|
|
import {
|
|
|
|
|
useDroppedObjectsStore,
|
|
|
|
|
Zones,
|
|
|
|
|
} from "../../../store/useDroppedObjectsStore";
|
|
|
|
|
import useModuleStore from "../../../store/useModuleStore";
|
|
|
|
|
import { determinePosition } from "./functions/determinePosition";
|
|
|
|
|
import { getActiveProperties } from "./functions/getActiveProperties";
|
|
|
|
|
import { addingFloatingWidgets } from "../../../services/realTimeVisulization/zoneData/addFloatingWidgets";
|
2025-03-31 18:22:40 +05:30
|
|
|
import {
|
|
|
|
|
DublicateIcon,
|
|
|
|
|
KebabIcon,
|
|
|
|
|
DeleteIcon,
|
|
|
|
|
} from "../../icons/ExportCommonIcons";
|
|
|
|
|
import DistanceLines from "./DistanceLines"; // Import the DistanceLines component
|
2025-03-31 19:20:03 +05:30
|
|
|
import { deleteFloatingWidgetApi } from "../../../services/realTimeVisulization/zoneData/deleteFloatingWidget";
|
2025-03-27 12:28:17 +05:30
|
|
|
|
2025-03-31 19:22:37 +05:30
|
|
|
import TotalCardComponent from "../realTimeVis/floating/TotalCardComponent";
|
|
|
|
|
import WarehouseThroughputComponent from "../realTimeVis/floating/WarehouseThroughputComponent";
|
|
|
|
|
import FleetEfficiencyComponent from "../realTimeVis/floating/FleetEfficiencyComponent";
|
|
|
|
|
import { useWidgetStore } from "../../../store/useWidgetStore";
|
2025-03-31 18:22:40 +05:30
|
|
|
interface DraggingState {
|
|
|
|
|
zone: string;
|
|
|
|
|
index: number;
|
|
|
|
|
initialPosition: {
|
|
|
|
|
top: number | "auto";
|
|
|
|
|
left: number | "auto";
|
|
|
|
|
right: number | "auto";
|
|
|
|
|
bottom: number | "auto";
|
|
|
|
|
};
|
|
|
|
|
}
|
2025-03-27 12:28:17 +05:30
|
|
|
|
2025-03-31 19:20:03 +05:30
|
|
|
interface DraggingState {
|
|
|
|
|
zone: string;
|
|
|
|
|
index: number;
|
|
|
|
|
initialPosition: {
|
|
|
|
|
top: number | "auto";
|
|
|
|
|
left: number | "auto";
|
|
|
|
|
right: number | "auto";
|
|
|
|
|
bottom: number | "auto";
|
|
|
|
|
};
|
|
|
|
|
}
|
2025-03-27 18:04:16 +05:30
|
|
|
const DroppedObjects: React.FC = () => {
|
|
|
|
|
const zones = useDroppedObjectsStore((state) => state.zones);
|
2025-03-31 18:22:40 +05:30
|
|
|
const [openKebabId, setOpenKebabId] = useState<string | null>(null);
|
2025-03-29 19:21:20 +05:30
|
|
|
const updateObjectPosition = useDroppedObjectsStore(
|
|
|
|
|
(state) => state.updateObjectPosition
|
|
|
|
|
);
|
2025-03-31 19:20:03 +05:30
|
|
|
const deleteObject = useDroppedObjectsStore((state) => state.deleteObject);
|
|
|
|
|
|
|
|
|
|
const duplicateObject = useDroppedObjectsStore((state) => state.duplicateObject);
|
2025-03-31 18:22:40 +05:30
|
|
|
const [draggingIndex, setDraggingIndex] = useState<DraggingState | null>(
|
|
|
|
|
null
|
|
|
|
|
);
|
2025-03-27 18:04:16 +05:30
|
|
|
const [offset, setOffset] = useState<[number, number] | null>(null);
|
2025-03-31 19:22:37 +05:30
|
|
|
const { setSelectedChartId } = useWidgetStore();
|
2025-03-31 19:54:21 +05:30
|
|
|
const [activeEdges, setActiveEdges] = useState<{
|
|
|
|
|
vertical: "top" | "bottom";
|
|
|
|
|
horizontal: "left" | "right";
|
|
|
|
|
} | null>(null); // State to track active edges for distance lines
|
|
|
|
|
const [currentPosition, setCurrentPosition] = useState<{
|
|
|
|
|
top: number | "auto";
|
|
|
|
|
left: number | "auto";
|
|
|
|
|
right: number | "auto";
|
|
|
|
|
bottom: number | "auto";
|
|
|
|
|
} | null>(null); // State to track the current position during drag
|
2025-03-27 18:04:16 +05:30
|
|
|
const animationRef = useRef<number | null>(null);
|
2025-03-29 19:21:20 +05:30
|
|
|
const { activeModule } = useModuleStore();
|
2025-03-27 18:04:16 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
// Clean up animation frame on unmount
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
return () => {
|
|
|
|
|
if (animationRef.current) {
|
|
|
|
|
cancelAnimationFrame(animationRef.current);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}, []);
|
|
|
|
|
|
2025-03-27 18:04:16 +05:30
|
|
|
const zoneEntries = Object.entries(zones);
|
2025-03-31 19:54:21 +05:30
|
|
|
if (zoneEntries.length === 0) return null;
|
|
|
|
|
const [zoneName, zone] = zoneEntries[0];
|
|
|
|
|
|
|
|
|
|
function handleDuplicate(zoneName: string, index: number) {
|
|
|
|
|
setOpenKebabId(null)
|
|
|
|
|
duplicateObject(zoneName, index); // Call the duplicateObject method from the store
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handleDelete(zoneName: string, id: string, index: number) {
|
|
|
|
|
try {
|
|
|
|
|
const email = localStorage.getItem("email") || "";
|
|
|
|
|
const organization = email?.split("@")[1]?.split(".")[0];
|
2025-03-31 19:20:03 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
let res = await deleteFloatingWidgetApi(id, organization);
|
|
|
|
|
console.log('res: ', res);
|
2025-03-29 19:21:20 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
if (res.message === "FloatingWidget deleted successfully") {
|
2025-04-01 11:33:10 +05:30
|
|
|
deleteObject(zoneName,id, index); // Call the deleteObject method from the store
|
2025-03-31 19:54:21 +05:30
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error deleting floating widget:", error);
|
2025-03-29 19:21:20 +05:30
|
|
|
}
|
2025-03-31 19:54:21 +05:30
|
|
|
}
|
2025-03-27 18:04:16 +05:30
|
|
|
|
|
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
const handlePointerDown = (event: React.PointerEvent, index: number) => {
|
|
|
|
|
const obj = zone.objects[index];
|
|
|
|
|
const container = document.getElementById("real-time-vis-canvas");
|
|
|
|
|
if (!container) return;
|
2025-03-27 18:04:16 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
const rect = container.getBoundingClientRect();
|
|
|
|
|
const relativeX = event.clientX - rect.left;
|
|
|
|
|
const relativeY = event.clientY - rect.top;
|
|
|
|
|
|
|
|
|
|
// Determine active properties for the initial position
|
|
|
|
|
const [activeProp1, activeProp2] = getActiveProperties(obj.position);
|
|
|
|
|
|
|
|
|
|
// Set active edges for distance lines
|
|
|
|
|
const vertical = activeProp1 === "top" ? "top" : "bottom";
|
|
|
|
|
const horizontal = activeProp2 === "left" ? "left" : "right";
|
|
|
|
|
setActiveEdges({ vertical, horizontal });
|
|
|
|
|
|
|
|
|
|
// Store the initial position strategy and active edges
|
|
|
|
|
setDraggingIndex({
|
|
|
|
|
zone: zoneName,
|
|
|
|
|
index,
|
|
|
|
|
initialPosition: { ...obj.position },
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Calculate offset from mouse to object edges
|
|
|
|
|
let offsetX = 0;
|
|
|
|
|
let offsetY = 0;
|
|
|
|
|
|
|
|
|
|
if (activeProp1 === "top") {
|
|
|
|
|
offsetY = relativeY - (obj.position.top as number);
|
|
|
|
|
} else {
|
|
|
|
|
offsetY = rect.height - relativeY - (obj.position.bottom as number);
|
2025-03-29 19:21:20 +05:30
|
|
|
}
|
2025-03-27 18:04:16 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
if (activeProp2 === "left") {
|
|
|
|
|
offsetX = relativeX - (obj.position.left as number);
|
|
|
|
|
} else {
|
|
|
|
|
offsetX = rect.width - relativeX - (obj.position.right as number);
|
|
|
|
|
}
|
2025-03-29 19:21:20 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
setOffset([offsetY, offsetX]);
|
|
|
|
|
};
|
2025-03-27 18:04:16 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
const handlePointerMove = (event: React.PointerEvent) => {
|
|
|
|
|
if (!draggingIndex || !offset) return;
|
2025-03-27 18:04:16 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
const container = document.getElementById("real-time-vis-canvas");
|
|
|
|
|
if (!container) return;
|
2025-03-29 19:21:20 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
const rect = container.getBoundingClientRect();
|
|
|
|
|
const relativeX = event.clientX - rect.left;
|
|
|
|
|
const relativeY = event.clientY - rect.top;
|
2025-03-27 18:04:16 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
// Dynamically determine the current position strategy
|
|
|
|
|
const newPositionStrategy = determinePosition(rect, relativeX, relativeY);
|
|
|
|
|
const [activeProp1, activeProp2] = getActiveProperties(newPositionStrategy);
|
2025-03-27 18:04:16 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
// Update active edges for distance lines
|
|
|
|
|
const vertical = activeProp1 === "top" ? "top" : "bottom";
|
|
|
|
|
const horizontal = activeProp2 === "left" ? "left" : "right";
|
|
|
|
|
setActiveEdges({ vertical, horizontal });
|
2025-03-29 19:21:20 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
// Calculate new position based on the active properties
|
|
|
|
|
let newY = 0;
|
|
|
|
|
let newX = 0;
|
2025-03-29 19:21:20 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
if (activeProp1 === "top") {
|
|
|
|
|
newY = relativeY - offset[0];
|
|
|
|
|
} else {
|
|
|
|
|
newY = rect.height - (relativeY + offset[0]);
|
|
|
|
|
}
|
2025-03-31 18:22:40 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
if (activeProp2 === "left") {
|
|
|
|
|
newX = relativeX - offset[1];
|
|
|
|
|
} else {
|
|
|
|
|
newX = rect.width - (relativeX + offset[1]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Apply boundaries
|
|
|
|
|
newX = Math.max(0, Math.min(rect.width - 50, newX));
|
|
|
|
|
newY = Math.max(0, Math.min(rect.height - 50, newY));
|
|
|
|
|
|
|
|
|
|
// Create new position object
|
|
|
|
|
const newPosition = {
|
|
|
|
|
...newPositionStrategy,
|
|
|
|
|
[activeProp1]: newY,
|
|
|
|
|
[activeProp2]: newX,
|
|
|
|
|
// Clear opposite properties
|
|
|
|
|
[activeProp1 === "top" ? "bottom" : "top"]: "auto",
|
|
|
|
|
[activeProp2 === "left" ? "right" : "left"]: "auto",
|
2025-03-31 18:22:40 +05:30
|
|
|
};
|
|
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
// Update the current position state for DistanceLines
|
|
|
|
|
setCurrentPosition(newPosition);
|
|
|
|
|
|
|
|
|
|
if (!animationRef.current) {
|
|
|
|
|
animationRef.current = requestAnimationFrame(() => {
|
|
|
|
|
updateObjectPosition(zoneName, draggingIndex.index, newPosition);
|
|
|
|
|
animationRef.current = null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handlePointerUp = async (event: React.PointerEvent<HTMLDivElement>) => {
|
|
|
|
|
try {
|
2025-03-29 19:21:20 +05:30
|
|
|
if (!draggingIndex || !offset) return;
|
|
|
|
|
|
|
|
|
|
const container = document.getElementById("real-time-vis-canvas");
|
2025-03-31 18:22:40 +05:30
|
|
|
if (!container) return;
|
2025-03-29 19:21:20 +05:30
|
|
|
|
|
|
|
|
const rect = container.getBoundingClientRect();
|
|
|
|
|
const relativeX = event.clientX - rect.left;
|
|
|
|
|
const relativeY = event.clientY - rect.top;
|
|
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
// Only now determine the final position strategy
|
|
|
|
|
const finalPosition = determinePosition(rect, relativeX, relativeY);
|
|
|
|
|
const [activeProp1, activeProp2] = getActiveProperties(finalPosition);
|
2025-03-31 18:22:40 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
// Calculate final position using the new strategy
|
|
|
|
|
let finalY = 0;
|
|
|
|
|
let finalX = 0;
|
2025-03-29 19:21:20 +05:30
|
|
|
|
2025-03-31 18:22:40 +05:30
|
|
|
if (activeProp1 === "top") {
|
2025-03-31 19:54:21 +05:30
|
|
|
finalY = relativeY - offset[0];
|
2025-03-31 18:22:40 +05:30
|
|
|
} else {
|
2025-03-31 19:54:21 +05:30
|
|
|
finalY = rect.height - (relativeY + offset[0]);
|
2025-03-29 19:21:20 +05:30
|
|
|
}
|
|
|
|
|
|
2025-03-31 18:22:40 +05:30
|
|
|
if (activeProp2 === "left") {
|
2025-03-31 19:54:21 +05:30
|
|
|
finalX = relativeX - offset[1];
|
2025-03-31 18:22:40 +05:30
|
|
|
} else {
|
2025-03-31 19:54:21 +05:30
|
|
|
finalX = rect.width - (relativeX + offset[1]);
|
2025-03-29 19:21:20 +05:30
|
|
|
}
|
2025-03-31 18:22:40 +05:30
|
|
|
|
|
|
|
|
// Apply boundaries
|
2025-03-31 19:54:21 +05:30
|
|
|
finalX = Math.max(0, Math.min(rect.width - 50, finalX));
|
|
|
|
|
finalY = Math.max(0, Math.min(rect.height - 50, finalY));
|
|
|
|
|
|
|
|
|
|
const boundedPosition = {
|
|
|
|
|
...finalPosition,
|
|
|
|
|
[activeProp1]: finalY,
|
|
|
|
|
[activeProp2]: finalX,
|
2025-03-31 18:22:40 +05:30
|
|
|
};
|
|
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
// Save to backend
|
|
|
|
|
const email = localStorage.getItem("email") || "";
|
|
|
|
|
const organization = email?.split("@")[1]?.split(".")[0];
|
|
|
|
|
const response = await addingFloatingWidgets(zone.zoneId, organization, {
|
|
|
|
|
...zone.objects[draggingIndex.index],
|
|
|
|
|
position: boundedPosition,
|
|
|
|
|
});
|
2025-04-01 11:33:10 +05:30
|
|
|
console.log('response: ', response);
|
2025-03-31 18:22:40 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
if (response.message === "Widget updated successfully") {
|
|
|
|
|
updateObjectPosition(zoneName, draggingIndex.index, boundedPosition);
|
2025-03-29 19:21:20 +05:30
|
|
|
}
|
|
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
// Clean up
|
|
|
|
|
setDraggingIndex(null);
|
|
|
|
|
setOffset(null);
|
|
|
|
|
setActiveEdges(null); // Clear active edges
|
|
|
|
|
setCurrentPosition(null); // Reset current position
|
|
|
|
|
if (animationRef.current) {
|
|
|
|
|
cancelAnimationFrame(animationRef.current);
|
|
|
|
|
animationRef.current = null;
|
2025-03-29 19:21:20 +05:30
|
|
|
}
|
2025-03-31 19:54:21 +05:30
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error in handlePointerUp:", error);
|
|
|
|
|
}
|
|
|
|
|
};
|
2025-03-29 19:21:20 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
const handleKebabClick = (id: string, event: React.MouseEvent) => {
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
setOpenKebabId((prevId) => (prevId === id ? null : id));
|
|
|
|
|
};
|
2025-03-31 18:22:40 +05:30
|
|
|
|
2025-03-31 19:54:21 +05:30
|
|
|
const renderObjectContent = (obj: any) => {
|
|
|
|
|
switch (obj.className) {
|
|
|
|
|
case "floating total-card":
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className="header-wrapper">
|
|
|
|
|
<div className="header">{obj.header}</div>
|
|
|
|
|
<div className="data-values">
|
|
|
|
|
<div className="value">{obj.value}</div>
|
|
|
|
|
<div className="per">{obj.per}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="icon">
|
|
|
|
|
<WalletIcon />
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
case "warehouseThroughput floating":
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className="header">
|
|
|
|
|
<h2>Warehouse Throughput</h2>
|
|
|
|
|
<p>
|
|
|
|
|
<span>(+5) more</span> in 2025
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="lineGraph" style={{ height: "100%" }}>
|
|
|
|
|
{/* <Line data={lineGraphData} options={lineGraphOptions} /> */}
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
case "fleetEfficiency floating":
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<h2 className="header">Fleet Efficiency</h2>
|
|
|
|
|
<div className="progressContainer">
|
|
|
|
|
<div className="progress">
|
|
|
|
|
<div className="barOverflow">
|
|
|
|
|
<div
|
|
|
|
|
className="bar"
|
|
|
|
|
style={{ transform: `rotate(${obj.value}deg)` }}
|
|
|
|
|
></div>
|
2025-03-31 19:53:54 +05:30
|
|
|
</div>
|
2025-03-31 18:22:40 +05:30
|
|
|
</div>
|
2025-03-31 19:54:21 +05:30
|
|
|
</div>
|
|
|
|
|
<div className="scaleLabels">
|
|
|
|
|
<span>0%</span>
|
|
|
|
|
<div className="centerText">
|
|
|
|
|
<div className="percentage">{obj.per}%</div>
|
|
|
|
|
<div className="status">Optimal</div>
|
2025-03-31 19:53:54 +05:30
|
|
|
</div>
|
2025-03-31 19:54:21 +05:30
|
|
|
<span>100%</span>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
onPointerMove={handlePointerMove}
|
|
|
|
|
onPointerUp={handlePointerUp}
|
|
|
|
|
className="floating-wrapper"
|
|
|
|
|
>
|
|
|
|
|
{zone.objects.map((obj, index) => (
|
|
|
|
|
<div
|
|
|
|
|
key={`${zoneName}-${index}`}
|
|
|
|
|
className={obj.className}
|
|
|
|
|
style={{
|
|
|
|
|
position: "absolute",
|
|
|
|
|
top:
|
|
|
|
|
typeof obj.position.top === "number"
|
|
|
|
|
? `${obj.position.top}px`
|
|
|
|
|
: "auto",
|
|
|
|
|
left:
|
|
|
|
|
typeof obj.position.left === "number"
|
|
|
|
|
? `${obj.position.left}px`
|
|
|
|
|
: "auto",
|
|
|
|
|
right:
|
|
|
|
|
typeof obj.position.right === "number"
|
|
|
|
|
? `${obj.position.right}px`
|
|
|
|
|
: "auto",
|
|
|
|
|
bottom:
|
|
|
|
|
typeof obj.position.bottom === "number"
|
|
|
|
|
? `${obj.position.bottom}px`
|
|
|
|
|
: "auto",
|
|
|
|
|
}}
|
|
|
|
|
onPointerDown={(event) => handlePointerDown(event, index)}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setSelectedChartId(obj)
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{obj.className === "floating total-card" ? (
|
|
|
|
|
<>
|
|
|
|
|
<TotalCardComponent object={obj} />
|
2025-03-29 19:21:20 +05:30
|
|
|
</>
|
2025-03-31 19:54:21 +05:30
|
|
|
) : obj.className === "warehouseThroughput floating" ? (
|
2025-03-29 19:21:20 +05:30
|
|
|
<>
|
2025-03-31 19:54:21 +05:30
|
|
|
<WarehouseThroughputComponent />
|
2025-03-29 19:21:20 +05:30
|
|
|
</>
|
2025-03-31 19:54:21 +05:30
|
|
|
) : obj.className === "fleetEfficiency floating" ? (
|
2025-03-29 19:21:20 +05:30
|
|
|
<>
|
2025-03-31 19:54:21 +05:30
|
|
|
<FleetEfficiencyComponent object={obj} />
|
2025-03-29 19:21:20 +05:30
|
|
|
</>
|
2025-03-31 19:54:21 +05:30
|
|
|
) : null}
|
2025-04-01 11:33:10 +05:30
|
|
|
{/* {renderObjectContent(obj)} */}
|
2025-03-31 18:22:40 +05:30
|
|
|
<div
|
2025-03-31 19:54:21 +05:30
|
|
|
className="icon kebab"
|
2025-04-01 11:33:10 +05:30
|
|
|
onClick={(event) => {
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
handleKebabClick(obj.id, event)
|
|
|
|
|
}}
|
2025-03-31 18:22:40 +05:30
|
|
|
>
|
2025-03-31 19:54:21 +05:30
|
|
|
<KebabIcon />
|
|
|
|
|
</div>
|
|
|
|
|
{openKebabId === obj.id && (
|
|
|
|
|
<div className="kebab-options">
|
|
|
|
|
<div className="dublicate btn" onClick={(event) => {
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
handleDuplicate(zoneName, index); // Call the duplicate handler
|
|
|
|
|
}}>
|
|
|
|
|
<div className="icon">
|
|
|
|
|
<DublicateIcon />
|
2025-03-27 18:04:16 +05:30
|
|
|
</div>
|
2025-03-31 19:54:21 +05:30
|
|
|
<div className="label">Duplicate</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="edit btn" onClick={(event) => {
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
handleDelete(zoneName, obj.id, index); // Call the delete handler
|
|
|
|
|
}}>
|
|
|
|
|
<div className="icon">
|
|
|
|
|
<DeleteIcon />
|
2025-03-27 18:04:16 +05:30
|
|
|
</div>
|
2025-03-31 19:54:21 +05:30
|
|
|
<div className="label">Delete</div>
|
2025-03-27 18:04:16 +05:30
|
|
|
</div>
|
2025-03-31 19:54:21 +05:30
|
|
|
</div>
|
2025-03-31 18:22:40 +05:30
|
|
|
)}
|
2025-03-31 19:54:21 +05:30
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
|
|
|
|
|
{/* Render DistanceLines component during drag */}
|
|
|
|
|
{draggingIndex !== null &&
|
|
|
|
|
activeEdges !== null &&
|
|
|
|
|
currentPosition !== null && (
|
|
|
|
|
<DistanceLines
|
|
|
|
|
obj={{
|
|
|
|
|
position: {
|
|
|
|
|
top:
|
|
|
|
|
currentPosition.top !== "auto"
|
|
|
|
|
? currentPosition.top
|
|
|
|
|
: undefined,
|
|
|
|
|
bottom:
|
|
|
|
|
currentPosition.bottom !== "auto"
|
|
|
|
|
? currentPosition.bottom
|
|
|
|
|
: undefined,
|
|
|
|
|
left:
|
|
|
|
|
currentPosition.left !== "auto"
|
|
|
|
|
? currentPosition.left
|
|
|
|
|
: undefined,
|
|
|
|
|
right:
|
|
|
|
|
currentPosition.right !== "auto"
|
|
|
|
|
? currentPosition.right
|
|
|
|
|
: undefined,
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
activeEdges={activeEdges}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
2025-03-27 12:28:17 +05:30
|
|
|
|
2025-03-27 18:04:16 +05:30
|
|
|
export default DroppedObjects;
|
2025-03-31 18:22:40 +05:30
|
|
|
|
2025-03-31 19:20:03 +05:30
|
|
|
|