From d4ffe3aa0ea38ee23f3896ae22820c62f62b5aba Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 26 Apr 2024 14:49:30 +0200 Subject: [PATCH] =?UTF-8?q?Textinhalt=20der=20Dropdown-Option=20mit=20der?= =?UTF-8?q?=20Marker-Eigenschaft=20=C3=BCberein=20und=20Reinzoomen,=20funk?= =?UTF-8?q?tioniert=20noch=20nicht=20bei=20alle=20Dropdown-Elemente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/DataSheet.js | 21 +++++++++++++++------ components/MapComponent.js | 22 ++++++++++++++++++++++ config/config.js | 2 +- states/gisStationState.js | 7 ------- states/gisSystemState.js | 7 ------- states/mapLayersState.js | 24 ------------------------ store/selectedAreaState.js | 7 +++++++ 7 files changed, 45 insertions(+), 45 deletions(-) delete mode 100644 states/gisStationState.js delete mode 100644 states/gisSystemState.js delete mode 100644 states/mapLayersState.js create mode 100644 store/selectedAreaState.js diff --git a/components/DataSheet.js b/components/DataSheet.js index 429e88066..80fd00779 100644 --- a/components/DataSheet.js +++ b/components/DataSheet.js @@ -1,10 +1,13 @@ +//components/DataSheet.js import React, { useEffect, useState } from "react"; -import { useRecoilState, useRecoilValue } from "recoil"; +import { useRecoilState, useRecoilValue, useSetRecoilState } from "recoil"; import { gisStationsStaticDistrictState } from "../store/gisStationState"; import { gisSystemStaticState } from "../store/gisSystemState"; import { mapLayersState } from "../store/mapLayersState"; +import { selectedAreaState } from "../store/selectedAreaState"; function DataSheet() { + const setSelectedArea = useSetRecoilState(selectedAreaState); const [mapLayersVisibility, setMapLayersVisibility] = useRecoilState(mapLayersState); const [stationListing, setStationListing] = useState([]); @@ -13,6 +16,14 @@ function DataSheet() { gisStationsStaticDistrictState ); const GisSystemStatic = useRecoilValue(gisSystemStaticState); + // In deiner Dropdown onChange Funktion + const handleAreaChange = (event) => { + const selectedIndex = event.target.options.selectedIndex; + const areaName = event.target.options[selectedIndex].text; + setSelectedArea(areaName); + console.log("Area selected oder areaName in DataSheet.js:", areaName); // Nur zur Bestätigung in der Konsole + console.log("event.target:", event.target); + }; useEffect(() => { // Identify allowed system IDs @@ -29,11 +40,11 @@ function DataSheet() { !seenNames.has(item.Area_Name) && allowedSystems.has(item.System); if (isUnique) { seenNames.add(item.Area_Name); - console.log("Unique area:", item.Area_Name); + //console.log("Unique area:", item.Area_Name); } return isUnique; }); - console.log("GisStationsStaticDistrict:", GisStationsStaticDistrict); + //console.log("GisStationsStaticDistrict:", GisStationsStaticDistrict); // Set the station listings setStationListing( @@ -77,9 +88,7 @@ function DataSheet() {