WIP: POI->contextmenu ->POI bearbeiten ->Gerät: Dropdown

This commit is contained in:
Ismail Ali
2025-03-07 18:13:09 +01:00
parent f98ee107aa
commit 5a27bc5d75
11 changed files with 82 additions and 44 deletions

View File

@@ -1,26 +1,17 @@
// components/pois/PoiUpdateModalWrapper.js
import React, { useState } from "react";
import PoiUpdateModal from "./PoiUpdateModal";
import { useRecoilValue, useSetRecoilState } from "recoil";
import { currentPoiState, selectedPoiState } from "../../redux/slices/currentPoiSlice";
import { poiReadFromDbTriggerAtom } from "../../redux/slices/poiReadFromDbTriggerSlice";
import { useDispatch } from "react-redux";
import { setCurrentPoi } from "../../redux/slices/currentPoiSlice";
const PoiUpdateModalWrapper = ({ show, onClose, latlng }) => {
const setSelectedPoi = useSetRecoilState(selectedPoiState);
const setCurrentPoi = useSetRecoilState(currentPoiState);
const currentPoi = useRecoilValue(currentPoiState);
const poiReadTrigger = useRecoilValue(poiReadFromDbTriggerAtom);
const PoiUpdateModalWrapper = ({ show, onClose, latlng, poiData }) => {
const dispatch = useDispatch();
return (
show && (
<PoiUpdateModal
onClose={onClose}
poiData={currentPoi}
onSubmit={() => {}} // Add your submit logic here
latlng={latlng}
/>
)
);
useEffect(() => {
if (show && poiData) {
dispatch(setCurrentPoi(poiData));
}
}, [show, poiData, dispatch]);
const currentPoi = useSelector(selectCurrentPoi); // Direkt aus Redux holen
return show && <PoiUpdateModal onClose={onClose} poiData={currentPoi} onSubmit={() => {}} latlng={latlng} />;
};
export default PoiUpdateModalWrapper;