Interactive interface for browsing global, full-resolution satellite imagery
add timeline data panel info dialog, move modal toggle to lifecycle
Ed Plato40ac2523e8ed
diff --git a/web/css/data-coverage-panel.css b/web/css/data-coverage-panel.cssnew file mode 100644index 000000000..ca8b94a91--- /dev/null+++ b/web/css/data-coverage-panel.css@@ -0,0 +1,188 @@+.timeline-data-panel-container {+ position: absolute;+ background: rgba(40, 40, 40, 1);+ border-top-right-radius: 5px;+ border-top-left-radius: 5px;+}++.animate-timeline-data-panel-slide-up {+ z-index: 5;+ bottom: 66px;+ opacity: 1;+}++.animate-timeline-data-panel-slide-down {+ z-index: -5;+ bottom: -12px;+ opacity: 0;+}++.timeline-data-panel i.wv-close:hover {+ color: #999;+ cursor: pointer;+}++.timeline-data-panel-header {+ display: flex;+ justify-content: space-between;+ align-items: center;+ border-bottom: thin solid #808080;+ padding: 5px;+}++.timeline-data-panel-header-title {+ width: 125px;+ padding: 5px;+}++.data-panel-info-button {+ margin-right: 25px;+ margin-bottom: 2px;+}++.data-panel-info-button-icon {+ border: thin solid #fff;+ width: 1.1em !important;+ height: 14px;+ text-align: center;+ border-radius: 50%;+ padding: 1px;+ margin-top: 3px;+}++.label-layer-active {+ color: #000;+}++.label-layer-inactive {+ color: #999;+}++.wv-toggle-data-matching-main {+ align-items: center;+ margin: 0;+ white-space: nowrap;+ flex-grow: 1;+}++.wv-toggle-data-matching-main .react-switch-case {+ width: 38px;+}++.wv-toggle-data-matching-main > div.react-switch-label-case.switch-col {+ padding-left: 5px;+}++.timeline-data-panel {+ position: relative;+ background-color: #212121;+ color: #fff;+ box-sizing: border-box;+ border: thin solid #333;+ border-bottom: 0;+ border-top-right-radius: 5px;+ border-top-left-radius: 5px;+}++.data-panel-layer-item {+ position: relative;+ border-bottom: thin solid #3c3c3c;+ padding-bottom: 5px;+}++.data-panel-layer-item-header {+ display: flex;+ align-items: center;+ padding: 5px 3px;+}++.data-panel-layer-item-title {+ white-space: nowrap;+ font-size: 1em;+}++.data-panel-layer-item-subtitle {+ font-style: italic;+ font-size: 0.9em;+ padding-left: 3px;+}++.data-panel-layer-item-date-range {+ position: absolute;+ font-size: 0.9em;+ right: 0;+ top: 0;+ padding: 4px 10px;+}++.data-panel-layer-list {+ overflow: hidden;+}++.data-panel-layer-coverage-line-container {+ overflow: hidden;+ height: 12px;+}++.data-panel-coverage-line-container {+ position: absolute;+}++.data-panel-coverage-line {+ position: absolute;+ height: 12px;+}++.data-panel-layer-empty {+ height: 41px;+ padding: 6px;+}++.data-item-empty {+ display: flex;+ flex-direction: row;+}++/* INFO DIALOG */+.data-panel-info-modal .modal-header .close {+ font-size: 22px;+ padding: 12px 14px;+}++.data-panel-info-modal .modal-title {+ font-size: 14px;+ font-weight: 600;+}++.data-panel-info-modal {+ margin-left: auto;+ margin-right: auto;+ border-radius: 6px;+ width: 465px;+}++.data-panel-info {+ & div {+ display: flex;+ flex: 1 1 0;+ }+ & div:nth-child(1),+ & .data-panel-info-item div {+ padding: 5px;+ box-shadow: 2px 3px 6px 0 #000;+ }+ & p {+ padding: 5px;+ }+ & img {+ max-width: 100%;+ }+}++.data-panel-info .data-panel-info-item {+ &:nth-child(2), &:nth-child(2) div:nth-child(1) {+ display: flex;+ flex-direction: column;+ justify-content: space-evenly;+ }+}diff --git a/web/css/timeline.css b/web/css/timeline.cssindex 14a104016..c7eb0811c 100644--- a/web/css/timeline.css+++ b/web/css/timeline.css@@ -746,135 +746,3 @@ button:focus {.datepicker-navbar-btn:hover {background: #fff;}--/* TIMELINE DATA PANEL */--.timeline-data-panel-container {- position: absolute;- background: rgba(40, 40, 40, 1);- border-top-right-radius: 5px;- border-top-left-radius: 5px;-}--.animate-timeline-data-panel-slide-up {- z-index: 5;- bottom: 66px;- opacity: 1;-}--.animate-timeline-data-panel-slide-down {- z-index: -5;- bottom: -12px;- opacity: 0;-}--.timeline-data-panel i.wv-close:hover {- color: #999;- cursor: pointer;-}--.timeline-data-panel-header {- display: flex;- justify-content: space-between;- align-items: center;- border-bottom: thin solid #808080;- padding: 5px;-}--.timeline-data-panel-header-title {- width: 150px;- padding: 5px;-}--.label-layer-active {- color: #000;-}--.label-layer-inactive {- color: #999;-}--.wv-toggle-data-matching-main {- align-items: center;- margin: 0;- white-space: nowrap;- flex-grow: 1;-}--.wv-toggle-data-matching-main .react-switch-case {- width: 35px;-}--.wv-toggle-data-matching-main > div.react-switch-label-case.switch-col {- padding-left: 5px;-}--.timeline-data-panel {- position: relative;- background-color: #212121;- color: #fff;- box-sizing: border-box;- border: thin solid #333;- border-bottom: 0;- border-top-right-radius: 5px;- border-top-left-radius: 5px;-}--.data-panel-layer-item {- position: relative;- border-bottom: thin solid #3c3c3c;- padding-bottom: 5px;-}--.data-panel-layer-item-header {- display: flex;- align-items: center;- padding: 5px 3px;-}--.data-panel-layer-item-title {- white-space: nowrap;- font-size: 1em;-}--.data-panel-layer-item-subtitle {- font-style: italic;- font-size: 0.9em;- padding-left: 3px;-}--.data-panel-layer-item-date-range {- position: absolute;- font-size: 0.9em;- right: 0;- top: 0;- padding: 4px 10px;-}--.data-panel-layer-list {- overflow: hidden;-}--.data-panel-layer-coverage-line-container {- overflow: hidden;- height: 12px;-}--.data-panel-coverage-line-container {- position: absolute;-}--.data-panel-coverage-line {- position: absolute;- height: 12px;-}--.data-panel-layer-empty {- height: 41px;- padding: 6px;-}--.data-item-empty {- display: flex;- flex-direction: row;-}diff --git a/web/images/dp-axis.png b/web/images/dp-axis.pngnew file mode 100644index 000000000..b8e0fb2efBinary files /dev/null and b/web/images/dp-axis.png differdiff --git a/web/images/dp-toggle.png b/web/images/dp-toggle.pngnew file mode 100644index 000000000..94ae9c116Binary files /dev/null and b/web/images/dp-toggle.png differdiff --git a/web/js/app.js b/web/js/app.jsindex 0e649b6b4..8de91dcc5 100644--- a/web/js/app.js+++ b/web/js/app.js@@ -71,6 +71,7 @@ import '../css/layers.css';import '../css/scrollbar.css';import '../css/switch.css';import '../css/timeline.css';+import '../css/data-coverage-panel.css';import '../css/anim.widget.css';import '../css/dateselector.css';import '../css/tooltip.css';diff --git a/web/js/components/timeline/timeline-data/info-modal.js b/web/js/components/timeline/timeline-data/info-modal.jsnew file mode 100644index 000000000..5e829532f--- /dev/null+++ b/web/js/components/timeline/timeline-data/info-modal.js@@ -0,0 +1,34 @@+import React from 'react';++const DataPanelInfoModal = () => (+ <div className="data-panel-info">+ <p>+ Layers with temporal coverage are visualized in the data panel as blue lines which represent coverage relative to the current timeline zoom level. Total layer coverage is displayed on the right.+ </p>+ <p>+ Matching coverage for layer(s) in the data panel is shown on the timeline, as highlighted by the orange arrow below. Use this matching coverage to view the best times that multiple layers have data availability.+ </p>+ <div>+ <div className="data-panel-info-item">+ <img src="images/dp-axis.png" />+ </div>+ <div className="data-panel-info-item">+ <div>+ <p>+ Toggle to include layers that are currently hidden. This will affect matching coverage on the timeline.+ </p>+ <img src="images/dp-toggle.png" />+ </div>+ <div>+ <p>+ <strong>Note:</strong>+ {' '}+ Active layers showing available coverage may not have imagery available yet (e.g., monthly layers that are processed later in the month).+ </p>+ </div>+ </div>+ </div>+ </div>+);++export default DataPanelInfoModal;diff --git a/web/js/components/timeline/timeline-data/timeline-data.js b/web/js/components/timeline/timeline-data/timeline-data.jsindex ec73454c0..55b16d1e3 100644--- a/web/js/components/timeline/timeline-data/timeline-data.js+++ b/web/js/components/timeline/timeline-data/timeline-data.js@@ -1,21 +1,23 @@import React, { Component } from 'react';import PropTypes from 'prop-types';import { connect } from 'react-redux';+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';import { UncontrolledTooltip } from 'reactstrap';import moment from 'moment';+import googleTagManager from 'googleTagManager';import {isEqual as lodashIsEqual,} from 'lodash';-import {- timeScaleOptions,-} from '../../../modules/date/constants';+import { timeScaleOptions } from '../../../modules/date/constants';import {filterProjLayersWithStartDate,getMaxLayerEndDates,} from '../../../modules/date/util';import { getActiveLayers } from '../../../modules/layers/selectors';+import { toggleCustomContent } from '../../../modules/modal/actions';import Scrollbars from '../../util/scrollbar';import Switch from '../../util/switch';+import DataPanelInfo from './info-modal';import DataItemList from './data-item-list';/*@@ -263,6 +265,37 @@ class TimelineData extends Component {}}+ stopPropagation = (e) => {+ e.nativeEvent.stopImmediatePropagation();+ e.stopPropagation();+ e.preventDefault();+ }++ /**+ * @desc render info button for data panel coverage info modal+ * @returns {DOM Object}+ */+ renderInfoButton = () => {+ const { onInfoClick } = this.props;+ const layerInfoBtnId = 'data-panel-info-button';+ const layerInfoBtnTitle = 'Data Coverage Panel Information';++ return (+ <a+ id={layerInfoBtnId}+ aria-label={layerInfoBtnTitle}+ className={layerInfoBtnId}+ onMouseDown={this.stopPropagation}+ onClick={() => onInfoClick()}+ >+ <UncontrolledTooltip placement="top" target={layerInfoBtnId}>+ {layerInfoBtnTitle}+ </UncontrolledTooltip>+ <FontAwesomeIcon icon="info" className="data-panel-info-button-icon" />+ </a>+ );+ }+render() {const {appNow,@@ -338,6 +371,7 @@ class TimelineData extends Component {><header className="timeline-data-panel-header"><h3 className="timeline-data-panel-header-title">LAYER COVERAGE</h3>+ {this.renderInfoButton()}<Switchactive={shouldIncludeHiddenLayers}border@@ -393,6 +427,23 @@ function mapStateToProps(state) {}const mapDispatchToProps = (dispatch) => ({+ onInfoClick: () => {+ const key = 'DATA_PANEL_INFO_MODAL';+ googleTagManager.pushEvent({+ event: 'data_panel_info',+ });+ dispatch(+ toggleCustomContent(key, {+ headerText: 'Data Coverage Panel',+ backdrop: false,+ size: 'lg',+ bodyComponent: DataPanelInfo,+ modalClassName: ' data-panel-info-modal',+ wrapClassName: 'clickable-behind-modal',+ desktopOnly: true,+ }),+ );+ },});TimelineData.propTypes = {@@ -403,6 +454,7 @@ TimelineData.propTypes = {frontDate: PropTypes.string,isDataCoveragePanelOpen: PropTypes.bool,isProductPickerOpen: PropTypes.bool,+ onInfoClick: PropTypes.func,parentOffset: PropTypes.number,positionTransformX: PropTypes.number,projection: PropTypes.string,diff --git a/web/js/containers/modal.js b/web/js/containers/modal.jsindex 7666d05fc..45e8f7f16 100644--- a/web/js/containers/modal.js+++ b/web/js/containers/modal.js@@ -33,6 +33,28 @@ class ModalContainer extends Component {this.onResize = this.onResize.bind(this);}+ componentDidUpdate() {+ const {+ isCustom,+ id,+ isOpen,+ customProps,+ isMobile,+ } = this.props;+ // Populate props from custom obj+ const newProps = isCustom && id ? update(this.props, { $merge: customProps }) : this.props;+ const {+ onToggle,+ onClose,+ desktopOnly,+ } = newProps;++ const toggleFunction = toggleWithClose(onToggle, onClose, isOpen);+ if (isMobile && isOpen && desktopOnly) {+ toggleFunction();+ }+ }+getStyle() {const {offsetLeft, offsetRight, offsetTop, width, height,@@ -74,7 +96,6 @@ class ModalContainer extends Component {isOpen,isTemplateModal,customProps,- isMobile,screenHeight,} = this.props;const { width, height } = this.state;@@ -97,8 +118,6 @@ class ModalContainer extends Component {CompletelyCustomModal,bodyComponentProps,timeout,- desktopOnly,- mobileOnly,size,isDraggable,isResizable,@@ -111,12 +130,6 @@ class ModalContainer extends Component {const allowOuterClick = !isOpen || type === 'selection' || clickableBehindModal;const modalWrapClass = clickableBehindModal ? `clickable-behind-modal ${wrapClassName}` : wrapClassName;const toggleFunction = toggleWithClose(onToggle, onClose, isOpen);- const shouldToggleMobile = isMobile && desktopOnly;- const shouldToggleDesktop = !isMobile && mobileOnly;- const toggleConditon = isOpen && (shouldToggleMobile || shouldToggleDesktop);- if (toggleConditon) {- toggleFunction();- }return (<ErrorBoundary><InteractionWrap@@ -145,7 +158,6 @@ class ModalContainer extends Component {: children}</Draggable>)}-><ModalisOpen={isOpen}