Skip to content

Commit

Permalink
distinguish feedback and accepted features
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Sep 26, 2024
1 parent 6a50743 commit eb2942b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions frontend/src/components/Layout/Start/Prediction/EditableGeoJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -172,9 +172,6 @@ const EditableGeoJSON = ({
}
};
const { mutate: mutateSubmitFeedback } = useMutation(submitFeedback);
// const { mutate: mutatesubmitAcceptedPrediction } = useMutation(
// submitAcceptedPrediction
// );

const submitAcceptedPrediction = async (layer) => {
const newAOI = {
Expand Down Expand Up @@ -208,6 +205,9 @@ const EditableGeoJSON = ({
} finally {
}
};
const { mutate: mutatesubmitAcceptedPrediction } = useMutation(
submitAcceptedPrediction
);

const onEachFeature = (feature, layer) => {
// layer.on({
Expand Down Expand Up @@ -282,8 +282,8 @@ const EditableGeoJSON = ({
</p>
<span>Comments:<span/><input type="text" id="comments" name="comments" />
<br/>
<button id="rightButton" class="feedback-button" type="submit">Submit feedback</button>
<button id="josmButton" class="feedback-button" type="submit">&#128077; Accept</button>
<button id="submitFeedback" class="feedback-button" type="submit">Submit feedback</button>
<button id="acceptFeedback" class="feedback-button" type="submit">&#128077; Accept</button>
</div>
`;
const popup = L.popup()
Expand All @@ -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();
});
Expand Down

0 comments on commit eb2942b

Please sign in to comment.