diff --git a/.env.development b/.env.development index d14790f08..5b2977837 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.304 +NEXT_PUBLIC_APP_VERSION=1.1.305 diff --git a/.env.production b/.env.production index e3ca34d03..60bd23f7e 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.304 \ No newline at end of file +NEXT_PUBLIC_APP_VERSION=1.1.305 \ No newline at end of file diff --git a/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js b/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js index 89cd14c6c..4fbc75747 100644 --- a/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js +++ b/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js @@ -115,6 +115,22 @@ function MapLayersControlPanel() { Object.keys(parsedVisibility).forEach(key => { 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..."); + if (Array.isArray(GisSystemStatic)) { + const initialVisibility = {}; + GisSystemStatic.forEach(system => { + const visibility = system.Allow === 1; + initialVisibility[system.SystemName] = visibility; + dispatch(setLayerVisibility({ layer: system.SystemName, visibility })); + console.log( + `🎯 Setting ${system.SystemName} visibility to ${visibility} (Allow=${system.Allow})` + ); + }); + localStorage.setItem("mapLayersVisibility", JSON.stringify(initialVisibility)); + console.log("💾 Saved initial mapLayersVisibility to localStorage:", initialVisibility); + } } const storedEditMode = localStorage.getItem("editMode"); diff --git a/package-lock.json b/package-lock.json index 418d2c632..482923b63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nodemap", - "version": "1.1.304", + "version": "1.1.305", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nodemap", - "version": "1.1.304", + "version": "1.1.305", "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", diff --git a/package.json b/package.json index d31151198..b1e940d90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodemap", - "version": "1.1.304", + "version": "1.1.305", "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", diff --git a/redux/slices/mapLayersSlice.js b/redux/slices/mapLayersSlice.js index 1226e6966..686d3eacb 100644 --- a/redux/slices/mapLayersSlice.js +++ b/redux/slices/mapLayersSlice.js @@ -21,14 +21,14 @@ const mapLayersSlice = createSlice({ }, setInitialLayers: (state, action) => { const systems = action.payload; // Array of GisSystem - systems.forEach((system) => { + systems.forEach(system => { const key = `system-${system.IdSystem}`; - state[key] = true; // oder false, je nach Default + state[key] = system.Allow === 1; // true wenn Allow=1, false wenn Allow=0 }); }, }, }); export const { toggleLayer, setLayerVisibility, setInitialLayers } = mapLayersSlice.actions; -export const selectMapLayersState = (state) => state.mapLayers || initialState; +export const selectMapLayersState = state => state.mapLayers || initialState; export default mapLayersSlice.reducer; diff --git a/websocketDump/GisSystemStatic.json b/websocketDump/GisSystemStatic.json index 865786fb8..9aa0e2fd6 100644 --- a/websocketDump/GisSystemStatic.json +++ b/websocketDump/GisSystemStatic.json @@ -3,7 +3,7 @@ "IdSystem": 1, "Name": "TALAS", "Longname": "Talas Meldestationen", - "Allow": 1, + "Allow": 0, "Icon": 1 }, { @@ -66,7 +66,7 @@ "IdSystem": 11, "Name": "GMA", "Longname": "Glättemeldeanlagen", - "Allow": 0, + "Allow": 1, "Icon": 11 }, {