Debug-Logging zentralisiert: Nutzung von process.env.NEXT_PUBLIC_DEBUG_LOG entfernt und auf getDebugLog() mit config.json umgestellt

- Alle Vorkommen von process.env.NEXT_PUBLIC_DEBUG_LOG entfernt
- Debug-Konfiguration erfolgt jetzt ausschließlich über public/config.json
- getDebugLog()-Utility überall verwendet
- .env-Dateien werden für Debug-Logging nicht mehr benötigt
- Alle betroffenen Komponenten, Services und API
This commit is contained in:
ISA
2025-08-22 11:10:40 +02:00
parent a013c07394
commit 3896381a8f
27 changed files with 94 additions and 84 deletions

View File

@@ -7,7 +7,6 @@ DB_NAME=talas_v5
DB_PORT=3306
# Public Settings (Client braucht IP/Domain) , Variablen mit dem Präfix "NEXT_PUBLIC" ist in Browser sichtbar
NEXT_PUBLIC_DEBUG_LOG=true
@@ -24,4 +23,4 @@ NEXT_PUBLIC_USE_MOCKS=true
# z.B. http://10.10.0.13/xyz/index.aspx -> basePath in config.json auf /xyz setzen
# basePath wird jetzt in public/config.json gepflegt
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.1.343
NEXT_PUBLIC_APP_VERSION=1.1.344

View File

@@ -7,7 +7,6 @@ DB_NAME=talas_v5
DB_PORT=3306
# Public Settings (Client braucht IP/Domain) , Variablen mit dem Präfix "NEXT_PUBLIC" ist in Browser sichtbar
NEXT_PUBLIC_DEBUG_LOG=false
@@ -25,4 +24,4 @@ NEXT_PUBLIC_USE_MOCKS=false
# basePath wird jetzt in public/config.json gepflegt
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.1.343
NEXT_PUBLIC_APP_VERSION=1.1.344

View File

@@ -1,3 +1,4 @@
import { getDebugLog } from "@/utils/configUtils.js";
// /hooks/layers/useAreaMarkersLayer.js
import { useEffect, useState, useRef } from "react";
import L from "leaflet";
@@ -100,7 +101,7 @@ const useAreaMarkersLayer = (map, oms, apiUrl, onUpdateSuccess) => {
newCoords: { x: lat, y: lng },
})
).unwrap();
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("✔️ Koordinaten erfolgreich aktualisiert:", { lat, lng });
}
onUpdateSuccess?.(); // optionaler Callback

View File

