From d14062a72ecfbf5fff5ed1e3fad0320f472ebf61 Mon Sep 17 00:00:00 2001 From: Nishit Suwal <81785002+NSUWAL123@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:27:50 +0545 Subject: [PATCH] Fix project details map (#910) * feat (projectDetails): map - for small screen, full screen map visible(only map visible) * feat (projectDetails): map - footer added to the map * fix (MobileFooter) - border top added * feat (bottomSheet): bottomSheet component made for mobile device * feat (projectDetails): activities - bottomSheet made for activities * feat (projectDetails): project info - added bottom sheet for project information for small screen * feat (projectDetails) - fmtm logo and back button added for small screen * fix (Accordion): interface added to props * feat/fix (projectDetails): projectDetails component projectOption section splitted to projectOption component. projectOptions added for others bottomSheet * fix (projectDetails): bottomSheet - converted css to tailwind css, converted dom manipulation to react states * fix (projectDetails): map - mapcontrols button gap reduced for small screens * fix (bottomSheet): fmtm logo move bottom sheet expand/contract * fix (projectDetails): margins/paddings updated for mobile view * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- CONTRIBUTING.md | 1 + src/frontend/src/api/Project.js | 1 + .../src/components/ActivitiesPanel.jsx | 2 +- src/frontend/src/components/OpenLayersMap.jsx | 18 +- .../MobileActivitiesContents.tsx | 27 ++ .../ProjectDetails/MobileFooter.tsx | 91 ++++ .../MobileProjectInfoContent.tsx | 31 ++ .../ProjectDetails/ProjectOptions.tsx | 161 +++++++ .../src/components/common/Accordion.tsx | 12 +- .../src/components/common/BottomSheet.tsx | 110 +++++ src/frontend/src/shared/AssetModules.js | 6 + src/frontend/src/store/slices/ProjectSlice.ts | 4 + src/frontend/src/styles/home.scss | 2 +- src/frontend/src/views/MainView.jsx | 18 +- src/frontend/src/views/ProjectDetails.jsx | 413 +++++++----------- 15 files changed, 640 insertions(+), 257 deletions(-) create mode 100644 src/frontend/src/components/ProjectDetails/MobileActivitiesContents.tsx create mode 100644 src/frontend/src/components/ProjectDetails/MobileFooter.tsx create mode 100644 src/frontend/src/components/ProjectDetails/MobileProjectInfoContent.tsx create mode 100644 src/frontend/src/components/ProjectDetails/ProjectOptions.tsx create mode 100644 src/frontend/src/components/common/BottomSheet.tsx diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2eb27e340d..322f93b478 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,6 +17,7 @@ Right now, we are in the process of building the prototype. We warmly welcome yo Create pull requests (PRs) for changes that you think are needed. We would really appreciate your help! Skills with the following would be beneficial: + - Python - FastAPI - Javascript diff --git a/src/frontend/src/api/Project.js b/src/frontend/src/api/Project.js index e0e5288e90..66a21d6c87 100755 --- a/src/frontend/src/api/Project.js +++ b/src/frontend/src/api/Project.js @@ -44,6 +44,7 @@ export const ProjectById = (url, existingProjectList, projectId) => { title: resp.project_info?.[0]?.name, location_str: resp.location_str, description: resp.project_info[0]?.description, + short_description: resp.project_info[0]?.short_description, num_contributors: resp.num_contributors, total_tasks: resp.total_tasks, tasks_mapped: resp.tasks_mapped, diff --git a/src/frontend/src/components/ActivitiesPanel.jsx b/src/frontend/src/components/ActivitiesPanel.jsx index f85cdfd6d7..f2ab3d369a 100755 --- a/src/frontend/src/components/ActivitiesPanel.jsx +++ b/src/frontend/src/components/ActivitiesPanel.jsx @@ -114,7 +114,7 @@ const ActivitiesPanel = ({ defaultTheme, state, params, map, view, mapDivPostion }, [taskDisplay, state, searchText]); return ( - + state.project.taskModalStatus); + const { windowSize } = WindowDimension(); + function elastic(t) { return Math.pow(2, -10 * t) * Math.sin(((t - 0.075) * (2 * Math.PI)) / 0.3) + 1; } @@ -177,7 +181,9 @@ const OpenLayersMap = ({ btnDiv.className = 'ol-unselectable ol-control'; index == 0 ? (btnDiv.style.top = `${(btnsPosition = btnsPosition + 2)}%`) - : (btnDiv.style.top = `${(btnsPosition = btnsPosition + 9)}%`); + : windowSize.width >= 640 + ? (btnDiv.style.top = `${(btnsPosition = btnsPosition + 9)}%`) + : (btnDiv.style.top = `${(btnsPosition = btnsPosition + 6)}%`); btnDiv.appendChild(btn); var control = new Control({ element: btnDiv, @@ -322,13 +328,17 @@ const OpenLayersMap = ({ }, [map, currentLocLayer]); return ( - +
{/*