refactor: GIS-Redux-Slices reduziert auf 4 (statt 5) – veraltete Slices und Thunks entfernt, Code bereinigt
This commit is contained in:
@@ -5,9 +5,6 @@ import EditModeToggle from "./EditModeToggle";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { selectPolylineVisible, setPolylineVisible } from "../redux/slices/polylineLayerVisibleSlice";
|
||||
import { selectGisSystemStatic } from "../redux/slices/webService/gisSystemStaticSlice";
|
||||
import { fetchGisStationsStatic } from "../redux/slices/webService/gisStationsStaticSlice";
|
||||
|
||||
import { selectGisStationsStatic } from "../redux/slices/webService/gisStationsStaticSlice";
|
||||
import { selectGisStationsStaticDistrict } from "../redux/slices/webService/gisStationsStaticDistrictSlice";
|
||||
import { selectMapLayersState, setLayerVisibility } from "../redux/slices/mapLayersSlice";
|
||||
import { setVisible } from "../redux/slices/poiLayerVisibleSlice";
|
||||
@@ -23,7 +20,6 @@ function DataSheet() {
|
||||
const [systemListing, setSystemListing] = useState([]);
|
||||
const GisStationsStaticDistrict = useSelector(selectGisStationsStaticDistrict) || [];
|
||||
const GisSystemStatic = useSelector(selectGisSystemStatic) || [];
|
||||
const GisStationsStatic = useSelector(selectGisStationsStatic) || []; //Area-Name/Bereiche dropdownmenu
|
||||
|
||||
const polylineVisible = useSelector(selectPolylineVisible);
|
||||
|
||||
@@ -38,9 +34,6 @@ function DataSheet() {
|
||||
}
|
||||
};
|
||||
|
||||
const [bereicheVisible, setBereicheVisible] = useState(false); // NEU: Bereiche-Status
|
||||
const [standordVisible, setStandorteVisible] = useState(false); // NEU: Standorte-Status
|
||||
|
||||
useEffect(() => {
|
||||
// LocalStorage Werte laden
|
||||
const storedPoiVisible = localStorage.getItem("poiVisible");
|
||||
@@ -111,7 +104,7 @@ function DataSheet() {
|
||||
key: system.Name.replace(/[\s\-]+/g, ""), // Internen Schlüssel für die MapLayersVisibility-Logik
|
||||
}))
|
||||
);
|
||||
}, [GisStationsStaticDistrict, GisSystemStatic]);
|
||||
}, [GisStationsStaticDistrict]);
|
||||
|
||||
const handleCheckboxChange = (key, event) => {
|
||||
if (editMode) return;
|
||||
@@ -137,52 +130,27 @@ function DataSheet() {
|
||||
dispatch(incrementZoomTrigger());
|
||||
};
|
||||
|
||||
//---------------------------
|
||||
const handleBereicheCheckboxChange = (event) => {
|
||||
if (editMode) return;
|
||||
const { checked } = event.target;
|
||||
setBereicheVisible(checked);
|
||||
localStorage.setItem("bereicheVisible", checked);
|
||||
};
|
||||
const handleStandorteCheckboxChange = (event) => {
|
||||
if (editMode) return;
|
||||
const { checked } = event.target;
|
||||
setStandorteVisible(checked);
|
||||
localStorage.setItem("standorteVisible", checked);
|
||||
};
|
||||
//------------------------------
|
||||
useEffect(() => {
|
||||
// console.log("GisSystemStatic aus Redux:", GisSystemStatic); // ✅ Debugging: Ist es ein Array?
|
||||
}, [GisSystemStatic]);
|
||||
//-----------------------------
|
||||
console.log("🔍 GisStationsStaticDistrict Inhalt:", GisStationsStaticDistrict);
|
||||
|
||||
useEffect(() => {
|
||||
if (!GisStationsStatic || GisStationsStatic === null) {
|
||||
dispatch(fetchGisStationsStatic());
|
||||
}
|
||||
}, [GisStationsStatic, dispatch]);
|
||||
|
||||
//---------------------------
|
||||
useEffect(() => {
|
||||
console.log("🔍 GisStationsStatic Inhalt:", GisStationsStatic);
|
||||
|
||||
if (!GisStationsStatic) {
|
||||
console.warn("⚠️ GisStationsStatic ist `null` oder nicht geladen.");
|
||||
if (!GisStationsStaticDistrict) {
|
||||
console.warn("⚠️ GisStationsStaticDistrict ist `null` oder nicht geladen.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof GisStationsStatic !== "object") {
|
||||
console.warn("⚠️ GisStationsStatic ist kein Objekt:", GisStationsStatic);
|
||||
if (typeof GisStationsStaticDistrict !== "object") {
|
||||
console.warn("⚠️ GisStationsStaticDistrict ist kein Objekt:", GisStationsStaticDistrict);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GisStationsStatic.Points || !Array.isArray(GisStationsStatic.Points)) {
|
||||
console.warn("⚠️ GisStationsStatic.Points ist nicht vorhanden oder kein Array.", GisStationsStatic);
|
||||
if (!GisStationsStaticDistrict.Points || !Array.isArray(GisStationsStaticDistrict.Points)) {
|
||||
console.warn("⚠️ GisStationsStaticDistrict.Points ist nicht vorhanden oder kein Array.", GisStationsStaticDistrict);
|
||||
return;
|
||||
}
|
||||
|
||||
const seenNames = new Set();
|
||||
const filteredAreas = GisStationsStatic.Points.filter((item) => {
|
||||
const filteredAreas = GisStationsStaticDistrict.Points.filter((item) => {
|
||||
if (!item.Area_Name) return false; // Sicherstellen, dass Area_Name existiert
|
||||
const isUnique = !seenNames.has(item.Area_Name);
|
||||
if (isUnique) {
|
||||
@@ -199,7 +167,7 @@ function DataSheet() {
|
||||
);
|
||||
|
||||
console.log("📌 stationListing aktualisiert:", filteredAreas);
|
||||
}, [GisStationsStatic]);
|
||||
}, [GisStationsStaticDistrict]);
|
||||
|
||||
//---------------------------
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user