diff --git a/apps/dispatch/app/dispatch/_components/map/ContextMenu.tsx b/apps/dispatch/app/dispatch/_components/map/ContextMenu.tsx index e8247ef0..401614f6 100644 --- a/apps/dispatch/app/dispatch/_components/map/ContextMenu.tsx +++ b/apps/dispatch/app/dispatch/_components/map/ContextMenu.tsx @@ -2,8 +2,16 @@ import { OSMWay } from "@repo/db"; import { useMapStore } from "_store/mapStore"; import { usePannelStore } from "_store/pannelStore"; -import { MapPinned, Search } from "lucide-react"; -import { useEffect } from "react"; +import { + MapPin, + MapPinned, + Radius, + Ruler, + Search, + RulerDimensionLine, + Scan, +} from "lucide-react"; +import { useEffect, useState } from "react"; import { Popup, useMap } from "react-leaflet"; export const ContextMenu = () => { @@ -11,11 +19,19 @@ export const ContextMenu = () => { const { contextMenu, setContextMenu, setSearchElements, setSearchPopup } = useMapStore(); const { setMissionFormValues, setOpen } = usePannelStore((state) => state); + const [showRulerOptions, setShowRulerOptions] = useState(false); + const [rulerHover, setRulerHover] = useState(false); + const [rulerOptionsHover, setRulerOptionsHover] = useState(false); + + useEffect(() => { + setShowRulerOptions(rulerHover || rulerOptionsHover); + }, [rulerHover, rulerOptionsHover]); + useEffect(() => { const handleContextMenu = (e: any) => { setContextMenu({ lat: e.latlng.lat, lng: e.latlng.lng }); }; - const handleClick = (e: any) => { + const handleClick = () => { setContextMenu(null); setSearchPopup(null); }; @@ -27,7 +43,7 @@ export const ContextMenu = () => { map.off("contextmenu", handleContextMenu); map.off("click", handleClick); }; - }, [contextMenu]); + }, [map, contextMenu, setContextMenu, setSearchPopup]); if (!contextMenu) return null; @@ -76,86 +92,242 @@ export const ContextMenu = () => { autoPan={false} > {/* // TODO: maske: */} -
- - + setOpen(true); + setMissionFormValues({ + addressLat: contextMenu.lat, + addressLng: contextMenu.lng, + addressCity: data.address.city || data.address.town, + addressStreet: `${data.address.road}, ${data.address.house_number || "keine HN"}`, + addressZip: data.address.postcode, + state: "draft", + addressOSMways: [(exactAddress || closestToContext) as any], + }); + }} + > + + + {/* Left Button */} + + {/* Bottom Button */} + + {/* Right Button (original Search button) */} + + {/* Ruler Options - shown when Ruler button is hovered or options are hovered */} + {showRulerOptions && ( +
setRulerOptionsHover(true)} + onMouseLeave={() => setRulerOptionsHover(false)} + > +
+ + + +
+
+ )} +
); diff --git a/apps/dispatch/package.json b/apps/dispatch/package.json index 117864a5..802a889f 100644 --- a/apps/dispatch/package.json +++ b/apps/dispatch/package.json @@ -22,7 +22,7 @@ "leaflet": "^1.9.4", "livekit-client": "^2.9.7", "livekit-server-sdk": "^2.10.2", - "lucide-react": "^0.482.0", + "lucide-react": "^0.511.0", "next": "^15.1.0", "next-auth": "^4.24.11", "postcss": "^8.5.1", diff --git a/package-lock.json b/package-lock.json index c3712661..19c28091 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "leaflet": "^1.9.4", "livekit-client": "^2.9.7", "livekit-server-sdk": "^2.10.2", - "lucide-react": "^0.482.0", + "lucide-react": "^0.511.0", "next": "^15.1.0", "next-auth": "^4.24.11", "postcss": "^8.5.1", @@ -83,9 +83,9 @@ } }, "apps/dispatch/node_modules/lucide-react": { - "version": "0.482.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.482.0.tgz", - "integrity": "sha512-XM8PzHzSrg8ATmmO+fzf+JyYlVVdQnJjuyLDj2p4V2zEtcKeBNAqAoJIGFv1x2HSBa7kT8gpYUxwdQ0g7nypfw==", + "version": "0.511.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.511.0.tgz", + "integrity": "sha512-VK5a2ydJ7xm8GvBeKLS9mu1pVK6ucef9780JVUjw6bAjJL/QXnd4Y0p7SPeOUMC27YhzNCZvm5d/QX0Tp3rc0w==", "license": "ISC", "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"