diff --git a/.env.development b/.env.development index 51e62e442..c2138dc69 100644 --- a/.env.development +++ b/.env.development @@ -25,4 +25,4 @@ NEXT_PUBLIC_USE_MOCKS=true NEXT_PUBLIC_BASE_PATH=/talas5 # Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH= # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.1.312 +NEXT_PUBLIC_APP_VERSION=1.1.313 diff --git a/.env.production b/.env.production index 2a812a925..b382fa16f 100644 --- a/.env.production +++ b/.env.production @@ -26,4 +26,4 @@ NEXT_PUBLIC_BASE_PATH=/talas5 # Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH= # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.1.312 +NEXT_PUBLIC_APP_VERSION=1.1.313 diff --git a/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js b/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js index 5cea2371d..f10b87907 100644 --- a/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js +++ b/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js @@ -31,7 +31,7 @@ function MapLayersControlPanel() { console.log("🎯 kabelstreckenVisible state changed to:", kabelstreckenVisible); }, [kabelstreckenVisible]); - // Prüfen, ob TALAS (IdSystem 1) erlaubt ist + // Prüfen, ob TALAS (IdSystem 1) erlaubt & sichtbar auf Karte (Allow + Map) const isTalasAllowed = Array.isArray(GisSystemStatic) ? GisSystemStatic.some( system => system.IdSystem === 1 && system.Allow === 1 && system.Map === 1 @@ -134,18 +134,23 @@ function MapLayersControlPanel() { dispatch(setLayerVisibility({ layer: key, visibility: parsedVisibility[key] })); }); } else { - // Initialisiere mapLayersVisibility basierend auf GisSystemStatic Allow-Werten - console.log("🚀 No stored mapLayersVisibility found, initializing based on Allow values..."); + // Initialisiere mapLayersVisibility basierend auf Allow & Map (nur Systeme mit Map===1 anzeigen) + console.log( + "🚀 No stored mapLayersVisibility found, initializing based on Allow && Map values..." + ); if (Array.isArray(GisSystemStatic)) { const initialVisibility = {}; GisSystemStatic.forEach(system => { const systemKey = `system-${system.IdSystem}`; - const visibility = system.Allow === 1; - initialVisibility[systemKey] = visibility; - dispatch(setLayerVisibility({ layer: systemKey, visibility })); - console.log( - `🎯 Setting ${systemKey} (${system.Name}) visibility to ${visibility} (Allow=${system.Allow})` - ); + const visibility = system.Allow === 1 && system.Map === 1; // <— angepasst + if (visibility) { + // nur speichern wenn grundsätzlich sichtbar + initialVisibility[systemKey] = visibility; + dispatch(setLayerVisibility({ layer: systemKey, visibility })); + console.log( + `🎯 Setting ${systemKey} (${system.Name}) visibility to ${visibility} (Allow=${system.Allow}, Map=${system.Map})` + ); + } }); localStorage.setItem(mapStorageKey, JSON.stringify(initialVisibility)); console.log(`💾 Saved initial mapLayersVisibility to ${mapStorageKey}:`, initialVisibility); @@ -159,9 +164,6 @@ function MapLayersControlPanel() { setLocalStorageLoaded(true); }, []); // Läuft nur beim Mount - // Entferne den komplexen Konsistenz-Check useEffect - nicht mehr nötig - // da wir direkt mit localStorage arbeiten - const handleAreaChange = event => { const selectedIndex = event.target.options.selectedIndex; const areaName = event.target.options[selectedIndex].text; @@ -169,8 +171,13 @@ function MapLayersControlPanel() { }; useEffect(() => { + // Allowed systems jetzt nach Allow && Map filtern const allowedSystems = Array.isArray(GisSystemStatic) - ? new Set(GisSystemStatic.filter(system => system.Allow === 1).map(system => system.IdSystem)) + ? new Set( + GisSystemStatic.filter(system => system.Allow === 1 && system.Map === 1).map( + system => system.IdSystem + ) + ) : new Set(); const seenNames = new Set(); @@ -194,7 +201,7 @@ function MapLayersControlPanel() { const seenSystemNames = new Set(); const filteredSystems = Array.isArray(GisSystemStatic) ? GisSystemStatic.filter(item => { - const isUnique = !seenSystemNames.has(item.Name) && item.Allow === 1; + const isUnique = !seenSystemNames.has(item.Name) && item.Allow === 1 && item.Map === 1; // <— Map Bedingung hinzugefügt if (isUnique) { seenSystemNames.add(item.Name); } @@ -205,8 +212,8 @@ function MapLayersControlPanel() { setSystemListing( filteredSystems.map((system, index) => ({ id: index + 1, - name: system.Name, // Verwende den Originalnamen für die Anzeige - key: `system-${system.IdSystem}`, // Internen Schlüssel für die MapLayersVisibility-Logik + name: system.Name, // Anzeige + key: `system-${system.IdSystem}`, // interner Schlüssel })) ); }, [GisStationsStaticDistrict, GisSystemStatic]); @@ -328,13 +335,14 @@ function MapLayersControlPanel() { style={{ minWidth: "150px", maxWidth: "200px" }} > - {[ + {/* ...new Map( (GisStationsStaticDistrict.Points || []) .filter(p => !!p.Area_Name) .map(p => [p.Area_Name, p]) ).values(), - ].map((item, index) => ( + */} + {GisStationsStaticDistrict.Points.filter(p => !!p.Area_Name).map((item, index) => ( @@ -399,25 +407,6 @@ function MapLayersControlPanel() { POIs - - {/* Areas -