@@ -1,3 +1,4 @@
import { getDebugLog } from "@/utils/configUtils.js";
// components/contextmenu/useMapContextMenu.js
import { toast } from "react-toastify";
import { zoomIn, zoomOut, centerHere } from "../../utils/zoomAndCenterUtils";
@@ -71,7 +72,7 @@ const addItemsToMapContextMenu = (
if (!menuItemAdded && map && map.contextmenu) {
const editMode = localStorage.getItem("editMode") === "true";
if (editMode) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("editMode localStorage:", localStorage.getItem("editMode"));
}

View File

@@ -88,6 +88,7 @@ import { monitorHeapWithRedux } from "@/utils/common/monitorMemory";
import { io } from "socket.io-client";
import { setGisStationsStaticDistrict } from "@/redux/slices/webservice/gisStationsStaticDistrictSlice.js";
import { getDebugLog } from "../../utils/configUtils";
//-----------------------------------------------------------------------------------------------------
const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//-------------------------------
@@ -509,7 +510,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//Test in useEffect
useEffect(() => {
if (map) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🗺️ Map-Einstellungen werden wiederhergestellt...");
}
restoreMapSettings(map);
@@ -518,7 +519,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//--------------------------------------------
useEffect(() => {
if (map) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("map in MapComponent: ", map);
}
const handleMapMoveEnd = event => {
@@ -551,7 +552,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const station = points.find(s => s.Area_Name === selectedArea);
if (station) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("📌 Gefundene Station:", station);
}
map.flyTo([station.X, station.Y], 14);
@@ -597,7 +598,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//--------------------------------------------
useEffect(() => {
if (map) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("6- Karteninstanz (map) wurde jetzt erfolgreich initialisiert");
}
}
@@ -610,7 +611,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
map.whenReady(() => {
timeoutId = setTimeout(() => {
if (map.contextmenu) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Contextmenu ist vorhanden");
}
} else {
@@ -641,7 +642,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const handleLocationUpdate = async (idLocation, idMap, newCoords) => {
try {
await dispatch(updateAreaThunk({ idLocation, idMap, newCoords })).unwrap();
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Koordinaten erfolgreich aktualisiert:", result);
}
} catch (error) {
@@ -810,7 +811,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
// console.log(`⏳ Redux Countdown: ${countdown} Sekunden`);
if (countdown <= 2) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🚀 Kontextmenü wird wegen Countdown < 2 geschlossen.");
}
dispatch(closePolylineContextMenu());

View File

@@ -1,4 +1,5 @@
// /components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js
import { getDebugLog } from "../../../utils/configUtils";
import React, { useEffect, useState } from "react";
import { setSelectedArea } from "@/redux/slices/selectedAreaSlice";
import EditModeToggle from "@/components/uiWidgets/mapLayersControlPanel/EditModeToggle";
@@ -218,7 +219,7 @@ function MapLayersControlPanel() {
//------------------------------
useEffect(() => {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
window.__debug = window.__debug || {};
window.__debug.gisStations = GisStationsStaticDistrict;
}
@@ -250,7 +251,7 @@ function MapLayersControlPanel() {
}
return isUnique;
});
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("📌 stationListing aktualisiert:", filteredAreas);
}
}, [GisStationsStaticDistrict, GisSystemStatic]);

View File

@@ -6,10 +6,6 @@ DB_PASSWORD="root#$"
DB_NAME=talas_v5
DB_PORT=3306
# Public Settings (Client braucht IP/Domain) , Variablen mit dem Präfix "NEXT_PUBLIC" ist in Browser sichtbar
NEXT_PUBLIC_DEBUG_LOG=false
#auf dem Entwicklungsrechner dev läuft auf Port 3000 und auf dem Server prod auf Port 80, aber der WebService ist immer auf PORT 80
NEXT_PUBLIC_API_PORT_MODE=prod

View File

@@ -1,4 +1,5 @@
import L from "leaflet";
import { getDebugLog } from "../utils/configUtils";
export class OverlappingMarkerSpiderfier {
constructor(map, options = {}) {
@@ -118,7 +119,7 @@ export class OverlappingMarkerSpiderfier {
// 🔥 Künstliches Click-Event auslösen, um die UI zu aktualisieren
setTimeout(() => {
this.map.fire("click");
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Click-Event ausgelöst in OverlappingMarkerspiderfier.js in unspiderfy ");
}
}, 10); // Kurze Verzögerung, um sicherzustellen, dass die UI neu gerendert wird

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "nodemap",
"version": "1.1.343",
"version": "1.1.344",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "nodemap",
"version": "1.1.343",
"version": "1.1.344",
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",

View File

@@ -1,6 +1,6 @@
{
"name": "nodemap",
"version": "1.1.343",
"version": "1.1.344",
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",

View File

@@ -1,8 +1,9 @@
// /pages/api/talas_v5_DB/area/updateArea.js
import getPool from "../../../../utils/mysqlPool";
import { getDebugLog } from "../../../../utils/configUtils";
export default async function handler(req, res) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Request erhalten:", req.method, req.body); // Debugging
}

View File

@@ -1,5 +1,6 @@
// /pages/api/talas_v5_DB/gisLines/updateLineCoordinates.js
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
import { getDebugLog } from "../../../../utils/configUtils";
export default async function handler(req, res) {
const pool = getPool(); // Singleton-Pool verwenden
@@ -34,7 +35,7 @@ export default async function handler(req, res) {
// Commit der Transaktion
await connection.commit();
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Transaction Complete.");
}
res.status(200).json({

View File

@@ -1,12 +1,13 @@
// pages/api/talas_v5_DB/pois/addPoi.js
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
import { getDebugLog } from "../../../../utils/configUtils";
export default async function handler(req, res) {
const pool = getPool(); // Singleton-Pool verwenden
if (req.method === "POST") {
const { name, poiTypeId, latitude, longitude, idLD } = req.body;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Received data:", req.body); // Überprüfen der empfangenen Daten
}

View File

@@ -28,5 +28,7 @@
"_comment_zoomOutCenter": "Zielkoordinaten für Herauszoomen (lat, lng)",
"basePath": "/talas5",
"_comment_basePath": "Basis-URL für API und Routing"
"_comment_basePath": "Basis-URL für API und Routing",
"debugLog": false,
"_comment_debugLog": "Debug-Logging für Client "
}

View File

@@ -1,3 +1,4 @@
import { getDebugLog } from "../../utils/configUtils";
// /services/webservice/fetchGisLinesStatusService.js
let __configCache;
async function getConfig() {
@@ -16,7 +17,7 @@ export const fetchGisLinesStatusService = async () => {
if (useMocks) {
const mockBasePath = "/api/mocks/webservice/gisLinesStatus";
const mockURL = `${window.location.origin}${mockBasePath}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🧪 Mock-Modus aktiviert: fetchGisLinesStatusService ", mockURL);
}
@@ -37,7 +38,7 @@ export const fetchGisLinesStatusService = async () => {
const idMap = params.get("m");
const url = `${baseUrl}/GisLinesStatus?idMap=${idMap}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("📡 fetchGisLinesStatusService URL:", url);
}

View File

@@ -1,3 +1,4 @@
import { getDebugLog } from "../../utils/configUtils";
let __configCache;
async function getConfig() {
if (__configCache) return __configCache;
@@ -15,7 +16,7 @@ export const fetchGisStationsMeasurementsService = async () => {
if (useMocks) {
const mockBasePath = "/api/mocks/webservice/gisStationsMeasurements";
const mockURL = `${window.location.origin}${mockBasePath}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsMeasurementsService ", mockURL);
}
@@ -38,7 +39,7 @@ export const fetchGisStationsMeasurementsService = async () => {
const idUser = params.get("u");
const url = `${baseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("📡 fetchGisStationsMeasurementsService URL:", url);
}

View File

@@ -5,14 +5,8 @@
* @returns {Promise<Array>} Liste mit Points[]
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
*/
let __configCache;
async function getConfig() {
if (__configCache) return __configCache;
const res = await fetch("/config.json");
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
__configCache = await res.json();
return __configCache;
}
import { getDebugLog, getConfig } from "../../utils/configUtils";
export const fetchGisStationsStaticDistrictService = async () => {
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
@@ -22,7 +16,7 @@ export const fetchGisStationsStaticDistrictService = async () => {
if (useMocks) {
const mockBasePath = "/api/mocks/webservice/gisStationsStaticDistrict";
const mockURL = `${window.location.origin}${mockBasePath}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStaticDistrictService ", mockURL);
}
@@ -45,7 +39,7 @@ export const fetchGisStationsStaticDistrictService = async () => {
const idUser = params.get("u");
const url = `${baseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("📡 fetchGisStationsStaticDistrictService URL:", url);
}

View File

@@ -5,14 +5,8 @@
* @returns {Promise<Array>} Liste mit Statis[]
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
*/
let __configCache;
async function getConfig() {
if (__configCache) return __configCache;
const res = await fetch("/config.json");
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
__configCache = await res.json();
return __configCache;
}
import { getDebugLog, getConfig } from "../../utils/configUtils";
export const fetchGisStationsStatusDistrictService = async () => {
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
@@ -22,7 +16,7 @@ export const fetchGisStationsStatusDistrictService = async () => {
if (useMocks) {
const mockBasePath = "/api/mocks/webservice/gisStationsStatusDistrict";
const mockURL = `${window.location.origin}${mockBasePath}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStatusDistrictService ", mockURL);
}
@@ -45,7 +39,7 @@ export const fetchGisStationsStatusDistrictService = async () => {
const idUser = params.get("u");
const url = `${baseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("📡 fetchGisStationsStatusDistrictService URL:", url);
}

View File

@@ -4,14 +4,8 @@
* @returns {Promise<Array>} Liste mit Systems[]
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
*/
let __configCache;
async function getConfig() {
if (__configCache) return __configCache;
const res = await fetch("/config.json");
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
__configCache = await res.json();
return __configCache;
}
import { getDebugLog, getConfig } from "../../utils/configUtils";
export const fetchGisSystemStaticService = async () => {
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
@@ -21,7 +15,7 @@ export const fetchGisSystemStaticService = async () => {
if (useMocks) {
const mockBasePath = "/api/mocks/webservice/gisSystemStatic";
const mockURL = `${window.location.origin}${mockBasePath}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🧪 Mock-Modus aktiviert: fetchGisSystemStaticService ", mockURL);
}
@@ -44,7 +38,7 @@ export const fetchGisSystemStaticService = async () => {
const idUser = params.get("u");
const url = `${baseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("📡 fetchGisSystemStaticService von service URL:", url);
}

View File

@@ -4,14 +4,8 @@
* @returns {Promise<Array>} Rechte-Array
* @throws {Error} bei Lade- oder Strukturfehler
*/
let __configCache;
async function getConfig() {
if (__configCache) return __configCache;
const res = await fetch("/config.json");
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
__configCache = await res.json();
return __configCache;
}
import { getDebugLog, getConfig } from "../../utils/configUtils";
export const fetchUserRightsService = async () => {
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
@@ -21,7 +15,7 @@ export const fetchUserRightsService = async () => {
if (useMocks) {
const mockBasePath = "/api/mocks/webservice/gisSystemStatic";
const mockURL = `${window.location.origin}${mockBasePath}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🧪 Mock-Modus aktiviert: fetchUserRightsService ", mockURL);
}
@@ -40,7 +34,7 @@ export const fetchUserRightsService = async () => {
const idUser = params.get("u");
const url = `${baseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🔍 Rechte-Fetch URL:", url);
}
@@ -56,7 +50,7 @@ export const fetchUserRightsService = async () => {
}
const json = await response.json();
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("👤 Rechte-Response JSON:", json);
}

26
utils/configUtils.js Normal file
View File

@@ -0,0 +1,26 @@
// utils/configUtils.js
let __configCache;
export async function getConfig() {
if (__configCache) return __configCache;
const res = await fetch("/config.json");
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
__configCache = await res.json();
return __configCache;
}
// Sync helper for debugLog (for use in event handlers etc.)
let debugLogValue;
export function getDebugLog() {
if (debugLogValue !== undefined) return debugLogValue;
// Try to read from window.__appConfig if available (set at app start)
if (
typeof window !== "undefined" &&
window.__appConfig &&
typeof window.__appConfig.debugLog !== "undefined"
) {
debugLogValue = !!window.__appConfig.debugLog;
return debugLogValue;
}
// Fallback: default false
return false;
}

View File

@@ -62,7 +62,7 @@ export const checkOverlappingMarkers = (map, markers, plusIcon, oms) => {
export const handlePlusIconClick = (map, markers, oms, clickedLatLng) => {
// Debugging-Ausgabe
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Plus-Icon Position:", clickedLatLng);
}
@@ -72,7 +72,7 @@ export const handlePlusIconClick = (map, markers, oms, clickedLatLng) => {
);
// Debugging-Ausgabe
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Gefundene Marker in der Nähe:", nearbyMarkers);
}
@@ -80,7 +80,7 @@ export const handlePlusIconClick = (map, markers, oms, clickedLatLng) => {
// Spiderfy die gefundenen Marker
oms.spiderfy(nearbyMarkers);
} else {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Keine überlappenden Marker gefunden.");
}
}

View File

@@ -26,12 +26,12 @@ function getPool() {
cachedPool.on("acquire", () => {
connectionCount++;
if (process.env.NODE_ENV === "development") {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("\x1b[36m%s\x1b[0m", ` Connection acquired (${connectionCount} total)`);
}
if (connectionCount > maxUsed) {
maxUsed = connectionCount;
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log(`📈 Neue Höchstzahl aktiver gleichzeitiger Verbindungen: ${maxUsed}`);
}
}
@@ -40,7 +40,7 @@ function getPool() {
cachedPool.on("release", () => {
connectionCount--;
if (process.env.NODE_ENV === "development") {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("\x1b[32m%s\x1b[0m", ` Connection released (${connectionCount} total)`);
}
}
@@ -48,7 +48,7 @@ function getPool() {
cachedPool.on("enqueue", () => {
if (process.env.NODE_ENV === "development") {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.warn("\x1b[33m%s\x1b[0m", "⏳ Pool voll Anfrage in Warteschlange");
}
}

View File

@@ -30,7 +30,7 @@ export async function openInNewTab(e, target) {
}
if (link) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🟢 Öffne Link:", link);
}
window.open(link, "_blank");

View File

@@ -6,7 +6,7 @@ export function subscribeToPolylineContextMenu() {
store.subscribe(() => {
const state = store.getState(); // Redux-Toolkit empfohlene Methode
if (state.polylineContextMenu.forceClose) {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("🚀 Redux-Event erkannt - Kontextmenü wird geschlossen.");
}
store.dispatch(closePolylineContextMenu());

View File

@@ -113,7 +113,7 @@ export const setupPolylines = async (
.dispatch(updatePolylineCoordinatesThunk(requestData))
.unwrap()
.then(data => {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("Koordinaten erfolgreich aktualisiert:", data);
}
})

View File

@@ -1,17 +1,19 @@
// utils/setupDevices.js
import { setSelectedDevice, clearSelectedDevice } from "../redux/slices/selectedDeviceSlice";
import { getDebugLog } from "./configUtils";
export const setupDevices = async (map, deviceMarkers, dispatch) => {
for (const marker of deviceMarkers) {
marker.on("mouseover", function () {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("✅ Gerät ausgewählt:", marker);
}
dispatch(setSelectedDevice(marker.options)); // Gerät in Redux speichern
});
marker.on("mouseout", function () {
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
if (getDebugLog()) {
console.log("❌ Gerät abgewählt");
}
dispatch(clearSelectedDevice()); // Gerät aus Redux entfernen