Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix limit project area #1109

Merged
merged 23 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e7f60da
fix: backend import error fix
NSUWAL123 Jan 9, 2024
73c06aa
fix (vectorLayer): style - conditionaly apply style on onModify present
NSUWAL123 Jan 9, 2024
9d45249
fix (splitTasks): map - edit added to splitted taskLayer
NSUWAL123 Jan 9, 2024
0676190
Merge branch 'development' of github.com:hotosm/fmtm into fix-editabl…
NSUWAL123 Jan 9, 2024
ba154f1
fix (splitTasks): onModify - edited geojson set to dividedTaskGeojson…
NSUWAL123 Jan 9, 2024
49c7415
Merge branch 'development' of github.com:hotosm/fmtm into fix-editabl…
NSUWAL123 Jan 11, 2024
f3140d4
feat (createNewProject): only enable generate task btn if fgb file fe…
NSUWAL123 Jan 11, 2024
937ae6a
fix (createNewProject): splitTasks - logic fix
NSUWAL123 Jan 11, 2024
55ec79c
fix (createNewProject): splitTasks - clear dividedTaskGeojson, splitT…
NSUWAL123 Jan 11, 2024
df682b7
feat (createNewProject): splitTasks - show loader and message until F…
NSUWAL123 Jan 11, 2024
b7f105c
fix (createNewProject): taskSplit - display error on taskSplit fail
NSUWAL123 Jan 11, 2024
4214f92
fix vectorLayer: on modifyEnd return area of boundary as well
NSUWAL123 Jan 11, 2024
6a615bd
fix button: loading text added to the button
NSUWAL123 Jan 12, 2024
2e5b408
fix NewDefineAreaMap: removed data extraction in progress message fro…
NSUWAL123 Jan 12, 2024
d1fc838
fix (createNewProject): splitTasks - clearing state on step toggle re…
NSUWAL123 Jan 12, 2024
c189ab3
fix (createNewProject): uploadArea - clear step4 & step5 step on AOI …
NSUWAL123 Jan 12, 2024
fddb17a
fix (createNewProject): dataExtract - generateTaskBTN added, disable …
NSUWAL123 Jan 12, 2024
7ba2362
fix (createNewProject): dataExtract - clear file state on reset click…
NSUWAL123 Jan 12, 2024
d42fe8d
fix (createNewProject): customLine, customPolygon file state clear on…
NSUWAL123 Jan 12, 2024
563c588
fix (createNewProject): dataExtract - clear previous extractGeojson, …
NSUWAL123 Jan 16, 2024
f6eecf1
Merge branch 'development' of github.com:hotosm/fmtm into fix-editabl…
NSUWAL123 Jan 16, 2024
5a05345
fix (createNewProject): uploadArea - warning & error shown if AOI exc…
NSUWAL123 Jan 17, 2024
3ea62f9
fix: merge conflict resolve
NSUWAL123 Jan 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion src/frontend/src/components/createnewproject/UploadArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomLineUpload, se
const totalAreaSelection = useAppSelector((state) => state.createproject.totalAreaSelection);

const submission = () => {
if (totalAreaSelection) {
const totalArea = parseFloat(totalAreaSelection?.split(' ')[0]);
if (totalArea > 1000) {
dispatch(
CommonActions.SetSnackBar({
open: true,
message: 'Cannot create project of project area exceeding 1000 Sq.KM.',
variant: 'error',
duration: 3000,
}),
);
return;
}
}
dispatch(CreateProjectActions.SetIndividualProjectDetailsData(formValues));
dispatch(CommonActions.SetCurrentStepFormStep({ flag: flag, step: 3 }));
navigate('/select-form');
Expand Down Expand Up @@ -133,6 +147,32 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomLineUpload, se
dispatch(CreateProjectActions.SetTotalAreaSelection(null));
};

useEffect(() => {
if (totalAreaSelection) {
const totalArea = parseFloat(totalAreaSelection?.split(' ')[0]);
if (totalArea > 100) {
dispatch(
CommonActions.SetSnackBar({
open: true,
message: 'The project area exceeded over 100 Sq.KM.',
variant: 'warning',
duration: 3000,
}),
);
}
if (totalArea > 1000) {
dispatch(
CommonActions.SetSnackBar({
open: true,
message: 'The project area exceeded 1000 Sq.KM. and must be less than 1000 Sq.KM.',
variant: 'error',
duration: 3000,
}),
);
}
}
}, [totalAreaSelection]);

return (
<div className="fmtm-flex fmtm-gap-7 fmtm-flex-col lg:fmtm-flex-row">
<div className="fmtm-bg-white lg:fmtm-w-[20%] xl:fmtm-w-[17%] fmtm-px-5 fmtm-py-6">
Expand Down Expand Up @@ -264,7 +304,7 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomLineUpload, se
handleCustomChange('drawnGeojson', geojson);
dispatch(CreateProjectActions.SetDrawnGeojson(JSON.parse(geojson)));
dispatch(CreateProjectActions.SetTotalAreaSelection(area));
dispatch(CreateProjectActions.ClearProjectStepState());
dispatch(CreateProjectActions.ClearProjectStepState(formValues));
setCustomLineUpload(null);
setCustomPolygonUpload(null);
setGeojsonFile(null);
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/store/slices/CreateProjectSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ const CreateProject = createSlice({
SetFgbFetchingStatus(state, action) {
state.isFgbFetching = action.payload;
},
ClearProjectStepState(state) {
ClearProjectStepState(state, action) {
state.dividedTaskGeojson = null;
state.splitTasksSelection = null;
state.dataExtractGeojson = null;
state.projectDetails = { ...state.projectDetails, customLineUpload: null, customPolygonUpload: null };
state.projectDetails = { ...action.payload, customLineUpload: null, customPolygonUpload: null };
},
},
});
Expand Down