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

Feat manage project UI #1154

Merged
merged 105 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
7bf7679
fix (routes): projectSubmissions route added
NSUWAL123 Dec 8, 2023
d10bac3
fix (icon): icon added
NSUWAL123 Dec 8, 2023
94cd65e
fix (projectSubmissions): setup
NSUWAL123 Dec 8, 2023
96cfbde
fix (projectSubmissions): styling adjustments
NSUWAL123 Dec 8, 2023
d447dea
feat (projectSubmissions): projectInfo section slicing
NSUWAL123 Dec 8, 2023
7922207
feat (AssetModules): icon added
NSUWAL123 Dec 8, 2023
737ada1
feat (taskSubmissions): taskSection - UI slicing
NSUWAL123 Dec 8, 2023
e41e872
fix (projectSubmissions): UI fixes
NSUWAL123 Dec 8, 2023
606da86
feat (AssetModules): icons added
NSUWAL123 Dec 8, 2023
c99c792
feat (select): className added to select
NSUWAL123 Dec 8, 2023
27df5cc
feat (projectSubmission): submissionsTable - filter section UI completed
NSUWAL123 Dec 8, 2023
d95386d
feat: (AssetModules): icons added
NSUWAL123 Dec 12, 2023
c8977e6
fix (routes): normal import for projectSubmissions
NSUWAL123 Dec 12, 2023
09e1021
feat (customTable): custom table added
NSUWAL123 Dec 12, 2023
61aea20
feat (submissionsPage): table added to submission page
NSUWAL123 Dec 12, 2023
29546aa
fix (taskSubmissions): mobile responsive
NSUWAL123 Dec 12, 2023
ca2f04a
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Dec 12, 2023
7dc6690
feat (recharts): recharts package added
NSUWAL123 Dec 12, 2023
f5f97b0
icon added
NSUWAL123 Dec 12, 2023
90377c5
feat (recharts): bar & pie chart added
NSUWAL123 Dec 12, 2023
8947471
feat (LineChart): lineChart added
NSUWAL123 Dec 12, 2023
c76c87c
feat (ProjectSubmissions): infographics - infographics slicing
NSUWAL123 Dec 12, 2023
ccbea49
feat (package): html2canvas package added
NSUWAL123 Dec 13, 2023
2b9729e
feat (submissionsPage): chartDownload - download feature added to the…
NSUWAL123 Dec 13, 2023
e0c6620
fix (lineChart): line color changed
NSUWAL123 Dec 13, 2023
1b2e759
fix (UI): UI changes
NSUWAL123 Dec 13, 2023
2a6c177
fix (barChart): dynamic data for barChart
NSUWAL123 Dec 13, 2023
28c2240
fix (pieChart): dynamic data for pieChart
NSUWAL123 Dec 13, 2023
94923c8
fix (barChart): dynamic dataKey for xAxis
NSUWAL123 Dec 13, 2023
0cb412d
fix (lineChart): dynamic data for lineChart
NSUWAL123 Dec 13, 2023
9d20332
fix (chart): bar/pie color changed
NSUWAL123 Dec 13, 2023
fc83694
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Dec 13, 2023
9f17195
fix (lineChart): x & y axis labels added
NSUWAL123 Dec 13, 2023
9aaaf30
feat (projectSubmissions): skeleton loader added
NSUWAL123 Dec 15, 2023
5ec71fa
fix (projectSubmissions): filter padding increase
NSUWAL123 Dec 15, 2023
d0d2e62
feat (projectSubmissions): skeletonLoader - skeletonLoader added to i…
NSUWAL123 Dec 15, 2023
00b9737
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Dec 15, 2023
7bbde94
created api that returns the submission count by date
Dec 19, 2023
c310584
fix (projectSubmissions): infographicsCard - infographicsCard seperat…
NSUWAL123 Dec 19, 2023
cd2a683
Merge branch 'feat-submission-page' of github.com:hotosm/fmtm into fe…
NSUWAL123 Dec 19, 2023
2f753a3
feat (projectSubmissions): barChart - api fetch for formSubmissions
NSUWAL123 Dec 19, 2023
6e3e947
refactored response
Dec 19, 2023
31421c7
Merge branch 'feat-submission-page' of github.com:hotosm/fmtm into fe…
NSUWAL123 Dec 19, 2023
f35cef5
feat: (projectSubmissions): submissionBar - dummy data replaced with …
NSUWAL123 Dec 20, 2023
3b76799
fix (barChart): maxBarSize set
NSUWAL123 Dec 20, 2023
2c0ee48
feat (projectSubmissions): task api call
NSUWAL123 Dec 20, 2023
55af61e
feat (projectSubmissions): projectInfo - dynamic value for projTitle,…
NSUWAL123 Dec 20, 2023
857974b
feat (projectSubmissions): taskSidebar - dynamic data added
NSUWAL123 Dec 20, 2023
324ba1a
feat (projectSubmissions): taskSidebar - zoomToTask feature added
NSUWAL123 Dec 20, 2023
5e5057a
Created Project dashboard
Dec 21, 2023
4d8aae4
added organization info
Dec 22, 2023
e15488d
Exception handling in s3 if no object found
Dec 22, 2023
1be5427
refactor
Dec 22, 2023
db50efe
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Dec 25, 2023
953cabf
Merge branch 'development' of github.com:hotosm/fmtm into project-das…
Dec 25, 2023
fc67269
fix: string based date to custom date format for over 7days
Dec 25, 2023
c13cf30
Merge branch 'project-dashboard' of github.com:hotosm/fmtm into feat-…
NSUWAL123 Dec 25, 2023
4ea22de
fix: merge conflict
NSUWAL123 Dec 25, 2023
082bbbd
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Dec 27, 2023
2fda10a
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Dec 27, 2023
3bb8b5a
feat (projectSubmissions): contributorsTable - contributors table dat…
NSUWAL123 Dec 28, 2023
81a035b
fix (projectSubmissions): UI fix
NSUWAL123 Dec 28, 2023
3fa2f2f
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Dec 28, 2023
ac32180
fix (assetModules): duplicated icon removed
NSUWAL123 Dec 28, 2023
69fac0e
feat (projectSubmissions): projectInfo - api integration
NSUWAL123 Dec 28, 2023
bb58976
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Jan 2, 2024
850d7f6
fix (projectSubmissions): piechart - outerRadius adjusted
NSUWAL123 Jan 2, 2024
0c2ceab
fix (projectSubmissions): message display if no data available
NSUWAL123 Jan 2, 2024
f4f884e
feat (projectSubmissions): taskLoading - skeleton loader added for tasks
NSUWAL123 Jan 2, 2024
ad6b633
fix (projectSubmissions): filter - UI fix
NSUWAL123 Jan 2, 2024
0dbb39c
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Jan 3, 2024
7fadc60
Merge branch 'development' of github.com:hotosm/fmtm into feat-projec…
NSUWAL123 Jan 8, 2024
5fecca2
feat (manageProject): manageProject added
NSUWAL123 Jan 9, 2024
ef83b42
feat (assetModules): icon added
NSUWAL123 Jan 9, 2024
f5ac796
feat (chips): chips added
NSUWAL123 Jan 9, 2024
77aa483
fix (select): UI fix
NSUWAL123 Jan 9, 2024
821c835
feat (manageProject): partial UI completion for manage-project
NSUWAL123 Jan 9, 2024
26cd3d1
feat (AssetModules): icon added
NSUWAL123 Jan 9, 2024
b22af60
feat (UploadArea): custom upload area added
NSUWAL123 Jan 9, 2024
709ce61
feat (manageProject): editTab - UI slicing completed for editTab
NSUWAL123 Jan 9, 2024
3b2734b
Merge branch 'feat-projects-submissions-ui-ref' of github.com:NSUWAL1…
NSUWAL123 Jan 10, 2024
c60e5df
fix (AssetModules): duplicate icon removed
NSUWAL123 Jan 10, 2024
e1dfdcb
fix (select/manageProject): UI fix
NSUWAL123 Jan 10, 2024
cebcf50
feat (ManageProject): userTab - table added
NSUWAL123 Jan 10, 2024
2dbdfbb
fix (manageProject): mobile responsive fix
NSUWAL123 Jan 10, 2024
ee2a7e0
fix (customTable): css fix
NSUWAL123 Jan 10, 2024
f0c6c3f
feat (AssetModules): icons added
NSUWAL123 Jan 10, 2024
ba24ea0
feat kebabMenu: kebabMenu added
NSUWAL123 Jan 10, 2024
0d8b4c7
feat (manageProject): table - kebab menu added to table
NSUWAL123 Jan 10, 2024
cb3d33e
fix manageProject - UI fixes
NSUWAL123 Jan 10, 2024
19a02f3
fix (KebabMenu): added types
NSUWAL123 Jan 10, 2024
0e774e5
Merge branch 'development' of github.com:hotosm/fmtm into feat-manage…
NSUWAL123 Feb 1, 2024
9512347
fix select: title background transparent
NSUWAL123 Feb 1, 2024
cba17e1
Merge branch 'development' of github.com:hotosm/fmtm into feat-manage…
NSUWAL123 Feb 5, 2024
dbe99d8
fix button: loading text checked first to display if button state loa…
NSUWAL123 Feb 5, 2024
05579bc
feat (manageProject): editProject - edit project description add
NSUWAL123 Feb 5, 2024
8be3b3c
feat manageProject: formCategory list api fetch
NSUWAL123 Feb 5, 2024
a5e9369
feat uuid: uuid package add to generated ids
NSUWAL123 Feb 5, 2024
d0531b2
fix uploadArea: uuid add to uniquely identify each file
NSUWAL123 Feb 5, 2024
22fbdbe
fix (manageProject): edit - projectId passes as prop to child
NSUWAL123 Feb 5, 2024
415d209
feat (manageProject): formUpdate - postFormUpdate api hit on update c…
NSUWAL123 Feb 5, 2024
3233d8a
fix manageProject: individualProjectDetails fetch on parent component
NSUWAL123 Feb 5, 2024
bea23cb
Merge branch 'development' of github.com:hotosm/fmtm into feat-manage…
NSUWAL123 Feb 5, 2024
2dc338a
fix navigation: navigation route added to manageProject and back btn
NSUWAL123 Feb 5, 2024
e998d12
feat newProjectDetails: viewInfographics & manageProject btn add for …
NSUWAL123 Feb 5, 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
3 changes: 2 additions & 1 deletion src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"redux": "^4.2.0",
"redux-persist": "^6.0.0",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7"
"tailwindcss-animate": "^1.0.7",
"uuid": "^9.0.1"
}
}
8 changes: 8 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.

