WIP: POI->contextmenu ->POI bearbeiten ->Gerät: Dropdown
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user