From eb2942b746c6611a6048988104d419821ef65a4a Mon Sep 17 00:00:00 2001
From: kshitijrajsharma
Date: Thu, 26 Sep 2024 14:38:38 +0200
Subject: [PATCH] distinguish feedback and accepted features
---
.../Start/Prediction/EditableGeoJSON.js | 21 ++++++++++---------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/frontend/src/components/Layout/Start/Prediction/EditableGeoJSON.js b/frontend/src/components/Layout/Start/Prediction/EditableGeoJSON.js
index 6eee938b..8303aae2 100644
--- a/frontend/src/components/Layout/Start/Prediction/EditableGeoJSON.js
+++ b/frontend/src/components/Layout/Start/Prediction/EditableGeoJSON.js
@@ -67,7 +67,7 @@ function tile2boundingbox(xtile, ytile, zoom) {
function getFeatureStyle(feature) {
let color = "";
- if (feature.properties.action === "ACCEPT") {
+ if (feature.properties.action === "FEEDBACK") {
color = "blue";
} else if (feature.properties.action === "INITIAL") {
color = "red";
@@ -172,9 +172,6 @@ const EditableGeoJSON = ({
}
};
const { mutate: mutateSubmitFeedback } = useMutation(submitFeedback);
- // const { mutate: mutatesubmitAcceptedPrediction } = useMutation(
- // submitAcceptedPrediction
- // );
const submitAcceptedPrediction = async (layer) => {
const newAOI = {
@@ -208,6 +205,9 @@ const EditableGeoJSON = ({
} finally {
}
};
+ const { mutate: mutatesubmitAcceptedPrediction } = useMutation(
+ submitAcceptedPrediction
+ );
const onEachFeature = (feature, layer) => {
// layer.on({
@@ -282,8 +282,8 @@ const EditableGeoJSON = ({
Comments:
-
-
+
+
`;
const popup = L.popup()
@@ -292,24 +292,25 @@ const EditableGeoJSON = ({
.openOn(e.target._map);
const popupElement = popup.getElement();
popupElement
- .querySelector("#rightButton")
+ .querySelector("#submitFeedback")
.addEventListener("click", () => {
- feature.properties.action = "ACCEPT";
+ feature.properties.action = "FEEDBACK";
onAcceptFeature(feature);
console.log("popup layer ", layer);
// handle submitting feedback
mutateSubmitFeedback(layer);
- mutatesubmitAcceptedPrediction(layer);
+
popup.close();
});
popupElement
- .querySelector("#josmButton")
+ .querySelector("#acceptFeedback")
.addEventListener("click", () => {
feature.properties.action = "JOSM";
// console.log("popup layer ", layer);
// handle submitting feedback
// mutateSubmitFeedback(layer);
+ mutatesubmitAcceptedPrediction(layer);
setRender(Math.random());
popup.close();
});