Interactive interface for browsing global, full-resolution satellite imagery
Added local storage functionality to hide EDS warning modal.
Stephan Wlodarczyk1b6049b09aa6
diff --git a/web/css/smart-handoff.css b/web/css/smart-handoff.cssindex 9f18e5a3f..ccee8f396 100644--- a/web/css/smart-handoff.css+++ b/web/css/smart-handoff.css@@ -191,22 +191,20 @@ label[for=chk-crop-toggle] {background:#191a1b;padding:0 15px;}-.checkbox-footer {++#checkbox-footer {+ display: inline-block;+ text-align: center;+ width: 100%;margin-top: 15px;+ padding-top: 15px;border-top: 1px solid #333;- text-align: center;}-.checkbox-footer label{- vertical-align: top;- padding: 2px;- margin-top: 20px;-}-#hide-earthdata-modal-checkbox {- margin: 20px 5px 5px 0px;- width: 18px;- height: 18px;- cursor: pointer;++#checkbox-footer-container {+ display: inline-block;}+/** Overrides the modal component styles */#transferring-to-earthdata-search.modal-dialog .modal-body {background: #191a1b !important;diff --git a/web/js/containers/sidebar/smart-handoff-modal.js b/web/js/containers/sidebar/smart-handoff-modal.jsindex c09acee3e..29f92e703 100644--- a/web/js/containers/sidebar/smart-handoff-modal.js+++ b/web/js/containers/sidebar/smart-handoff-modal.js@@ -2,9 +2,6 @@ import React, { useState } from 'react';import PropTypes from 'prop-types';import { connect } from 'react-redux';import moment from 'moment';-import {- InputGroup, InputGroupText,-} from 'reactstrap';import Button from '../../components/util/button';import Checkbox from '../../components/util/checkbox';import safeLocalStorage from '../../util/local-storage';@@ -20,7 +17,6 @@ function SmartHandoffModal({}) {// Hides Earthdata Search information by defaultconst [showMoreInfo, toggleInfo] = useState(false);-const { title, subtitle } = selectedLayer;const date = moment.utc(selectedDate).format('YYYY MMM DD');@@ -88,12 +84,6 @@ function SmartHandoffModal({<div className="button-group">- <Button- onClick={() => console.log('closing')}- id="cancel-btn"- text="Cancel"- />-<ButtononClick={() => goToEarthDataSearch()} // Need to pass reference of current state of boundariesid="continue-btn"@@ -102,9 +92,18 @@ function SmartHandoffModal({/></div>- <div className="checkbox-footer">- <input name="show-earthdata-modal" id="hide-earthdata-modal-checkbox" type="checkbox" />- <label htmlFor="show-earthdata-modal">Do not show this message again.</label>+ <div id="checkbox-footer">+ <div id="checkbox-footer-container">+ <Checkbox+ id="hide-eds-checkbox"+ name="hide-eds"+ onCheck={() => hideModal()}+ checked={false}+ color="gray"+ aria-label="Do not show the Earthdata Search message again."+ label="Do not show this message again."+ />+ </div></div></div>@@ -112,9 +111,13 @@ function SmartHandoffModal({);}-function hideEarthdataModal() {- console.log('ticked');-}+const hideModal = () => {+ const { HIDE_EDS_WARNING } = safeLocalStorage.keys;+ const shouldHideWarning = safeLocalStorage.getItem(HIDE_EDS_WARNING);+ if (!shouldHideWarning) safeLocalStorage.setItem(HIDE_EDS_WARNING, true);+ else safeLocalStorage.removeItem(HIDE_EDS_WARNING);+};+/*** Handle type-checking of defined propertiesdiff --git a/web/js/containers/sidebar/smart-handoff.js b/web/js/containers/sidebar/smart-handoff.jsindex 1f062e820..b71aded13 100644--- a/web/js/containers/sidebar/smart-handoff.js+++ b/web/js/containers/sidebar/smart-handoff.js@@ -13,7 +13,7 @@ import { getLayers } from '../../modules/layers/selectors';import { imageUtilGetCoordsFromPixelValues } from '../../modules/image-download/util';import { onClose, openCustomContent } from '../../modules/modal/actions';import getSelectedDate from '../../modules/date/selectors';-+import safeLocalStorage from '../../util/local-storage';/*** The Smart-Handoff components replaces the existing data download capability@@ -192,9 +192,10 @@ class SmartHandoff extends Component {x, y, x2, y2,} = boundaries;-- // Default modal state- const showModal = false;+ // Used to determine if modal should be shown+ const { HIDE_EDS_WARNING } = safeLocalStorage.keys;+ let showModal = safeLocalStorage.getItem(HIDE_EDS_WARNING);+ showModal = true;// Determine if existing selected layer is active still and visibility toggle is 'ON'const isLayerStillActive = activeLayers.find((layer) => selectedLayer === layer && layer.visible);diff --git a/web/js/util/local-storage.js b/web/js/util/local-storage.jsindex cbdca5511..e196b9c04 100644--- a/web/js/util/local-storage.js+++ b/web/js/util/local-storage.js@@ -23,6 +23,7 @@ export default {DISMISSED_EVENT_VIS_ALERT: 'dismissedEventVisibilityAlert',DISMISSED_COMPARE_ALERT: 'dismissedCompareAlert',HIDE_TOUR: 'hideTour',+ HIDE_EDS_WARNING: 'hideEDS',SIDEBAR_COLLAPSED: 'sidebarState',COORDINATE_FORMAT: 'coordinateFormat',NOTIFICATION_OUTAGE: 'outage',