Rename loadStore.js to readPoiMarkersStore.js
This commit is contained in:
@@ -573,7 +573,8 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
|
|
||||||
// Popup binden, aber nicht automatisch öffnen
|
// Popup binden, aber nicht automatisch öffnen
|
||||||
marker.bindPopup(
|
marker.bindPopup(
|
||||||
`<b>${location.description || "Unbekannt"}</b><br>Type: ${location.idPoiTyp || "N/A"}<br>Lat: ${latitude.toFixed(5)}, Lng: ${longitude.toFixed(5)}`
|
//N/A oder location.idPoiTyp=0 hier soll der Name von poiTyp Tabelle kommen, also foreign key
|
||||||
|
`<b>${location.description || "Unbekannt"}</b><br>Type: ${location.idPoiTyp || "N/A oder location.idPoiTyp=0"}<br>Lat: ${latitude.toFixed(5)}, Lng: ${longitude.toFixed(5)}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Event-Handler für Mouseover und Mouseout hinzufügen
|
// Event-Handler für Mouseover und Mouseout hinzufügen
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import { useRecoilValue } from "recoil";
|
import { useRecoilValue } from "recoil";
|
||||||
import { loadDataStore } from "../store/selectors/loadDataStore";
|
import { readPoiMarkersStore } from "../store/selectors/readPoiMarkersStore";
|
||||||
const ShowAddStationPopup = ({ map, latlng }) => {
|
const ShowAddStationPopup = ({ map, latlng }) => {
|
||||||
const loadData = useRecoilValue(loadDataStore);
|
const loadData = useRecoilValue(readPoiMarkersStore);
|
||||||
const [poiTypData2, setPoiTypData2] = useState(); // Recoil State verwenden
|
const [poiTypData2, setPoiTypData2] = useState(); // Recoil State verwenden
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [poiTypeId, setPoiTypeId] = useState(""); // Initialize as string
|
const [poiTypeId, setPoiTypeId] = useState(""); // Initialize as string
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { useSetRecoilState } from "recoil";
|
import { useSetRecoilState } from "recoil";
|
||||||
import { loadDataStore } from "../store/selectors/loadDataStore";
|
import { readPoiMarkersStore } from "../store/selectors/readPoiMarkersStore";
|
||||||
const MapComponentWithNoSSR = dynamic(
|
const MapComponentWithNoSSR = dynamic(
|
||||||
() => import("../components/MapComponent"),
|
() => import("../components/MapComponent"),
|
||||||
{ ssr: false }
|
{ ssr: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const setLoadData = useSetRecoilState(loadDataStore);
|
const setLoadData = useSetRecoilState(readPoiMarkersStore);
|
||||||
const [mParam, setMParam] = useState([""]);
|
const [mParam, setMParam] = useState([""]);
|
||||||
const [uParam, setUParam] = useState([""]);
|
const [uParam, setUParam] = useState([""]);
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { useSetRecoilState } from "recoil";
|
import { useSetRecoilState } from "recoil";
|
||||||
import { loadDataStore } from "../store/selectors/loadDataStore";
|
import { readPoiMarkersStore } from "../store/selectors/readPoiMarkersStore";
|
||||||
const MapComponentWithNoSSR = dynamic(
|
const MapComponentWithNoSSR = dynamic(
|
||||||
() => import("../components/MapComponent"),
|
() => import("../components/MapComponent"),
|
||||||
{ ssr: false }
|
{ ssr: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const setLoadData = useSetRecoilState(loadDataStore);
|
const setLoadData = useSetRecoilState(readPoiMarkersStore);
|
||||||
const [mParam, setMParam] = useState([""]);
|
const [mParam, setMParam] = useState([""]);
|
||||||
const [uParam, setUParam] = useState([""]);
|
const [uParam, setUParam] = useState([""]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// store/loadDataStore.js
|
// store/readPoiMarkersStore.js
|
||||||
import { atom } from "recoil";
|
import { atom } from "recoil";
|
||||||
|
|
||||||
export const loadDataStore = atom({
|
export const readPoiMarkersStore = atom({
|
||||||
key: "loadDataStore",
|
key: "readPoiMarkersStore",
|
||||||
default: async () => {
|
default: async () => {
|
||||||
const response = await fetch("/api/readLocations");
|
const response = await fetch("/api/readLocations");
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
Reference in New Issue
Block a user