4 changes: 2 additions & 2 deletions src/frontend/src/api/CreateProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ const PostFormUpdate: Function = (url: string, payload: any) => {
dispatch(
CommonActions.SetSnackBar({
open: true,
message: error.response.data.detail,
variant: 'success',
message: error?.response?.data?.detail || 'Failed to update Form',
variant: 'error',
duration: 2000,
}),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import React, { useEffect, useState } from 'react';
import UploadArea from '../../common/UploadArea';
import { CustomSelect } from '../../common/Select';
import Button from '../../common/Button';
import CoreModules from '@/shared/CoreModules';
import { diffObject } from '@/utilfunctions/compareUtils.js';
import { PostFormUpdate } from '@/api/CreateProjectService';

type FileType = {
id: string;
name: string;
url?: File;
isDeleted: boolean;
};

const FormUpdateTab = ({ projectId }) => {
const dispatch = CoreModules.useAppDispatch();

const [uploadForm, setUploadForm] = useState<FileType[] | null>(null);
const [selectedFormCategory, setSelectedFormCategory] = useState<string | null>(null);
const formCategoryList = CoreModules.useAppSelector((state) => state.createproject.formCategoryList);
const previousXform_title = CoreModules.useAppSelector((state) => state.project.projectInfo.xform_title);

useEffect(() => {
setSelectedFormCategory(previousXform_title);
}, [previousXform_title]);

const onSave = () => {
const diffPayload = diffObject({ category: previousXform_title }, { category: selectedFormCategory });
dispatch(
PostFormUpdate(`${import.meta.env.VITE_API_URL}/projects/update_category`, {
...(Object.keys(diffPayload).length > 0 ? diffPayload : { category: selectedFormCategory }),
project_id: projectId,
upload: uploadForm && uploadForm?.[0]?.url,
}),
);
};

return (
<div className="fmtm-flex fmtm-flex-col fmtm-gap-10">
<CustomSelect
title="Form Category"
placeholder="Choose"
data={formCategoryList}
dataKey="title"
value={selectedFormCategory}
valueKey="title"
label="title"
onValueChange={(value) => value && setSelectedFormCategory(value?.toString())}
className="fmtm-bg-white"
/>
<UploadArea
title="Upload Form"
label="Please upload .xls, .slxs, .xml file"
multiple={false}
data={uploadForm || []}
filterKey="url"
onUploadFile={(updatedFiles) => {
setUploadForm(updatedFiles);
}}
acceptedInput=".xls, .slxs, .xml"
/>
<div className="fmtm-flex fmtm-justify-center">
<Button onClick={onSave} btnText="UPDATE" btnType="primary" className="fmtm-rounded-md" />
</div>
</div>
);
};

export default FormUpdateTab;
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import React from 'react';
import TextArea from '../../common/TextArea';
import InputTextField from '../../common/InputTextField';
import Button from '../../common/Button';
import EditProjectValidation from '@/components/ManageProject/EditTab/validation/EditProjectDetailsValidation';
import { CreateProjectActions } from '@/store/slices/CreateProjectSlice';
import { PatchProjectDetails } from '@/api/CreateProjectService';
import { diffObject } from '@/utilfunctions/compareUtils';
import useForm from '@/hooks/useForm';
import CoreModules from '@/shared/CoreModules';
import { CommonActions } from '@/store/slices/CommonSlice';

const ProjectDescriptionTab = ({ projectId }) => {
const dispatch = CoreModules.useAppDispatch();
const editProjectDetails: any = CoreModules.useAppSelector((state) => state.createproject.editProjectDetails);
const editProjectDetailsLoading: boolean = CoreModules.useAppSelector(
(state) => state.createproject.editProjectDetailsLoading,
);

const submission = () => {
const changedValues = diffObject(editProjectDetails, values);
dispatch(CreateProjectActions.SetIndividualProjectDetails(values));
if (Object.keys(changedValues).length > 0) {
dispatch(PatchProjectDetails(`${import.meta.env.VITE_API_URL}/projects/${projectId}`, changedValues));
} else {
dispatch(
CommonActions.SetSnackBar({
open: true,
message: 'No changes to Save',
variant: 'info',
duration: 2000,
}),
);
}
};
const { handleSubmit, handleChange, values, errors }: any = useForm(
editProjectDetails,
submission,
EditProjectValidation,
);
return (
<form onSubmit={handleSubmit} className="fmtm-w-full fmtm-h-full fmtm-flex fmtm-flex-col fmtm-flex-grow fmtm-gap-5">
<InputTextField
id="name"
name="name"
label="Project Name"
value={values?.name}
onChange={handleChange}
fieldType="text"
classNames="fmtm-w-full"
errorMsg={errors.name}
required
/>
<TextArea
id="short_description"
name="short_description"
label="Short Description"
rows={2}
value={values?.short_description}
onChange={handleChange}
errorMsg={errors.short_description}
required
/>
<TextArea
id="description"
name="description"
label="Description"
rows={2}
value={values?.description}
onChange={handleChange}
errorMsg={errors.description}
required
/>
<TextArea
id="instruction"
name="instruction"
label="Instruction"
rows={2}
value={values?.instruction}
onChange={handleChange}
errorMsg={errors.instruction}
/>
<InputTextField
id="changeset"
name="hashtags"
label="Changeset"
value={values?.hashtags}
onChange={handleChange}
fieldType="text"
classNames="fmtm-w-full"
errorMsg={errors.hashtags}
required
/>
<div className="fmtm-flex fmtm-justify-center fmtm-mt-4">
<Button
isLoading={editProjectDetailsLoading}
loadingText="Saving"
btnText="SAVE"
btnType="primary"
type="submit"
className="fmtm-rounded-md"
/>
</div>
</form>
);
};

export default ProjectDescriptionTab;
44 changes: 44 additions & 0 deletions src/frontend/src/components/ManageProject/EditTab/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React, { useEffect, useState } from 'react';
import environment from '@/environment';
import ProjectDescriptionTab from './ProjectDescriptionTab';
import FormUpdateTab from './FormUpdateTab';
import { FormCategoryService, GetIndividualProjectDetails } from '@/api/CreateProjectService';
import CoreModules from '@/shared/CoreModules';

const tabList: ['Project Description', 'Form Update'] = ['Project Description', 'Form Update'];

const EditTab = ({ projectId }) => {
const dispatch = CoreModules.useAppDispatch();
const [tabView, setTabView] = useState<'Project Description' | 'Form Update'>('Project Description');

useEffect(() => {
dispatch(FormCategoryService(`${import.meta.env.VITE_API_URL}/central/list-forms`));
}, []);

return (
<div>
<div className="fmtm-flex fmtm-gap-3 fmtm-mb-5">
{tabList.map((tab) => (
<div
key={tab}
className={`fmtm-w-fit fmtm-text-[#9B9999] fmtm-px-2 fmtm-border-b-[1px] hover:fmtm-border-primaryRed fmtm-duration-300 fmtm-cursor-pointer ${
tabView === tab ? 'fmtm-border-primaryRed' : 'fmtm-border-transparent'
}`}
onClick={() => setTabView(tab)}
>
{tab}
</div>
))}
</div>
<div className="fmtm-max-w-[29.5rem]">
{tabView === 'Project Description' ? (
<ProjectDescriptionTab projectId={projectId} />
) : (
<FormUpdateTab projectId={projectId} />
)}
</div>
</div>
);
};

export default EditTab;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
interface ProjectValues {
organisation: string;
name: string;
username: string;
id: string;
short_description: string;
description: string;
hashtags: string;
}
interface ValidationErrors {
organisation?: string;
name?: string;
username?: string;
id?: string;
short_description?: string;
description?: string;
hashtags?: string;
}
const regexForSymbol = /_/g;

function EditProjectValidation(values: ProjectValues) {
const errors: ValidationErrors = {};
if (!values?.name) {
errors.name = 'Project Name is Required.';
}
if (values?.name && regexForSymbol.test(values.name)) {
errors.name = 'Project Name should not contain _.';
}
if (!values?.short_description) {
errors.short_description = 'Short Description is Required.';
}
if (!values?.description) {
errors.description = 'Description is Required.';
}
if (!values?.hashtags) {
errors.hashtags = 'Changeset is Required.';
}

return errors;
}

export default EditProjectValidation;
68 changes: 68 additions & 0 deletions src/frontend/src/components/ManageProject/UserTab/AssignTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React, { useState } from 'react';
import InputTextField from '../../../components/common/InputTextField';
import AssetModules from '../../../shared/AssetModules.js';
import Chips from '../../common/Chips';
import { CustomSelect } from '../../common/Select';
import Button from '../..//common/Button';

const roleList = [
{ label: 'Project Manger', value: 'project_manager' },
{ label: 'Surveyor', value: 'surveyor' },
{ label: 'Supervisor', value: 'supervisor' },
];
const AssignTab = () => {
const [user, setUser] = useState<string | null>('');
const [assignUser, setAssignUser] = useState<string[]>([]);
const [assignedRole, setAssignedRole] = useState<string>('');
return (
<div className="fmtm-flex fmtm-flex-col fmtm-gap-5 lg:fmtm-gap-10">
<div>
<div className="fmtm-flex fmtm-gap-2">
<div className="fmtm-flex-grow">
<InputTextField
id="name"
name="name"
label="Assign User"
value={user}
onChange={(e) => setUser(e.target.value)}
fieldType="text"
/>
</div>
<AssetModules.AddIcon
className="fmtm-bg-red-600 fmtm-text-white fmtm-rounded-full hover:fmtm-bg-red-700 hover:fmtm-cursor-pointer fmtm-mt-9"
onClick={() => {
setAssignUser([...assignUser, user]);
setUser('');
}}
/>
</div>
{assignUser.length > 0 && (
<div>
<Chips
data={assignUser}
clearChip={(i) => {
setAssignUser((prevAssignUser) => assignUser.filter((_, index) => index !== i));
}}
/>
</div>
)}
</div>
<CustomSelect
title="Assign as"
placeholder="Choose"
data={roleList}
dataKey="value"
value={assignedRole}
valueKey="value"
label="label"
onValueChange={(value) => setAssignedRole(value)}
className="fmtm-bg-white"
/>
<div className="fmtm-flex fmtm-justify-center">
<Button btnText="ASSIGN" btnType="primary" className="fmtm-rounded-md" />
</div>
</div>
);
};

export default AssignTab;
Loading
Loading