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

New explore dropdown UI #2336

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ccb9213
feat(style): update new explore dropdown ui for desktop
sunilsabatp Dec 12, 2024
60ab7d6
feat: revamp explore dropdown UI for mobile
sunilsabatp Dec 18, 2024
e0c3ae7
feat(map-settings): add MapSettings component with forest, soil, and …
sunilsabatp Dec 23, 2024
58456f8
feat: add scrollable container for explore items and hide scrollbars
sunilsabatp Dec 23, 2024
ea978bb
Merge remote-tracking branch 'origin' into feature/new-explore-ui
sunilsabatp Dec 23, 2024
b9074b8
feat: add LayerInfoPopupContent component for displaying layer detail…
sunilsabatp Dec 24, 2024
732b4ab
chore: commented out portions of the code related to map layer functi…
sunilsabatp Dec 24, 2024
d5dda28
chore: remove unuse prop.
sunilsabatp Dec 24, 2024
1cddf29
Merge branch 'develop' into feature/new-explore-ui
sunilsabatp Jan 2, 2025
fbd4cc7
Merge branch 'develop' into feature/new-explore-ui
mohitb35 Jan 28, 2025
e31442a
refactor: create separate MobileMapSettingsLayout
mohitb35 Jan 29, 2025
cfe9c10
refactor: rename MapLayerControlPanel to MapSettingsSection and updat…
mohitb35 Jan 29, 2025
6dd0953
feat: adds mapSettings.config to describe available MapSettings options
mohitb35 Jan 30, 2025
7954e32
feat: refactor info popup functionality for MapSettings
mohitb35 Jan 30, 2025
597a6a7
fix: increase explore button/menu width for non-mobile screen
mohitb35 Jan 31, 2025
7ef27e7
feat: modifies explore button layout with subtitle
mohitb35 Jan 31, 2025
dc684b9
feat: makes scroll content bottom obvious in MobileMapSettingsLayout
mohitb35 Jan 31, 2025
c26a6a1
[CodeFactor] Apply fixes to commit dc684b9
code-factor Jan 31, 2025
b3525ff
feat: makes header/scrollable content separation more subtle
mohitb35 Jan 31, 2025
5eddbd4
Merge branch 'feature/new-explore-ui' of https://github.com/Plant-for…
mohitb35 Jan 31, 2025
12ba0e3
Merge branch 'develop' into feature/new-explore-ui
mohitb35 Jan 31, 2025
49f386e
fix: resolve erratic popover behavior in MapFeatureExplorer
mohitb35 Jan 31, 2025
7925aa5
feat: links up toggle actions with updating MapOptions
mohitb35 Jan 31, 2025
3874bfc
refactor: extract YearRangeSlider to separate component (unused)
mohitb35 Jan 31, 2025
d7cef46
refactor: clean up unused styles and components in MapFeatureExplorer
mohitb35 Jan 31, 2025
ff6494b
refactor: move CustomSlider into YearSlider (unused)
mohitb35 Jan 31, 2025
d6983c5
fix: improve Modal accessibility and close behavior in MapFeatureExpl…
mohitb35 Jan 31, 2025
aaa0f1c
fix: minor cleanup
mohitb35 Jan 31, 2025
0f99a00
fix: update translations for MapFeatureExplorer explore layers
mohitb35 Jan 31, 2025
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
35 changes: 34 additions & 1 deletion public/static/locales/en/maps.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,39 @@
"showProjectDetails": "Show Project Details",
"hideProjectList": "Hide Project List",
"hideProjectDetails": "Hide Project Details",
"countries": "Countries"
"countries": "Countries",
"exploreLayers": {
"groups": {
"forests": "Forest",
"soil": "Soil",
"biodiversity": "Biodiversity",
"risks": "Risks"
},
"settingsLabels": {
"projects": "Projects",
"forestCover": "Forest Cover",
"forestBiomass": "Forest Biomass",
"potentialForestBiomass": "Potential Additional Forest Biomass",
"deforestation": "Deforestation",
"canopyHeight": "Canopy Height",
"soilNitrogen": "Soil Nitrogen",
"soilPH": "Soil pH",
"soilOrganicCarbon": "Soil Organic Carbon",
"soilBulkDensity": "Soil Bulk Density",
"treeSpeciesDensity": "Tree Species Density",
"birdsDensity": "Birds Density",
"mammalsDensity": "Mammals Density",
"amphibiansDensity": "Amphibians Density",
"fireRisk": "Fire Risk",
"deforestationRisk": "Deforestation Risk"
},
"additionalInfo": {
"dataYears": "Data years",
"resolution": "Resolution",
"description": "Description",
"underlyingData": "Underlying Data",
"source": "Source"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const ProjectListControlForMobile = ({
<MapFeatureExplorer
mapOptions={mapOptions}
updateMapOption={updateMapOption}
isMobile={true}
/>
)}
<ViewModeTabs {...viewModeTabsProps} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { fontSizes, light, primaryColorNew } = theme;

const CustomButton = styled(Button)(() => ({
'&.MuiButton-root': {
width: '182px',
width: '240px',
height: '47px',
backgroundColor: `${light.light}`,
borderRadius: '12px',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Switch, styled } from '@mui/material';
import themeProperties from '../../../../theme/themeProperties';

interface SwitchProps {
customColor?: string;
Expand Down Expand Up @@ -34,9 +35,9 @@ export const StyledSwitch = styled(SmallSwitch, {
shouldForwardProp: (prop) => prop !== 'customColor',
})<SwitchProps>(({ customColor }) => ({
'.MuiSwitch-switchBase.Mui-checked': {
color: customColor,
color: customColor || themeProperties.primaryDarkColor,
},
'.MuiSwitch-switchBase.Mui-checked+.MuiSwitch-track': {
backgroundColor: customColor,
backgroundColor: customColor || themeProperties.primaryDarkColor,
},
}));
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,137 @@
}
}

.exploreButtonContent {
display: flex;
flex-direction: column;
align-items: flex-start;

h3 {
font-size: $fontSmall;
@include xsPhoneView {
font-size: $fontXXSmall;
}
}

p {
font-weight: 400;
}
}

.exploreMainContainer {
max-width: 182px;
background-color: $backgroundColor;
max-width: 240px;
background-color: #fff;
border-radius: 12px;
margin-top: 10px;
padding: 14px 16px;
padding: 12px;
box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.12);
max-height: 485px;

&::-webkit-scrollbar {
display: none;
}
mohitb35 marked this conversation as resolved.
Show resolved Hide resolved

@include xsPhoneView {
position: absolute;
max-height: 100vh;
height: 100vh;
overflow-y: scroll;
min-width: 293px;
border-radius: 12px 0 0 12px;
right: 0px;
margin-top: 0;
mohitb35 marked this conversation as resolved.
Show resolved Hide resolved
}
}

.exploreContainer {
width: 150px;
.exploreItemsContainer {
max-height: 400px;
overflow-y: auto;

&::-webkit-scrollbar {
display: none;
}

@include xsPhoneView {
max-height: max-content;
}
}
mohitb35 marked this conversation as resolved.
Show resolved Hide resolved

.exploreItemSection {
background: rgba(0, 122, 73, 0.05);
border-radius: 8px;
padding: 8px 9px;
font-size: 12px;
margin-bottom: 10px;

h2 {
font-weight: 600;
margin-bottom: 6px;
font-size: $fontSmall;
}
}

.singleLayerOption {
display: flex;
justify-content: space-between;
gap: 10px;
align-items: center;
padding: 6px 0;
border-bottom: 1px solid $horizontalLineColor;

&:last-child {
border-bottom: none;
}

.layerLabel {
cursor: default;

&.additionalInfo {
cursor: help;
p {
text-decoration: $horizontalLineColor dashed underline;
text-underline-offset: 2px;
}
}
}

.mapLayer {
cursor: pointer;
}

hr {
border-top: 1px dashed rgba(189, 189, 189, 1);
margin-top: 0px;
margin-bottom: 0px;
}
}

.layerInfoPopupContainer {
display: flex;
flex-direction: column;
gap: 8px;
max-width: 189px;
background: #fff;
padding: 12px;
font-size: 10px;

.label {
font-weight: 600;
color: rgba(130, 130, 130, 1);
text-transform: uppercase;
}
.source {
color: $primaryDarkColor;
}
mohitb35 marked this conversation as resolved.
Show resolved Hide resolved
}

.toggleMainContainer {
padding: 15px 9px;
height: 14px;
display: flex;
align-items: center;
justify-content: space-between;
background: rgba(0, 122, 73, 0.05);
border-radius: 8px;
}

.toggleContainer {
Expand Down Expand Up @@ -86,11 +195,8 @@
}

.exploreDescription {
padding: 8px;
height: fit-content;
margin-top: 14px;
background-color: rgba(var(--explore-description-background-color-new), 1);
font-size: $fontXXSmall;
font-size: var(--font-xx-extra-small);
border-radius: 6px;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,73 +1,68 @@
import type { ChangeEvent, FC } from 'react';
import type { FC } from 'react';
import type { MapOptions } from '../../ProjectsMapContext';
import type { SetState } from '../../../common/types/common';

import styles from './MapFeatureExplorer.module.scss';
import { MapLayerToggle } from '.';
// // import { MapLayerToggle } from '.';
// import InfoIcon from '../../../../../public/assets/images/icons/projectV2/InfoIcon';
import { StyledSwitch } from './CustomSwitch';
// import { StyledSwitch } from './CustomSwitch';
// import { YearRangeSlider } from '.';
import { useTranslations } from 'next-intl';
// import themeProperties from '../../../../theme/themeProperties';
import MapSettingsSection from './microComponents/MapSettingsSection';
import MobileMapSettingsLayout from './MobileMapSettingsLayout';
import { mapSettingsConfig } from '../../../../utils/mapsV2/mapSettings.config';

type MapSettingsProps = {
mapOptions: MapOptions;
updateMapOption: (option: keyof MapOptions, value: boolean) => void;
isMobile?: boolean;
setIsOpen?: SetState<boolean>;
};

const MapSettings: FC<MapSettingsProps> = ({ mapOptions, updateMapOption }) => {
const tAllProjects = useTranslations('AllProjects');
const MapSettings: FC<MapSettingsProps> = ({
mapOptions,
updateMapOption,

Check notice on line 24 in src/features/projectsV2/ProjectsMap/MapFeatureExplorer/MapSettings.tsx

View check run for this annotation

codefactor.io / CodeFactor

src/features/projectsV2/ProjectsMap/MapFeatureExplorer/MapSettings.tsx#L24

'mapOptions' is defined but never used. Allowed unused args must match /^_/u. (@typescript-eslint/no-unused-vars)
isMobile,

Check notice on line 25 in src/features/projectsV2/ProjectsMap/MapFeatureExplorer/MapSettings.tsx

View check run for this annotation

codefactor.io / CodeFactor

src/features/projectsV2/ProjectsMap/MapFeatureExplorer/MapSettings.tsx#L25

'updateMapOption' is defined but never used. Allowed unused args must match /^_/u. (@typescript-eslint/no-unused-vars)
setIsOpen,
}) => {
mohitb35 marked this conversation as resolved.
Show resolved Hide resolved
const tMaps = useTranslations('Maps');
/* const {
primaryColorNew,
restorationToggleColorNew,
deforestrationToggleColorNew,
} = themeProperties; */

const content = (
<>
<MapSettingsSection config={mapSettingsConfig.projects} />
<MapSettingsSection
groupKey="forests"
config={mapSettingsConfig.forests}
/>
<MapSettingsSection groupKey="soil" config={mapSettingsConfig.soil} />
<MapSettingsSection
groupKey="biodiversity"
config={mapSettingsConfig.biodiversity}
/>
<MapSettingsSection groupKey="risks" config={mapSettingsConfig.risks} />
<div className={styles.exploreDescription}>{tMaps('3trilliontrees')}</div>
</>
);

if (isMobile && setIsOpen) {
return (
<MobileMapSettingsLayout setIsOpen={setIsOpen}>
{content}
</MobileMapSettingsLayout>
);
}

return (
<div className={styles.exploreMainContainer}>
<div className={styles.exploreContainer}>
<div>
{/* <MapLayerToggle
infoIcon={<InfoIcon width={'10px'} />}
label={tAllProjects('currentForests')}
switchComponent={
<StyledSwitch customColor={`${primaryColorNew}`} />
}
/>
<div className={styles.hrLine} />
<MapLayerToggle
infoIcon={<InfoIcon width={'10px'} />}
label={tAllProjects('restorationPotential')}
switchComponent={
<StyledSwitch customColor={`${restorationToggleColorNew}`} />
}
/>
<div className={styles.hrLine} />
<MapLayerToggle
<div className={styles.exploreItemsContainer}>
{/* <MapLayerToggle
infoIcon={<InfoIcon width={'10px'} />}
label={tAllProjects('deforestation')}
switchComponent={
<StyledSwitch customColor={`${deforestrationToggleColorNew}`} />
}
/>
<div className={styles.hrLine} /> */}
<MapLayerToggle
infoIcon={undefined}
label={tAllProjects('projects')}
switchComponent={
<StyledSwitch
checked={mapOptions['showProjects']}
onChange={(
_event: ChangeEvent<HTMLInputElement>,
checked: boolean
) => updateMapOption('showProjects', checked)}
/>
}
/>
</div>
<div className={styles.exploreDescription}>
{tMaps('3trilliontrees')}
</div>
/> */}
{content}
</div>
</div>
);
Expand Down
Loading
Loading