Skip to content

Commit

Permalink
feat uploadArea: edit AOI btn add
Browse files Browse the repository at this point in the history
  • Loading branch information
NSUWAL123 committed Mar 13, 2024
1 parent ba44cf2 commit a8aaf46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customDataExtractUpload
const toggleStep = (step: number, url: string) => {
dispatch(CommonActions.SetCurrentStepFormStep({ flag: flag, step: step }));
navigate(url);
dispatch(CreateProjectActions.SetToggleSplittedGeojsonEdit(false));
};

const checkTasksGeneration = () => {
Expand Down
22 changes: 15 additions & 7 deletions src/frontend/src/components/createnewproject/UploadArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl
const uploadAreaSelection = useAppSelector((state) => state.createproject.uploadAreaSelection);
const drawToggle = useAppSelector((state) => state.createproject.drawToggle);
const totalAreaSelection = useAppSelector((state) => state.createproject.totalAreaSelection);
const toggleSplittedGeojsonEdit = useAppSelector((state) => state.createproject.toggleSplittedGeojsonEdit);

const submission = () => {
if (totalAreaSelection) {
Expand All @@ -62,6 +63,7 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl
dispatch(CreateProjectActions.SetIndividualProjectDetailsData(formValues));
dispatch(CommonActions.SetCurrentStepFormStep({ flag: flag, step: 3 }));
navigate('/select-category');
dispatch(CreateProjectActions.SetToggleSplittedGeojsonEdit(false));
};
const {
handleSubmit,
Expand All @@ -72,6 +74,7 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl
const toggleStep = (step, url) => {
dispatch(CommonActions.SetCurrentStepFormStep({ flag: flag, step: step }));
navigate(url);
dispatch(CreateProjectActions.SetToggleSplittedGeojsonEdit(false));
};

const convertFileToGeojson = async (file) => {
Expand Down Expand Up @@ -320,16 +323,21 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl
setGeojsonFile(null);
}
}
onModify={(geojson, area) => {
handleCustomChange('drawnGeojson', geojson);
dispatch(CreateProjectActions.SetDrawnGeojson(JSON.parse(geojson)));
dispatch(CreateProjectActions.SetTotalAreaSelection(area));
dispatch(CreateProjectActions.ClearProjectStepState(formValues));
setCustomDataExtractUpload(null);
}}
onModify={
toggleSplittedGeojsonEdit
? (geojson, area) => {
handleCustomChange('drawnGeojson', geojson);
dispatch(CreateProjectActions.SetDrawnGeojson(JSON.parse(geojson)));
dispatch(CreateProjectActions.SetTotalAreaSelection(area));
dispatch(CreateProjectActions.ClearProjectStepState(formValues));
setCustomDataExtractUpload(null);
}
: null
}
getAOIArea={(area) => {
dispatch(CreateProjectActions.SetTotalAreaSelection(area));
}}
hasEditUndo
/>
</div>
</div>
Expand Down

0 comments on commit a8aaf46

Please sign in to comment.