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 project details map #917

Merged
merged 24 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a54b024
feat (projectDetails): map - for small screen, full screen map visibl…
NSUWAL123 Oct 11, 2023
7f8af19
feat (projectDetails): map - footer added to the map
NSUWAL123 Oct 11, 2023
786cc4e
fix (MobileFooter) - border top added
NSUWAL123 Oct 12, 2023
651644e
feat (bottomSheet): bottomSheet component made for mobile device
NSUWAL123 Oct 12, 2023
70f1dc3
feat (projectDetails): activities - bottomSheet made for activities
NSUWAL123 Oct 12, 2023
f545429
feat (projectDetails): project info - added bottom sheet for project …
NSUWAL123 Oct 12, 2023
e8008f7
feat (projectDetails) - fmtm logo and back button added for small screen
NSUWAL123 Oct 12, 2023
3606915
fix (Accordion): interface added to props
NSUWAL123 Oct 12, 2023
bc65a24
feat/fix (projectDetails): projectDetails component projectOption sec…
NSUWAL123 Oct 12, 2023
c17cb6d
fix (projectDetails): bottomSheet - converted css to tailwind css, co…
NSUWAL123 Oct 13, 2023
807627c
fix (projectDetails): map - mapcontrols button gap reduced for small …
NSUWAL123 Oct 13, 2023
d7b59b8
fix (bottomSheet): fmtm logo move bottom sheet expand/contract
NSUWAL123 Oct 13, 2023
8c252c9
Merge branch 'development' of https://github.com/hotosm/fmtm into fix…
NSUWAL123 Oct 13, 2023
9577d4c
fix (projectDetails): margins/paddings updated for mobile view
NSUWAL123 Oct 13, 2023
9c9418e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 13, 2023
c1e4c1e
fix (Icons): new icon added
NSUWAL123 Oct 17, 2023
17276c7
fix (projectDetails): accordion for projectOptions for small screen r…
NSUWAL123 Oct 17, 2023
96b0ec5
fix (projectDetails): mapLegends seperated to different bottomSheet f…
NSUWAL123 Oct 17, 2023
8c32f70
fix (projectDetails): mapLegend added to mobile view footer, UI enhan…
NSUWAL123 Oct 17, 2023
fe22682
fix (projectDetails): mobile browser view - UI adjustments for mobile…
NSUWAL123 Oct 17, 2023
525a602
merge conflict solved
NSUWAL123 Oct 17, 2023
d6884b1
Merge branch 'fix-project-details-map' of https://github.com/NSUWAL12…
NSUWAL123 Oct 17, 2023
3f1be3f
fix (projectDetails): mapLegend - seperated component for rendering l…
NSUWAL123 Oct 17, 2023
d43e841
fix (projectDetails): mapLegend - seperated component for rendering l…
NSUWAL123 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
53 changes: 31 additions & 22 deletions src/frontend/src/components/MapLegends.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ const MapLegends = ({ direction, spacing, iconBtnProps, defaultTheme, valueStatu
type: 'locked',
},
];

