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

feature/New UI for create project #918

Merged
merged 87 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
d9f0c8f
fix (create new project): create new project url updated
NSUWAL123 Sep 26, 2023
baca147
fix (create new project): upload area - select a file issue solved
NSUWAL123 Sep 26, 2023
9dd336a
fix (create new project): data extract - select a file issue solved
NSUWAL123 Sep 26, 2023
887689b
fix (radiobutton): option selection on label click, UI fix
NSUWAL123 Sep 26, 2023
287cf7d
fix (create new project): initial values for project details form added
NSUWAL123 Sep 26, 2023
e5f6caa
feat (select): custom select component added
NSUWAL123 Sep 26, 2023
4fd5dae
fix (create new project): data extract - shadcn select replaced with …
NSUWAL123 Sep 26, 2023
b14952c
fix (custom select): updated props
NSUWAL123 Sep 26, 2023
73d4dc0
fix (create new project): project detials - shadcn select replaced wi…
NSUWAL123 Sep 26, 2023
90c2a8a
fix (select): shadcn components export removed
NSUWAL123 Sep 26, 2023
e85db74
fix (create new project): select form - shadcn select replaced with c…
NSUWAL123 Sep 26, 2023
b791c65
fix: style fixes on input field
varun2948 Sep 26, 2023
4485f68
Merge branch 'feat-create-new-project' of https://github.com/NSUWAL12…
varun2948 Sep 26, 2023
b9c0960
fix radiobutton): - value prop added
NSUWAL123 Sep 26, 2023
7595499
Merge branch 'feat-create-new-project' of https://github.com/NSUWAL12…
varun2948 Sep 26, 2023
df036ce
fix (create new project): upload area - value prop added to radiobutt…
NSUWAL123 Sep 26, 2023
60a7b1a
fix (create new project): event cleanup added
NSUWAL123 Sep 26, 2023
ce64621
Merge branch 'feat-create-new-project' of https://github.com/NSUWAL12…
varun2948 Sep 26, 2023
5d270dd
fix (create new project): geojson file cleanup added
NSUWAL123 Sep 26, 2023
5265bba
fix (create new project): upload area - drawgeojson added, geojson fi…
NSUWAL123 Sep 26, 2023
196ab84
Feat create new project (#844)
NSUWAL123 Sep 26, 2023
03bbd9a
fix (create project): uploadArea/dataExtract - reset and select same …
NSUWAL123 Sep 26, 2023
6342607
feat(select): added responsive
varun2948 Sep 26, 2023
cb2b701
feat(validation) : added validation file on new create project
varun2948 Sep 26, 2023
3349b33
feat(data-extract): data extract useform integration
varun2948 Sep 26, 2023
9a14fc4
Merge branch 'feat-create-new-project' of https://github.com/NSUWAL12…
varun2948 Sep 26, 2023
45d0aba
fix(dataextract): removed formcategory actions
varun2948 Sep 26, 2023
5058091
feat (create project): upload area - total area calculation on upload…
NSUWAL123 Sep 27, 2023
73c7a0e
feat: changed step from data extract to select form
varun2948 Sep 27, 2023
87a0e8b
Merge branch 'feat-create-new-project' of https://github.com/NSUWAL12…
varun2948 Sep 27, 2023
2bcbb16
feat: changes on steps of create project
varun2948 Sep 27, 2023
9deaf75
feat(File Input): file input component addition
varun2948 Sep 27, 2023
2738a62
feat(component) : used component for fileinput
varun2948 Sep 27, 2023
48ad752
feat/fix (create new project): split tasks - radiobutton state change…
NSUWAL123 Sep 27, 2023
be4b97e
Merge branch 'feat-createproject-projectdetails-new' of github.com:ho…
varun2948 Sep 27, 2023
32676d0
fix (create new project): merge conflict solved
NSUWAL123 Sep 27, 2023
70a2f36
fix (create new project): merge conflict solved
NSUWAL123 Sep 27, 2023
598bec9
feat(FileInput): Component Changes
varun2948 Sep 28, 2023
d65601d
Feat(RadioBtn): added errorMsg
varun2948 Sep 28, 2023
9f6f373
feat(Select): errormsg added
varun2948 Sep 28, 2023
2bca717
Feat(DataExtract): Step Changes
varun2948 Sep 28, 2023
4de25b0
feat(SelectForm): Changes on SelectForm
varun2948 Sep 28, 2023
388a43f
feat(UploadArea): Changes on Step
varun2948 Sep 28, 2023
8d5b224
feat(DataExtractValidation): validation changes
varun2948 Sep 28, 2023
1cff5e8
Feat(SelectForm): Validation Changes
varun2948 Sep 28, 2023
f7b5f84
Feat(UploadAreaValidation): added
varun2948 Sep 28, 2023
3d164da
Feat(CreateNewProject): changes with Other
varun2948 Sep 28, 2023
c8ec14c
feat(define_task_validation): Validation Fixes
varun2948 Sep 28, 2023
67bb91f
feat(SplitTask): WIP
varun2948 Sep 28, 2023
1488f36
feat: Change BASEURL of tsconfig.json
varun2948 Sep 28, 2023
636e39c
Merge branch 'development' of github.com:hotosm/fmtm into feat-create…
varun2948 Oct 3, 2023
37aaf29
feat: new create project setting up
varun2948 Oct 10, 2023
08d5f39
fix: feature count in task features count api
nrjadkry Oct 12, 2023
ed85566
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 12, 2023
cfe60d5
Merge branch 'development' of github.com:hotosm/fmtm into feat-create…
varun2948 Oct 12, 2023
55e28f0
Merge branch 'development' of github.com:hotosm/fmtm into feat-create…
varun2948 Oct 12, 2023
9efea73
task_count passed in the upload multipolygon api
nrjadkry Oct 12, 2023
b874737
Merge branch 'hotfixes' of github.com:hotosm/fmtm into hotfixes
nrjadkry Oct 12, 2023
58cb68e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 12, 2023
eddd3e2
Merge branch 'hotfixes' of github.com:hotosm/fmtm into feat-createpro…
varun2948 Oct 12, 2023
25adcc5
Merge branch 'development' of github.com:hotosm/fmtm into feat-create…
varun2948 Oct 13, 2023
21b5c0c
fix: error on taskboundary not existing
varun2948 Oct 16, 2023
4525138
feat: geojson-validation added
varun2948 Oct 17, 2023
2f4cea2
feat: setdividedtask geojson fix
varun2948 Oct 17, 2023
d1f3812
feat: button component changes
varun2948 Oct 17, 2023
93987bc
fix: removed unwanted api call
varun2948 Oct 17, 2023
453486e
feat: split Task Step
varun2948 Oct 17, 2023
d301f8c
feat: dataextractvalidation changes
varun2948 Oct 17, 2023
b69c848
feat: data Extract Step changes
varun2948 Oct 17, 2023
ba07ace
feat: removed multiple api call
varun2948 Oct 17, 2023
c9c952c
fix: splitting drawn geojson state changes
varun2948 Oct 17, 2023
01136d1
feat: splittedgeojson added on defineareamap
varun2948 Oct 17, 2023
0630c58
feat: changed new route to normal route for create project
varun2948 Oct 17, 2023
7f3296a
fix: changed formways value
varun2948 Oct 17, 2023
65516bb
feat: validation on data extract
varun2948 Oct 17, 2023
202b887
feat: value changes on post create project
varun2948 Oct 17, 2023
6c0644d
fix: removed persist create project
varun2948 Oct 17, 2023
32edee5
feat: clearcreateproject form data
varun2948 Oct 17, 2023
b8725cd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 17, 2023
976e896
feat: radix ui progress bar
varun2948 Oct 17, 2023
32d6441
feat: added progress bar css for animation
varun2948 Oct 17, 2023
6f1491f
fix: submit type bug
varun2948 Oct 17, 2023
3159b5d
fix: prop on button component
varun2948 Oct 17, 2023
27875f0
feat: Split task added progress bar
varun2948 Oct 17, 2023
8eb2963
fix: removed console log on newdefineareamap
varun2948 Oct 17, 2023
691c8d3
build: update frontend package lock file
spwoodcock Oct 17, 2023
d307ef7
ci(pre-commit): add pnpm lock file to ignore files
spwoodcock Oct 17, 2023
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
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ repos:
rev: v3.0.3
hooks:
- id: prettier
args: [--ignore-unknown, --no-error-on-unmatched-pattern, "!chart/**"]
args:
[
--ignore-unknown,
--no-error-on-unmatched-pattern,
"!chart/**",
"!src/frontend/pnpm-lock.yaml",
]

# Lint: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
Expand Down
44 changes: 34 additions & 10 deletions src/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@mui/material": "^5.14.12",
"@mui/system": "^5.14.12",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-select": "^1.2.2",
"@radix-ui/react-switch": "^1.0.3",
"@reduxjs/toolkit": "^1.9.1",
Expand All @@ -64,6 +65,7 @@
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"geojson-validation": "^1.0.2",
"install": "^0.13.0",
"lucide-react": "^0.276.0",
"mini-css-extract-plugin": "^2.7.5",
Expand Down
35 changes: 35 additions & 0 deletions src/frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions src/frontend/src/api/CreateProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
FormCategoryListModel,
OrganisationListModel,
} from '../models/createproject/createProjectModel';
import enviroment from '../environment';
import { CommonActions } from '../store/slices/CommonSlice';
import { ValidateCustomFormResponse } from 'store/types/ICreateProject';

