diff --git a/app/javascript/components/maps/components/menu/components/menu-panel/component.jsx b/app/javascript/components/maps/components/menu/components/menu-panel/component.jsx
index c3daabdefe..771dcee911 100644
--- a/app/javascript/components/maps/components/menu/components/menu-panel/component.jsx
+++ b/app/javascript/components/maps/components/menu/components/menu-panel/component.jsx
@@ -50,9 +50,11 @@ class MenuPanel extends PureComponent {
category,
large,
onClose,
+ onOpen,
children,
loading,
- setMenuSettings
+ setMenuSettings,
+ collapsed
} = this.props;
const Panel = isDesktop ? PanelDesktop : PanelMobile;
@@ -85,9 +87,12 @@ class MenuPanel extends PureComponent {
) : (
@@ -114,7 +119,9 @@ MenuPanel.propTypes = {
label: PropTypes.string,
category: PropTypes.string,
active: PropTypes.bool,
- loading: PropTypes.bool
+ loading: PropTypes.bool,
+ collapsed: PropTypes.bool,
+ onOpen: PropTypes.func
};
export default MenuPanel;
diff --git a/app/javascript/components/maps/components/menu/components/menu-panel/styles.scss b/app/javascript/components/maps/components/menu/components/menu-panel/styles.scss
index 0b3bd873b0..525b8c3d44 100644
--- a/app/javascript/components/maps/components/menu/components/menu-panel/styles.scss
+++ b/app/javascript/components/maps/components/menu/components/menu-panel/styles.scss
@@ -81,6 +81,10 @@ $map-menu-panel-width-big: rem(560px);
.button-wrapper {
justify-content: flex-end;
}
+
+ .collapsed {
+ transform: rotate(180deg);
+ }
}
}
diff --git a/app/javascript/components/maps/components/menu/menu-component.jsx b/app/javascript/components/maps/components/menu/menu-component.jsx
index f6df270c28..d4e041f491 100644
--- a/app/javascript/components/maps/components/menu/menu-component.jsx
+++ b/app/javascript/components/maps/components/menu/menu-component.jsx
@@ -1,7 +1,5 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
-import MediaQuery from 'react-responsive';
-import { SCREEN_M } from 'utils/constants';
import cx from 'classnames';
import isEqual from 'lodash/isEqual';
import remove from 'lodash/remove';
@@ -47,10 +45,9 @@ class MapMenu extends PureComponent {
const {
showAnalysis,
setMenuSettings,
- setRecentImagerySettings,
location,
- recentVisible,
menuSection,
+ recentActive,
isDesktop
} = this.props;
if (
@@ -63,19 +60,14 @@ class MapMenu extends PureComponent {
showAnalysis();
}
- if (!isDesktop && recentVisible) {
- setMenuSettings({ menuSection: 'recent-imagery' });
+ if (!isDesktop && !menuSection && recentActive) {
+ setMenuSettings({ menuSection: 'recent-imagery-collapsed' });
}
if (
- !isDesktop &&
- !menuSection &&
- !isEqual(menuSection, prevProps.menuSection)
+ !isEqual(isDesktop, prevProps.isDesktop) ||
+ (!recentActive && !isEqual(recentActive, prevProps.recentActive))
) {
- setRecentImagerySettings({ visible: false });
- }
-
- if (!isEqual(isDesktop, prevProps.isDesktop)) {
setMenuSettings({ menuSection: '' });
}
}
@@ -92,63 +84,69 @@ class MapMenu extends PureComponent {
loading,
analysisLoading,
embed,
+ isDesktop,
...props
} = this.props;
- const { Component, label, category, large, icon, ...rest } =
+ const {
+ Component,
+ label,
+ category,
+ large,
+ icon,
+ collapsed,
+ openSection,
+ ...rest
+ } =
activeSection || {};
return (
-
- {isDesktop => (
-
-
- {isDesktop &&
- !embed && (
-
- )}
- {!isDesktop && (
-
- )}
-
-
+
+ {isDesktop &&
+ !embed && (
+
+ )}
+ {!isDesktop && (
+
+ )}
+
+
+ setMenuSettings({ menuSection: '', datasetCategory: '' })
+ }
+ onOpen={() => setMenuSettings({ menuSection: openSection })}
+ >
+ {Component && (
+
- setMenuSettings({ menuSection: '', datasetCategory: '' })
- }
- >
- {Component && (
-
- )}
-
-
- )}
-
+ onToggleLayer={this.onToggleLayer}
+ {...props}
+ {...menuSection === 'datasets' && {
+ ...rest
+ }}
+ />
+ )}
+
+
);
}
}
@@ -177,10 +175,9 @@ MapMenu.propTypes = {
datasetCategory: PropTypes.string,
showAnalysis: PropTypes.func,
location: PropTypes.object,
- setRecentImagerySettings: PropTypes.func,
- recentVisible: PropTypes.bool,
isDesktop: PropTypes.bool,
- embed: PropTypes.bool
+ embed: PropTypes.bool,
+ recentActive: PropTypes.bool
};
export default MapMenu;
diff --git a/app/javascript/components/maps/components/menu/menu-sections.js b/app/javascript/components/maps/components/menu/menu-sections.js
index 9d5957f3a1..c933cfac37 100644
--- a/app/javascript/components/maps/components/menu/menu-sections.js
+++ b/app/javascript/components/maps/components/menu/menu-sections.js
@@ -51,11 +51,17 @@ export const mobileSections = [
Component: Search
},
{
- label: 'Recent Imagery',
+ label: 'Recent Satellite Imagery',
slug: 'recent-imagery',
- icon: searchIcon,
Component: RecentImagerySettings,
hidden: true
+ },
+ {
+ label: 'Recent Satellite Imagery',
+ slug: 'recent-imagery-collapsed',
+ openSection: 'recent-imagery',
+ collapsed: true,
+ hidden: true
}
];
diff --git a/app/javascript/components/maps/components/menu/menu-selectors.js b/app/javascript/components/maps/components/menu/menu-selectors.js
index 1b2f8d29a1..729a7a457d 100644
--- a/app/javascript/components/maps/components/menu/menu-selectors.js
+++ b/app/javascript/components/maps/components/menu/menu-selectors.js
@@ -5,8 +5,8 @@ import flatten from 'lodash/flatten';
import { getActiveDatasetsFromState } from 'components/maps/map/selectors';
import { getEmbed } from 'components/maps/main-map/selectors';
+import { getActive } from 'components/maps/main-map/components/recent-imagery/recent-imagery-selectors';
-import { getVisibility } from 'components/maps/main-map/components/recent-imagery/recent-imagery-selectors';
import { initialState } from './menu-reducers';
import {
datasetsSections,
@@ -270,5 +270,5 @@ export const getMenuProps = createStructuredSelector({
location: getLocation,
loading: getLoading,
analysisLoading: getAnalysisLoading,
- recentVisible: getVisibility
+ recentActive: getActive
});
diff --git a/app/javascript/components/maps/components/menu/menu.js b/app/javascript/components/maps/components/menu/menu.js
index be61b4731e..b34987c070 100644
--- a/app/javascript/components/maps/components/menu/menu.js
+++ b/app/javascript/components/maps/components/menu/menu.js
@@ -1,7 +1,6 @@
import { connect } from 'react-redux';
import reducerRegistry from 'app/registry';
-import { setRecentImagerySettings } from 'components/maps/main-map/components/recent-imagery/recent-imagery-actions';
import { setMapSettings } from 'components/maps/map/actions';
import * as actions from './menu-actions';
import reducers, { initialState } from './menu-reducers';
@@ -16,6 +15,5 @@ reducerRegistry.registerModule('mapMenu', {
export default connect(getMenuProps, {
...actions,
- setRecentImagerySettings,
setMapSettings
})(MenuComponent);
diff --git a/app/javascript/components/maps/main-map/component.jsx b/app/javascript/components/maps/main-map/component.jsx
index baa09a1390..d29a1877cb 100644
--- a/app/javascript/components/maps/main-map/component.jsx
+++ b/app/javascript/components/maps/main-map/component.jsx
@@ -2,10 +2,7 @@ import React, { PureComponent, Fragment } from 'react';
import PropTypes from 'prop-types';
import { SCREEN_M } from 'utils/constants';
import cx from 'classnames';
-import startCase from 'lodash/startCase';
-import upperFirst from 'lodash/upperFirst';
import MediaQuery from 'react-responsive';
-import { track } from 'app/analytics';
import { Tooltip } from 'react-tippy';
import Tip from 'components/ui/tip';
@@ -20,18 +17,6 @@ import MapControlButtons from './components/map-controls';
import './styles.scss';
class MainMapComponent extends PureComponent {
- renderDataTooltip = data => (
-
- {Object.keys(data).map(key => (
-
- {upperFirst(startCase(key).toLowerCase())}:{' '}
- {data[key]}
-
- ))}
-
Click to view more.
-
- );
-
renderInfoTooltip = string => (
{string}
@@ -40,16 +25,12 @@ class MainMapComponent extends PureComponent {
render() {
const {
- draw,
embed,
hidePanels,
oneClickAnalysis,
- tileGeoJSON,
showTooltip,
tooltipData,
- setRecentImagerySettings,
handleClickMap,
- handleRecentImageryTooltip,
handleShowTooltip
} = this.props;
@@ -74,11 +55,7 @@ class MainMapComponent extends PureComponent {
html={
}
position="top"
@@ -88,45 +65,7 @@ class MainMapComponent extends PureComponent {
open={showTooltip}
disabled={!isDesktop}
>
-
{isDesktop &&
@@ -164,10 +103,6 @@ MainMapComponent.propTypes = {
oneClickAnalysis: PropTypes.bool,
embed: PropTypes.bool,
hidePanels: PropTypes.bool,
- setRecentImagerySettings: PropTypes.func,
- handleRecentImageryTooltip: PropTypes.func,
- tileGeoJSON: PropTypes.object,
- draw: PropTypes.bool,
tooltipData: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
showTooltip: PropTypes.bool
};
diff --git a/app/javascript/components/maps/main-map/components/data-analysis-menu/component.jsx b/app/javascript/components/maps/main-map/components/data-analysis-menu/component.jsx
index 3179a83fb9..3a5367d223 100644
--- a/app/javascript/components/maps/main-map/components/data-analysis-menu/component.jsx
+++ b/app/javascript/components/maps/main-map/components/data-analysis-menu/component.jsx
@@ -40,7 +40,7 @@ class DataAnalysisMenu extends PureComponent {
className={cx(
'c-data-analysis-menu',
'map-tour-legend',
- { relocate: !!menuSection },
+ { relocate: !!menuSection && menuSection.Component },
{ big: menuSection && menuSection.large },
{ embed },
className
diff --git a/app/javascript/components/maps/main-map/components/map-controls/map-controls-component.jsx b/app/javascript/components/maps/main-map/components/map-controls/map-controls-component.jsx
index 4170779ae6..f37fea5810 100644
--- a/app/javascript/components/maps/main-map/components/map-controls/map-controls-component.jsx
+++ b/app/javascript/components/maps/main-map/components/map-controls/map-controls-component.jsx
@@ -8,10 +8,9 @@ import { isParent } from 'utils/dom';
import { track } from 'app/analytics';
import Basemaps from 'components/maps/components/basemaps';
-import RecentImagerySettings from 'components/maps/main-map/components/recent-imagery/components/recent-imagery-settings-tooltip';
+import RecentImagerySettings from 'components/maps/main-map/components/recent-imagery/components/recent-imagery-settings';
import Button from 'components/ui/button';
import Icon from 'components/ui/icon';
-import Loader from 'components/ui/loader';
import plusIcon from 'assets/icons/plus.svg';
import minusIcon from 'assets/icons/minus.svg';
@@ -40,17 +39,9 @@ class MapControlsButtons extends PureComponent {
setPulseTourBtn = pulseTourBtn => this.setState({ pulseTourBtn });
handleHidePanels = () => {
- const {
- setMainMapSettings,
- setMenuSettings,
- setRecentImagerySettings,
- hidePanels
- } = this.props;
+ const { setMainMapSettings, setMenuSettings, hidePanels } = this.props;
setMainMapSettings({ hidePanels: !hidePanels });
setMenuSettings({ menuSection: '' });
- setRecentImagerySettings({
- visible: false
- });
this.setState({ showBasemaps: false });
if (!hidePanels) {
track('hidePanels');
@@ -65,32 +56,17 @@ class MapControlsButtons extends PureComponent {
}
};
- onRecentRequestClose = () => {
- const { setRecentImagerySettings } = this.props;
- const isTargetOnTooltip = isParent(
- this.recentImageryRef,
- this.recentImageryRef.evt
- );
- this.recentImageryRef.clearEvt();
- if (!isTargetOnTooltip && this.props.recentSettings.active) {
- setRecentImagerySettings({ visible: false });
- }
- };
-
toggleBasemaps = () => {
- const {
- setRecentImagerySettings,
- setMainMapSettings,
- showBasemaps
- } = this.props;
+ const { setMainMapSettings, showBasemaps, recentActive } = this.props;
setMainMapSettings({ showBasemaps: !showBasemaps });
- setRecentImagerySettings({ visible: false });
+ if (recentActive) {
+ this.handleToggleRecentImagery();
+ }
};
handleToggleRecentImagery = () => {
const {
setMapSettings,
- setRecentImagerySettings,
recentImageryDataset,
recentActive,
mapSettings: { datasets, zoom }
@@ -108,9 +84,6 @@ class MapControlsButtons extends PureComponent {
datasets: newDatasets,
zoom: !recentActive && zoom < 9 ? 9 : zoom
});
- setRecentImagerySettings({
- visible: false
- });
if (!recentActive) {
track('recentImageryEnable');
}
@@ -125,33 +98,22 @@ class MapControlsButtons extends PureComponent {
};
renderRecentImageryBtn = () => {
- const {
- recentSettings,
- recentLoading,
- recentActive,
- datasetsLoading
- } = this.props;
- const { visible } = recentSettings || {};
+ const { recentActive, datasetsLoading } = this.props;
return (
-