Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV 2001 - Enable descriptions and sidebar settings on mobile (#3786)

Jason Hurleyb9972061588b
diff --git a/web/css/sidebar.css b/web/css/sidebar.css
index 521a653b3..c16d22202 100644
--- a/web/css/sidebar.css
+++ b/web/css/sidebar.css
@@ -211,6 +211,12 @@ footer .compare-toggle-button {
color: #eee;
font-size: 14px;
padding: 6px 12px;
+
+ @media (max-width: 768px) {
+ font-size: 18px;
+ padding: 12px 14px;
+ }
+
&:hover {
color: #fff;
background-color: #d54e21;
@@ -287,6 +293,10 @@ footer .compare-toggle-button {
}
}
+ .layer-group-case .layer-group-more-options {
+ top: 10px;
+ }
+
#productsHolder footer .product-buttons {
height: 120px;
}
@@ -431,7 +441,7 @@ footer .compare-toggle-button {
> div {
display: flex;
flex-direction: column;
- justify-content: space-between;
+ justify-content: flex-start;
max-height: calc(var(--vh, 1vh) * 100 - 2px);
height: 100%;
}
@@ -459,14 +469,29 @@ footer .compare-toggle-button {
.layer-info-modal {
width: 500px;
+
.modal-body {
overflow-y: scroll;
max-height: calc(100vh - 200px);
}
+
+ @media (max-width: 768px) {
+ width: 100%;
+
+ .modal-body {
+ overflow-y: scroll;
+ max-height: 100%;
+ }
+ }
}
.layer-settings-modal {
width: 300px;
+
+ @media (max-width: 768px) {
+ width: 100%;
+ }
+
.nav-tabs {
border-bottom: none;
}
diff --git a/web/js/components/timeline/mobile-date-picker.js b/web/js/components/timeline/mobile-date-picker.js
index afcd34d69..2f3df64fc 100644
--- a/web/js/components/timeline/mobile-date-picker.js
+++ b/web/js/components/timeline/mobile-date-picker.js
@@ -193,7 +193,7 @@ class MobileDatePicker extends Component {
}
MobileDatePicker.propTypes = {
- date: PropTypes.string,
+ date: PropTypes.object,
endDateLimit: PropTypes.string,
hasSubdailyLayers: PropTypes.bool,
isMobile: PropTypes.bool,
diff --git a/web/js/containers/sidebar/layer-row.js b/web/js/containers/sidebar/layer-row.js
index 1e4e954c3..7a51e280b 100644
--- a/web/js/containers/sidebar/layer-row.js
+++ b/web/js/containers/sidebar/layer-row.js
@@ -8,7 +8,7 @@ import googleTagManager from 'googleTagManager';
import { connect } from 'react-redux';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
- UncontrolledTooltip,
+ UncontrolledTooltip, Dropdown, DropdownToggle, DropdownMenu, DropdownItem,
} from 'reactstrap';
import PaletteLegend from '../../components/sidebar/paletteLegend';
import util from '../../util/util';
@@ -78,7 +78,25 @@ function LayerRow (props) {
} = props;
const encodedLayerId = util.encodeId(layer.id);
+ const { title } = names;
+ const removeLayerBtnId = `close-${compareState}${encodedLayerId}`;
+ const removeLayerBtnTitle = 'Remove Layer';
+
+ const layerOptionsBtnId = `layer-options-btn-${encodedLayerId}`;
+ const layerOptionsBtnTitle = 'View Options';
+
+ const layerInfoBtnId = `layer-info-btn-${encodedLayerId}`;
+ const layerInfoBtnTitle = 'View Description';
const [showButtons, toggleShowButtons] = useState(isMobile);
+ const [showDropdownBtn, setDropdownBtnVisible] = useState(false);
+ const [showDropdownMenu, setDropdownMenuVisible] = useState(false);
+
+ const toggleDropdownMenuVisible = () => {
+ if (showDropdownMenu) {
+ setDropdownBtnVisible(false);
+ }
+ setDropdownMenuVisible(!showDropdownMenu);
+ };
const getPaletteLegend = () => {
if (!lodashIsEmpty(renderedPalette)) {
@@ -149,58 +167,68 @@ function LayerRow (props) {
e.preventDefault();
};
- const renderControls = () => {
- const { title } = names;
- const removeLayerBtnId = `close-${compareState}${encodedLayerId}`;
- const removeLayerBtnTitle = 'Remove layer';
-
- const layerOptionsBtnId = `layer-options-btn-${encodedLayerId}`;
- const layerOptionsBtnTitle = 'View options';
-
- const layerInfoBtnId = `layer-info-btn-${encodedLayerId}`;
- const layerInfoBtnTitle = 'View description';
-
- return (
- <>
- <a
- id={removeLayerBtnId}
- aria-label={removeLayerBtnTitle}
- className="button wv-layers-close"
- onClick={() => onRemoveClick(layer.id)}
- >
- <UncontrolledTooltip placement="top" target={removeLayerBtnId}>
- {removeLayerBtnTitle}
- </UncontrolledTooltip>
- <FontAwesomeIcon icon="times" fixedWidth />
- </a>
- <a
- id={layerOptionsBtnId}
- aria-label={layerOptionsBtnTitle}
- className={isMobile ? 'hidden wv-layers-options' : 'button wv-layers-options'}
- onMouseDown={stopPropagation}
- onClick={() => onOptionsClick(layer, title)}
- >
- <UncontrolledTooltip placement="top" target={layerOptionsBtnId}>
- {layerOptionsBtnTitle}
- </UncontrolledTooltip>
- <FontAwesomeIcon icon="sliders-h" className="wv-layers-options-icon" />
- </a>
- <a
- id={layerInfoBtnId}
- aria-label={layerInfoBtnTitle}
- className={isMobile ? 'hidden wv-layers-info' : 'button wv-layers-info'}
- onMouseDown={stopPropagation}
- onClick={() => onInfoClick(layer, title, measurementDescriptionPath)}
- >
- <UncontrolledTooltip placement="top" target={layerInfoBtnId}>
- {layerInfoBtnTitle}
- </UncontrolledTooltip>
- <FontAwesomeIcon icon="info" className="wv-layers-info-icon" />
- </a>
- </>
- );
- };
+ const renderDropdownMenu = () => (
+ <Dropdown className="layer-group-more-options" isOpen={showDropdownMenu} toggle={toggleDropdownMenuVisible}>
+ <DropdownToggle>
+ <FontAwesomeIcon
+ className="layer-group-more"
+ icon="ellipsis-v"
+ />
+ </DropdownToggle>
+ <DropdownMenu positionFixed>
+ <DropdownItem id={layerInfoBtnId} aria-label={layerInfoBtnTitle} className="button wv-layers-info" onClick={() => onInfoClick(layer, title, measurementDescriptionPath)}>
+ {layerInfoBtnTitle}
+ </DropdownItem>
+ <DropdownItem id={layerOptionsBtnId} aria-label={layerOptionsBtnTitle} className="button wv-layers-options" onClick={() => onOptionsClick(layer, title)}>
+ {layerOptionsBtnTitle}
+ </DropdownItem>
+ <DropdownItem id={removeLayerBtnId} onClick={() => onRemoveClick(layer.id)}>
+ {removeLayerBtnTitle}
+ </DropdownItem>
+ </DropdownMenu>
+ </Dropdown>
+ );
+ const renderControls = () => (
+ <>
+ {showDropdownBtn || isMobile ? renderDropdownMenu() : null}
+ <a
+ id={removeLayerBtnId}
+ aria-label={removeLayerBtnTitle}
+ className={isMobile ? 'hidden wv-layers-options' : 'button wv-layers-close'}
+ onClick={() => onRemoveClick(layer.id)}
+ >
+ <UncontrolledTooltip placement="top" target={removeLayerBtnId}>
+ {removeLayerBtnTitle}
+ </UncontrolledTooltip>
+ <FontAwesomeIcon icon="times" fixedWidth />
+ </a>
+ <a
+ id={layerOptionsBtnId}
+ aria-label={layerOptionsBtnTitle}
+ className={isMobile ? 'hidden wv-layers-options' : 'button wv-layers-options'}
+ onMouseDown={stopPropagation}
+ onClick={() => onOptionsClick(layer, title)}
+ >
+ <UncontrolledTooltip placement="top" target={layerOptionsBtnId}>
+ {layerOptionsBtnTitle}
+ </UncontrolledTooltip>
+ <FontAwesomeIcon icon="sliders-h" className="wv-layers-options-icon" />
+ </a>
+ <a
+ id={layerInfoBtnId}
+ aria-label={layerInfoBtnTitle}
+ className={isMobile ? 'hidden wv-layers-info' : 'button wv-layers-info'}
+ onMouseDown={stopPropagation}
+ onClick={() => onInfoClick(layer, title, measurementDescriptionPath)}
+ >
+ <UncontrolledTooltip placement="top" target={layerInfoBtnId}>
+ {layerInfoBtnTitle}
+ </UncontrolledTooltip>
+ <FontAwesomeIcon icon="info" className="wv-layers-info-icon" />
+ </a>
+ </>
+ );
const renderVectorIcon = () => {
const classNames = hasClickableFeature
? 'layer-pointer-icon'