Expand All @@ -27,7 +26,7 @@ const CreateProjectService: Function = (
const resp: ProjectDetailsModel = postNewProjectDetails.data;
await dispatch(CreateProjectActions.PostProjectDetails(resp));

if (payload.splitting_algorithm === 'Choose Area as Tasks') {
if (payload.splitting_algorithm === 'choose_area_as_task') {
await dispatch(
UploadAreaService(`${import.meta.env.VITE_API_URL}/projects/${resp.id}/upload_multi_polygon`, fileUpload),
);
Expand Down Expand Up @@ -163,15 +162,14 @@ const GenerateProjectQRService: Function = (url: string, payload: any, formUploa
try {
const isPolygon = payload.data_extractWays === 'Polygon';
const generateApiFormData = new FormData();
if (payload.form_ways === 'Upload a Custom Form') {
if (payload.form_ways === 'custom_form') {
generateApiFormData.append('extract_polygon', isPolygon.toString());
generateApiFormData.append('upload', formUpload);
if (dataExtractFile) {
generateApiFormData.append('data_extracts', dataExtractFile);
}
} else {
generateApiFormData.append('extract_polygon', isPolygon.toString());
generateApiFormData.append('upload', '');
if (dataExtractFile) {
generateApiFormData.append('data_extracts', dataExtractFile);
}
Expand All @@ -184,7 +182,6 @@ const GenerateProjectQRService: Function = (url: string, payload: any, formUploa
const resp: string = postNewProjectDetails.data;
await dispatch(CreateProjectActions.GenerateProjectQRLoading(false));
dispatch(CommonActions.SetLoading(false));
await dispatch(CreateProjectActions.ClearCreateProjectFormData());
await dispatch(CreateProjectActions.GenerateProjectQRSuccess(resp));
} catch (error: any) {
dispatch(CommonActions.SetLoading(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { defaultStyles, getStyles } from '../helpers/styleUtils';
import { isExtentValid } from '../helpers/layerUtils';
import { Draw, Modify, Select, defaults as defaultInteractions } from 'ol/interaction.js';
import { getArea } from 'ol/sphere';
import { valid } from 'geojson-validation';

const selectElement = 'singleselect';

Expand Down Expand Up @@ -135,6 +136,7 @@ const VectorLayer = ({
useEffect(() => {
if (!map) return;
if (!geojson) return;
if (!valid(geojson)) return;

const vectorLyr = new OLVectorLayer({
source: new VectorSource({
Expand Down
12 changes: 8 additions & 4 deletions src/frontend/src/components/TasksLayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@ const TasksLayer = (map, view, feature) => {
// The extent of the vector layer
var extent = [minX, minY, maxX, maxY];

map.getView().fit(extent, {
duration: 2000, // Animation duration in milliseconds
padding: [50, 50, 50, 200], // Optional padding around the extent
});
// Checking if Taskboundaries exist if doesn't exist dont throw error window
const checkForInfinity = extent.some((ext) => ext === Infinity);
if (!checkForInfinity) {
map.getView().fit(extent, {
duration: 2000, // Animation duration in milliseconds
padding: [50, 50, 50, 200], // Optional padding around the extent
});
}
map.addLayer(vectorLayer);
map.on('loadend', function () {
map.getTargetElement().classList.remove('spinner');
Expand Down
40 changes: 29 additions & 11 deletions src/frontend/src/components/common/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { Loader2 } from 'lucide-react';
import React from 'react';

interface IButton {
btnText: string;
btnType: 'primary' | 'secondary' | 'other';
type: 'submit' | 'button';
btnType: 'primary' | 'secondary' | 'other' | 'disabled';
type?: 'submit' | 'button';
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
className?: string;
count?: number;
dataTip?: string;
icon?: React.ReactNode;
isLoading?: boolean;
disabled?: boolean;
}

const btnStyle = (btnType, className) => {
Expand All @@ -20,26 +23,41 @@ const btnStyle = (btnType, className) => {

case 'other':
return `fmtm-py-1 fmtm-px-5 fmtm-bg-red-500 fmtm-text-white fmtm-rounded-lg hover:fmtm-bg-red-600`;
case 'disabled':
return `fmtm-py-1 fmtm-px-5 fmtm-text-white fmtm-rounded-lg fmtm-bg-gray-400 fmtm-cursor-not-allowed`;

default:
return 'fmtm-primary';
}
};
const Button = ({ btnText, btnType, type, onClick, className, count, dataTip, icon }: IButton) => (
const Button = ({ btnText, btnType, type, onClick, disabled, className, count, dataTip, icon, isLoading }: IButton) => (
<div className="fmtm-w-fit">
<button
type={type ? 'submit' : 'button'}
type={type === 'submit' ? 'submit' : 'button'}
onClick={onClick}
className={`fmtm-text-lg fmtm-group fmtm-flex fmtm-items-center fmtm-gap-2 ${btnStyle(btnType, className)}`}
className={`fmtm-text-lg fmtm-group fmtm-flex fmtm-items-center fmtm-gap-2 ${btnStyle(
isLoading ? 'disabled' : btnType,
className,
)}`}
disabled={disabled || isLoading}
title={dataTip}
>
<p className="fmtm-whitespace-nowrap">{btnText}</p>
{count && (
<p className="fmtm-flex fmtm-justify-center fmtm-items-center fmtm-text-overline fmtm-ml-2 fmtm-rounded-[40px] fmtm-bg-active_text fmtm-text-white fmtm-w-6 fmtm-h-6">
{count}
</p>
{isLoading ? (
<>
{type === 'submit' ? 'Submitting...' : 'Loading...'}
<Loader2 className="fmtm-mr-2 fmtm-h-6 fmtm-w-6 fmtm-animate-spin" />
</>
) : (
<>
<p className="fmtm-whitespace-nowrap">{btnText}</p>
{count && (
<p className="fmtm-flex fmtm-justify-center fmtm-items-center fmtm-text-overline fmtm-ml-2 fmtm-rounded-[40px] fmtm-bg-active_text fmtm-text-white fmtm-w-6 fmtm-h-6">
{count}
</p>
)}
<div>{icon && icon}</div>
</>
)}
<div>{icon && icon}</div>
</button>
</div>
);
Expand Down
Loading
Loading