Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

show alert only once. opening modal dimisses notification. remove pictures

Jason Kent649ae34f2b84
diff --git a/web/js/components/feature-alert/alert.js b/web/js/components/feature-alert/alert.js
index edb42ebd6..449604480 100644
--- a/web/js/components/feature-alert/alert.js
+++ b/web/js/components/feature-alert/alert.js
@@ -9,21 +9,24 @@ import util from '../../util/util';
class FeaturedAlert extends React.Component {
constructor(props) {
super(props);
- this.state = {
- showAlert: true
- };
- this.dismissAlert = this.dismissAlert.bind(this);
+ let alertHasBeenShown;
if (util.browser.localStorage) {
- // const hideAlertTime = localStorage.getItem('featured-alert');
+ alertHasBeenShown = localStorage.getItem('featured-alert:geostationary');
}
+
+ this.state = {
+ showAlert: !alertHasBeenShown
+ };
+ this.readMore = this.readMore.bind(this);
}
- dismissAlert() {
+ readMore() {
if (util.browser.localStorage) {
- localStorage.setItem('featured-alert', new Date());
+ localStorage.setItem('featured-alert:geostationary', true);
}
this.setState({ showAlert: false });
+ this.props.showModal();
}
render() {
@@ -33,9 +36,7 @@ class FeaturedAlert extends React.Component {
<AlertUtil
isOpen={showAlert}
iconClassName='fa fa-layer-group fa-fw'
- onClick={this.props.showModal.bind(this)}
- // TODO consider hiding the close button if no onDismiss prop supplied
- onDismiss={this.dismissAlert}
+ onClick={this.readMore}
message="Check out our new geostationary layers!"
/>
</>
@@ -49,11 +50,9 @@ const mapDispatchToProps = (dispatch) => ({
openCustomContent('geostationary_info', {
headerText: 'New - Geostationary Layers',
backdrop: false,
- size: 'lg',
+ size: 'md',
wrapClassName: 'clickable-behind-modal',
- bodyComponent: GeostationaryModalBody,
- desktopOnly: true,
- isDraggable: true
+ bodyComponent: GeostationaryModalBody
})
);
}
diff --git a/web/js/components/feature-alert/geostationary-modal.js b/web/js/components/feature-alert/geostationary-modal.js
index ce3d1ca94..a24a885f0 100644
--- a/web/js/components/feature-alert/geostationary-modal.js
+++ b/web/js/components/feature-alert/geostationary-modal.js
@@ -3,52 +3,38 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { history } from '../../main';
import update from 'immutability-helper';
-import { Button } from 'reactstrap';
+import {
+ Button
+} from 'reactstrap';
class GeostationaryModalBody extends React.Component {
render() {
- const { addLayer, setTime, prepareAnimate } = this.props;
+ const { prepareAnimate } = this.props;
return (
<div className="compare-dialog">
- <p>How to get started?</p>
- <ul>
-
- <li className="compare-dialog-list-item">
- <img src="images/geostationary/featured.png" />
- <p>
- Our latest release includes a number of new layers for geostationary products. These new layers
- can be found in the new &quot;Featured&quot; tab of the &quot;Add Layers&quot; menu.
- </p>
- <p>
- To jump right in, <a href="#" onClick={addLayer}>click here to add a geostationary layer</a> to the
- currently active overlays.
- </p>
- </li>
-
- <li className="compare-dialog-list-item">
- <p>Geostationary products are updated more frequently than others. For example, the
- set of geostationary layers included in this release are updated in increments of 10 minutes. </p>
- <p>To take full advantage of this, the time and timescale of the timeline can now be set
- down to the hour and minute whenever any geostatinary products are in
- the current list of overlays. </p>
- <p> For an optimal experience, <a href="#" onClick={setTime}>click here to set a custom interval </a>
- to match the GOES East Red Visible layer&apos;s interval time of 10 minutes.</p>
- <img src="images/geostationary/timeline.png" />
- </li>
-
- <li className="compare-dialog-list-item">
- <img src="images/geostationary/animation.png" />
- <p>Of course, the animation tool has also been updated to allow adjustments down to the hours and minutes as well.
- Click the play button to see geostationary in action!
- </p>
- <Button
- className="btn-sm btn-primary"
- onClick={prepareAnimate}>Try it!
- </Button>
- </li>
-
- </ul>
+ <p>
+ Our latest release includes a number of new layers for geostationary products. These new layers
+ can be found in the new &quot;Featured&quot; tab of the &quot;Add Layers&quot; menu.
+ </p>
+ <p>
+ Geostationary products are updated more frequently than others. For example, the
+ set of geostationary layers included in this release are updated in increments of 10 minutes.
+ </p>
+ <p>
+ To take full advantage of this, the time (and timescale) of the timeline can now be set
+ down to the hour and minute whenever any geostatinary products are in
+ the current list of overlays.
+ </p>
+ <p> For an optimal experience, try setting the timeline interval time to a custom interval of 10 minutes.</p>
+ <p>
+ Of course, the animation tool has also been updated to allow adjustments down to the hours and minutes as well.
+ Click below to setup an animation to see geostationary in action!
+ </p>
+ <Button
+ className="btn-lg btn-primary mx-auto w-100"
+ onClick={prepareAnimate}>Try it!
+ </Button>
</div>
);
}
@@ -63,33 +49,12 @@ const getLocation = (search) => {
};
const mapDispatchToProps = (dispatch) => ({
- addLayer: () => {
- const paramArr = [
- 'p=geographic&',
- 'l=GOES-East_ABI_Band2_Red_Visible,Reference_Labels(hidden),Reference_Features(hidden),Coastlines,VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor&',
- 't=2019-09-01-T20%3A00%3A41Z'
- ];
- const urlParams = paramArr.reduce((prev, curr) => prev + curr, '');
- const location = getLocation(urlParams);
- dispatch({ type: 'REDUX-LOCATION-POP-ACTION', payload: location });
- },
- setTime: () => {
- const paramArr = [
- 'p=geographic&',
- 'l=GOES-East_ABI_Band2_Red_Visible,Reference_Labels(hidden),Reference_Features(hidden),Coastlines,VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor&',
- 't=2019-09-01-T20%3A00%3A41Z&',
- 'z=5&ics=true&ici=5&icd=10&t=2019-09-01-T20%3A00%3A41Z'
- ];
- const urlParams = paramArr.reduce((prev, curr) => prev + curr, '');
- const location = getLocation(urlParams);
- dispatch({ type: 'REDUX-LOCATION-POP-ACTION', payload: location });
- },
prepareAnimate: () => {
const paramArr = [
'p=geographic&',
- 'l=GOES-East_ABI_Band2_Red_Visible,Reference_Labels(hidden),Reference_Features(hidden),Coastlines,VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor&',
+ 'l=Reference_Labels,Reference_Features(hidden),Coastlines(hidden),GOES-East_ABI_Band2_Red_Visible,VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor&',
't=2019-09-01-T20%3A00%3A41Z&',
- 'v=-86.93586254108634,22.191846804617647,-70.13996410358634,33.95161242961765&',
+ 'v=-84.25409131402579,21.881949559541848,-69.48846631402579,30.213980809541848&',
'z=5&ics=true&ici=5&icd=10&t=2019-09-01-T20%3A00%3A41Z&',
'ab=on&as=2019-09-01-T16%3A00%3A00Z&ae=2019-09-01-T21%3A00%3A00Z&al=true'
];
diff --git a/web/js/components/util/alert.js b/web/js/components/util/alert.js
index aa2537610..adfc1012b 100644
--- a/web/js/components/util/alert.js
+++ b/web/js/components/util/alert.js
@@ -39,22 +39,22 @@ export default class AlertComponent extends React.Component {
onClick={this.props.onClick}
>
<span>
- {this.props.iconClassName ? (
+ {this.props.iconClassName && (
<i className={this.props.iconClassName} />
- ) : (
- ''
)}
{this.props.message}
- {this.props.onClick ? (
+ {this.props.onClick && (
<span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Read More...
</span>
- ) : null}
+ )}
</span>
</div>
- <div className="close-alert" onClick={this.props.onDismiss}>
- <i className="fa fa-times exit fa-1x" />
- </div>
+ {this.props.onDismiss && (
+ <div className="close-alert" onClick={this.props.onDismiss}>
+ <i className="fa fa-times exit fa-1x" />
+ </div>
+ )}
</Alert>
</Portal>
);