const LegendListItem = ({ data }) => {
return (
<div className="fmtm-flex fmtm-items-center fmtm-gap-3">
<div className="fmtm-border-[1px] fmtm-border-gray-200">
{data.type !== 'locked' ? (
<CoreModules.IconButton
style={{ backgroundColor: data.color, borderRadius: 0 }}
{...iconBtnProps}
color="primary"
component="label"
className="fmtm-w-10 fmtm-h-10"
></CoreModules.IconButton>
) : (
<AssetModules.LockIcon sx={{ fontSize: '40px' }} />
)}
</div>
<p className="fmtm-text-lg">{data.value}</p>
</div>
);
};
return (
// <CoreModules.Stack direction={direction} spacing={spacing}>
// {MapDetails.map((data, index) => {
Expand All @@ -68,28 +89,16 @@ const MapLegends = ({ direction, spacing, iconBtnProps, defaultTheme, valueStatu
// );
// })}
// </CoreModules.Stack>

<div className="fmtm-flex fmtm-flex-col fmtm-gap-4">
{MapDetails.map((data, index) => {
return (
<div key={index} className="fmtm-flex fmtm-items-center fmtm-gap-3">
<div className="fmtm-border-[1px] fmtm-border-gray-200">
{data.type !== 'locked' ? (
<CoreModules.IconButton
style={{ backgroundColor: data.color, borderRadius: 0 }}
{...iconBtnProps}
color="primary"
component="label"
className="fmtm-w-10 fmtm-h-10"
></CoreModules.IconButton>
) : (
<AssetModules.LockIcon sx={{ fontSize: '40px' }} />
)}
</div>
<p className="fmtm-text-lg">{data.value}</p>
</div>
);
})}
<div>
<div className="fmtm-flex fmtm-gap-3 fmtm-border-b-[1px] fmtm-pb-2 fmtm-mb-4">
<AssetModules.LegendToggleIcon className=" fmtm-text-primaryRed" sx={{ fontSize: '35px' }} />
<p className="fmtm-text-2xl">Map Legend</p>
</div>
<div className="fmtm-flex fmtm-flex-col fmtm-gap-4">
{MapDetails.map((data, index) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NSUWAL123 Can you make a seperate component for this legend ? As right now its packed with too much html elements and rendering multiple elements.

return <LegendListItem data={data} key={index} />;
})}
</div>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const MobileActivitiesContents = ({ map, mainView, mapDivPostion }) => {
const defaultTheme = CoreModules.useAppSelector((state) => state.theme.hotTheme);

return (
<div className="fmtm-w-full fmtm-bg-white fmtm-mb-[10vh]">
<div className="fmtm-w-full fmtm-bg-white fmtm-mb-[12vh]">
<CoreModules.Stack sx={{ display: 'flex', flexDirection: 'row', justifyContent: 'center' }}>
<ActivitiesPanel
params={params}
Expand Down
35 changes: 24 additions & 11 deletions src/frontend/src/components/ProjectDetails/MobileFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ const MobileFooter = () => {
const dispatch = CoreModules.useAppDispatch();
const mobileFooterSelection = CoreModules.useAppSelector((state) => state.project.mobileFooterSelection);

console.log(mobileFooterSelection, 'mobileFooterSelection');

const footerItem = [
{
id: 'explore',
Expand Down Expand Up @@ -43,6 +41,18 @@ const MobileFooter = () => {
/>
),
},
{
id: 'mapLegend',
title: 'Legend',
icon: (
<AssetModules.LegendToggleIcon
className={`${
mobileFooterSelection === 'mapLegend' ? 'fmtm-text-primaryRed' : 'fmtm-text-gray-500'
} fmtm-duration-300`}
/>
),
},
,
{
id: 'others',
title: 'Others',
Expand All @@ -55,30 +65,33 @@ const MobileFooter = () => {
),
},
];

return (
<div className="fmtm-absolute fmtm-bottom-0 sm:fmtm-hidden fmtm-w-full fmtm-border-t-[1px]">
<div className="fmtm-w-full fmtm-grid fmtm-grid-cols-4 fmtm-bg-white fmtm-pb-4 fmtm-pt-2 fmtm-gap-5 fmtm-px-2">
<div
className={`fmtm-w-full fmtm-grid fmtm-grid-cols-${
footerItem.length - 1
} fmtm-bg-white fmtm-pb-16 fmtm-pt-2 fmtm-gap-5 fmtm-px-2`}
>
{footerItem.map((item) => (
<div
key={item.id}
onClick={() => dispatch(ProjectActions.SetMobileFooterSelection(item.id))}
key={item?.id}
onClick={() => dispatch(ProjectActions.SetMobileFooterSelection(item?.id))}
className="fmtm-group fmtm-cursor-pointer"
>
<div
className={`fmtm-w-full fmtm-flex fmtm-justify-center fmtm-py-1 fmtm-rounded-3xl fmtm-mb-1 fmtm-duration-300 ${
mobileFooterSelection === item.id ? 'fmtm-bg-red-100' : 'group-hover:fmtm-bg-gray-200'
mobileFooterSelection === item?.id ? 'fmtm-bg-red-100' : 'group-hover:fmtm-bg-gray-200'
}`}
>
<div>{item.icon}</div>
<div>{item?.icon}</div>
</div>
<div className="fmtm-flex fmtm-justify-center">
<p
className={`${
mobileFooterSelection === item.id ? 'fmtm-text-primaryRed' : 'fmtm-text-gray-500'
} fmtm-duration-300 fmtm-text-sm`}
mobileFooterSelection === item?.id ? 'fmtm-text-primaryRed' : 'fmtm-text-gray-500'
} fmtm-duration-300 fmtm-text-xs fmtm-whitespace-nowrap`}
>
{item.title}
{item?.title}
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import React from 'react';
import AssetModules from '../../shared/AssetModules';

const MobileProjectInfoContent = ({ projectInfo }) => {
console.log('projectInfo', projectInfo);
return (
<div className="fmtm-flex fmtm-flex-col fmtm-gap-3 fmtm-mb-[10vh]">
<div className="fmtm-flex fmtm-flex-col fmtm-gap-3 fmtm-mb-[12vh]">
<div className="fmtm-flex fmtm-gap-3 fmtm-border-b-[1px] fmtm-pb-2">
<AssetModules.InfoIcon className=" fmtm-text-primaryRed" sx={{ fontSize: '35px' }} />
<p className="fmtm-text-2xl">Project Information</p>
Expand Down
35 changes: 13 additions & 22 deletions src/frontend/src/components/ProjectDetails/ProjectOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import Accordion from '../../components/common/Accordion';
import React, { useState } from 'react';
import CoreModules from '../../shared/CoreModules';
import AssetModules from '../../shared/AssetModules';
import environment from '../../environment';
import { DownloadDataExtract, DownloadProjectForm } from '../../api/Project';
import MapLegends from '../../components/MapLegends';

const ProjectOptions = ({ setToggleGenerateModal }) => {
const dispatch = CoreModules.useAppDispatch();
Expand All @@ -13,7 +11,6 @@ const ProjectOptions = ({ setToggleGenerateModal }) => {
const [toggleAction, setToggleAction] = useState(false);
const downloadProjectFormLoading = CoreModules.useAppSelector((state) => state.project.downloadProjectFormLoading);
const downloadDataExtractLoading = CoreModules.useAppSelector((state) => state.project.downloadDataExtractLoading);
const defaultTheme = CoreModules.useAppSelector((state) => state.theme.hotTheme);

const encodedId = params.id;
const decodedId = environment.decode(encodedId);
Expand All @@ -35,8 +32,8 @@ const ProjectOptions = ({ setToggleGenerateModal }) => {
);
};
return (
<div className="fmtm-mt-4">
<div>
<div className="sm:fmtm-mt-4">
{/* <div>
<div
className={`fmtm-flex fmtm-gap-5 fmtm-py-4 sm:fmtm-hidden fmtm-justify-between fmtm-items-center fmtm-mx-4 sm:fmtm-mx-7 fmtm-mb-2 ${
toggleAction ? 'fmtm-border-b-[#929DB3] fmtm-border-b-[1px]' : ''
Expand All @@ -56,13 +53,20 @@ const ProjectOptions = ({ setToggleGenerateModal }) => {
/>
</div>
</div>
</div>
<div
</div> */}
{/* <div
className={`fmtm-flex fmtm-flex-col lg:fmtm-flex-row fmtm-gap-6 lg:fmtm-gap-0 fmtm-px-3 sm:fmtm-px-0 ${
toggleAction ? '' : 'fmtm-hidden sm:fmtm-flex'
}`}
> */}
<div className="fmtm-flex fmtm-gap-3 fmtm-border-b-[1px] fmtm-pb-2 fmtm-mb-4 sm:fmtm-hidden">
<AssetModules.ListViewIcon className=" fmtm-text-primaryRed" sx={{ fontSize: '35px' }} />
<p className="fmtm-text-2xl">Project Options</p>
</div>
<div
className={`fmtm-flex fmtm-flex-col lg:fmtm-flex-row fmtm-gap-6 lg:fmtm-gap-0 fmtm-px-3 sm:fmtm-px-0 sm:fmtm-flex`}
>
<div className="fmtm-w-full fmtm-flex fmtm-flex-col fmtm-items-start sm:fmtm-flex-row sm:fmtm-justify-center lg:fmtm-justify-start sm:fmtm-items-center fmtm-gap-6 fmtm-ml-2 sm:fmtm-ml-4">
<div className="fmtm-w-full fmtm-flex fmtm-flex-col fmtm-items-start sm:fmtm-flex-row sm:fmtm-justify-center lg:fmtm-justify-start sm:fmtm-items-center fmtm-gap-6 sm:fmtm-ml-4">
<CoreModules.LoadingButton
onClick={() => handleDownload('form')}
sx={{ width: 'unset' }}
Expand Down Expand Up @@ -98,7 +102,7 @@ const ProjectOptions = ({ setToggleGenerateModal }) => {
Data Extract
</CoreModules.LoadingButton>
</div>
<div className="fmtm-flex fmtm-flex-col sm:fmtm-flex-row sm:fmtm-justify-center lg:fmtm-justify-end fmtm-w-full fmtm-ml-2 sm:fmtm-ml-4 fmtm-gap-6">
<div className="fmtm-flex fmtm-flex-col sm:fmtm-flex-row sm:fmtm-justify-center lg:fmtm-justify-end fmtm-w-full sm:fmtm-ml-4 fmtm-gap-6">
<CoreModules.Link
to={`/projectInfo/${encodedId}`}
style={{
Expand Down Expand Up @@ -140,19 +144,6 @@ const ProjectOptions = ({ setToggleGenerateModal }) => {
</CoreModules.Button>
</CoreModules.Link>
</div>
<div className="fmtm-px-1 sm:fmtm-hidden">
<Accordion
collapsed={true}
disableHeaderClickToggle
onToggle={() => {}}
header={<div className="fmtm-text-[#2C3038] fmtm-font-bold fmtm-text-xl">Map Legends</div>}
body={
<div className="fmtm-mt-4">
<MapLegends defaultTheme={defaultTheme} />
</div>
}
/>
</div>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/components/common/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const BottomSheet = ({ body, onClose }) => {
sheetHeight = parseInt(sheetContentRef.current.style.height);
setCurrSheetHeight(sheetHeight);

sheetHeight < 25 ? hideBottomSheet() : sheetHeight > 75 ? updateSheetHeight(100) : updateSheetHeight(50);
sheetHeight < 25 ? hideBottomSheet() : sheetHeight > 75 ? updateSheetHeight(93) : updateSheetHeight(50);
};

useEffect(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/src/shared/AssetModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
Info as InfoIcon,
MoreVert as MoreVertIcon,
LocationOn as LocationOnIcon,
LegendToggle as LegendToggleIcon,
} from '@mui/icons-material';
import LockPng from '../assets/images/lock.png';
import RedLockPng from '../assets/images/red-lock.png';
Expand Down Expand Up @@ -102,4 +103,5 @@ export default {
InfoIcon,
MoreVertIcon,
LocationOnIcon,
LegendToggleIcon,
};
12 changes: 11 additions & 1 deletion src/frontend/src/views/ProjectDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,20 @@ const Home = () => {
<img src={FmtmLogo} alt="Hot Fmtm Logo" className="fmtm-ml-2 fmtm-z-10 fmtm-w-[5.2rem]" />
</div>
)}
{mobileFooterSelection === 'mapLegend' && (
<BottomSheet
body={
<div className="fmtm-mb-[12vh]">
<MapLegends defaultTheme={defaultTheme} />
</div>
}
onClose={() => dispatch(ProjectActions.SetMobileFooterSelection('explore'))}
/>
)}
{mobileFooterSelection === 'others' && (
<BottomSheet
body={
<div className="fmtm-mb-[10vh]">
<div className="fmtm-mb-[12vh]">
<ProjectOptions setToggleGenerateModal={setToggleGenerateModal} />
</div>
}
Expand Down
Loading