Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add links to complete window & better handle localStorage for hiding tour

ZachTRice9b9ae9c924f9
diff --git a/config/default/common/config/wv.json/stories.json b/config/default/common/config/wv.json/stories.json
index 807bfa627..f2624aede 100644
--- a/config/default/common/config/wv.json/stories.json
+++ b/config/default/common/config/wv.json/stories.json
@@ -7,64 +7,59 @@
"description": "Hurricane Florence wrecked havoc on the Carolinas. Use the A|B tool to see a before and after of the coast.",
"backgroundImage": "background.png",
"backgroundImageHover": "",
- "readMoreLink": "",
+ "readMoreLinks": [
+ {
+ "title": "Earth Observatory - Hurricane Florence",
+ "link": "https://earthobservatory.nasa.gov/images/Event/92748/hurricane-florence"
+ }
+ ],
"steps": [
{
- "id": "001",
"description": "step001.html",
"highlightElement": "",
"stepLink": "p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night(hidden),MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC,Reference_Labels,Reference_Features,Coastlines(hidden)&t=2017-07-12-T00:00:00Z&z=3&v=-64.10884765624996,-69.967890625,-58.48384765624997,-65.79748046875"
},
{
- "id": "002",
"description": "step002.html",
"highlightElement": "",
"stepLink": "p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night(hidden),MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC,Reference_Labels,Reference_Features,Coastlines(hidden)&t=2017-07-10-T00:00:00Z&z=3&v=-64.10884765624996,-69.967890625,-58.48384765624997,-65.79748046875"
},
{
- "id": "003",
"description": "step003.html",
"highlightElement": "",
"stepLink": "p=geographic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night(hidden),MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC,Reference_Labels,Reference_Features,Coastlines(hidden)&t=2017-07-10-T00:00:00Z&z=3&v=-124.8058657020246,-101.245966796875,2.2131703895246773,-34.519404296875"
},
{
- "id": "004",
"description": "step004.html",
"highlightElement": "",
"stepLink": "p=antarctic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night(hidden),MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC,Coastlines(hidden)&t=2017-07-10-T00:00:00Z&z=3&v=-7196672,-3780608,7196672,3780608"
},
{
- "id": "005",
"description": "step005.html",
"highlightElement": "",
"stepLink": "p=antarctic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night(hidden),MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC,Coastlines(hidden)&t=2017-07-10-T00%3A00%3A00Z&z=3&v=-7196672,-3780608,7196672,3780608&e=true"
},
{
- "id": "006",
"description": "step006.html",
"highlightElement": "",
"stepLink": "p=antarctic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night(hidden),MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC(hidden),Coastlines&t=2018-03-30-T00%3A00%3A00Z&z=3&v=-2634478.7487170836,976584.7260544659,-1639910.5610838216,1462472.7260544659&e=EONET_2934,2018-03-30"
},
{
- "id": "007",
"description": "step007.html",
"highlightElement": "",
"stepLink": "p=antarctic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night(hidden),MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC(hidden),Coastlines&t=2017-07-12-T00%3A00%3A00Z&z=3&v=-2601296.969455067,935552.4147922904,-1633977.225318607,1408128.4147922904&e=EONET_2934,2017-07-12"
},
{
- "id": "008",
"description": "step008.html",
"highlightElement": "",
"stepLink": "p=antarctic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night(hidden),MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC(hidden),Coastlines&t=2017-07-12-T00:00:00Z&z=3&v=-2567429.097386837,935552.4147922904,-1667845.097386837,1408128.4147922904"
},
{
- "id": "009",
"description": "step009.html",
"highlightElement": "",
"stepLink": "p=antarctic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night(hidden),MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC,Coastlines&t=2017-07-12-T00:00:00Z&z=3&v=-2567429.097386837,935552.4147922904,-1667845.097386837,1408128.4147922904"
},
{
- "id": "010",
"description": "step010.html",
"highlightElement": "",
"stepLink": "p=antarctic&l=VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor,MODIS_Terra_Sea_Ice(hidden),MODIS_Aqua_Sea_Ice(hidden),MODIS_Aqua_Brightness_Temp_Band31_Night,MODIS_Aqua_Brightness_Temp_Band31_Day(hidden),MODIS_Terra_Brightness_Temp_Band31_Night(hidden),MODIS_Terra_Brightness_Temp_Band31_Day(hidden),VIIRS_SNPP_DayNightBand_ENCC,Coastlines&t=2017-07-12-T00:00:00Z&z=3&v=-2567429.097386837,935552.4147922904,-1667845.097386837,1408128.4147922904"
@@ -640,4 +635,4 @@
]
}
}
-}
\ No newline at end of file
+}
diff --git a/web/css/tour.css b/web/css/tour.css
index e905d0d53..405cf9835 100644
--- a/web/css/tour.css
+++ b/web/css/tour.css
@@ -595,13 +595,14 @@
}
.tour-complete .modal-body {
- padding: 15px;
+ padding: 15px 15px 0;
}
.tour-complete .modal-body p {
color: #333;
font-size: 16px;
line-height: 24px;
+ margin-bottom: 16px;
}
.tour-complete .modal-footer {
diff --git a/web/js/alert/ui.js b/web/js/alert/ui.js
index c9c8a7648..cbcfebff5 100644
--- a/web/js/alert/ui.js
+++ b/web/js/alert/ui.js
@@ -1,7 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import TourAlert from '../components/alert/alert-tour';
-import util from '../util/util';
export function alertUi(ui) {
var self = {};
@@ -21,12 +20,8 @@ export function alertUi(ui) {
};
self.showTourAlert = function(e) {
- var tourAlert = localStorage.getItem('tourAlert');
-
- if (!util.browser.localStorage) return;
- if (tourAlert) return;
-
- localStorage.setItem('tourAlert', !tourAlert);
+ var hideTour = localStorage.getItem('hideTour');
+ if (!hideTour) return;
self.reactComponent.setState({
visible: true
@@ -36,7 +31,7 @@ export function alertUi(ui) {
self.reactComponent.setState({
visible: false
});
- }, 5000);
+ }, 10000);
};
init();
diff --git a/web/js/components/tour/modal-tour-complete.js b/web/js/components/tour/modal-tour-complete.js
index e97c27cf4..c8d1cf096 100644
--- a/web/js/components/tour/modal-tour-complete.js
+++ b/web/js/components/tour/modal-tour-complete.js
@@ -4,12 +4,27 @@ import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
class ModalComplete extends React.Component {
render() {
+ let readMoreLinks = this.props.currentStory.readMoreLinks;
+ let list;
+ if (readMoreLinks) {
+ list = (
+ <React.Fragment>
+ <p>Read more about this story at the links below:</p>
+ <ul>
+ {readMoreLinks.map((linkId, i) =>
+ <li key={i} index={i}><a href={linkId.link}>{linkId.title}</a></li>
+ )}
+ </ul>
+ </React.Fragment>
+ );
+ }
return (
<div>
<Modal isOpen={this.props.modalComplete} toggle={this.props.toggleModalComplete} wrapClassName='tour tour-complete' className={this.props.className} backdrop={true}>
<ModalHeader toggle={this.props.toggleModalComplete} charCode="">Story Complete</ModalHeader>
<ModalBody>
<p>You have now completed a story in Worldview. To view more stories, click the "More Stories" button below or, <a href="#">explore more events</a> within the app. Click the "Exit Tutorial" button or close this window to start using Worldview on your own.</p>
+ {list}
</ModalBody>
<ModalFooter>
<button type="button" className="btn btn-primary" onClick={this.props.startTour}>More Stories</button>
@@ -23,6 +38,7 @@ class ModalComplete extends React.Component {
ModalComplete.propTypes = {
modalComplete: PropTypes.bool.isRequired,
+ currentStory: PropTypes.object.isRequired,
toggleModalComplete: PropTypes.func.isRequired,
startTour: PropTypes.func.isRequired,
className: PropTypes.string
diff --git a/web/js/components/tour/modal-tour-start.js b/web/js/components/tour/modal-tour-start.js
index dc9249f22..2add3c6ec 100644
--- a/web/js/components/tour/modal-tour-start.js
+++ b/web/js/components/tour/modal-tour-start.js
@@ -1,10 +1,31 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { Modal, ModalHeader, ModalBody, ModalFooter, InputGroup, InputGroupAddon, InputGroupText, Input } from 'reactstrap';
+import { Modal, ModalHeader, ModalBody, ModalFooter, InputGroup, InputGroupText, Input } from 'reactstrap';
import TourIntro from './content-intro';
import TourBoxes from './tour-boxes';
class ModalStart extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ checked: localStorage.hideTour
+ };
+
+ this.handleCheck = this.handleCheck.bind(this);
+ }
+
+ handleCheck() {
+ this.setState({
+ checked: !this.state.checked,
+ defaultChecked: !this.state.defaultChecked
+ });
+ if (!this.state.checked) {
+ this.props.hideTour();
+ } else {
+ this.props.showTour();
+ }
+ }
+
render() {
return (
<Modal isOpen={this.props.modalStart} toggle={this.props.toggleModalStart} onClosed={this.props.showTourAlert} wrapClassName='tour tour-start' className={this.props.className} backdrop={true}>
@@ -16,7 +37,7 @@ class ModalStart extends React.Component {
<ModalFooter>
<InputGroup>
<InputGroupText className="w-100">
- <Input addon type="checkbox" className="float-right m-0" aria-label="Hide this box until a new story has been added." />
+ <Input addon type="checkbox" className="float-right m-0" defaultChecked={this.state.checked} onChange={this.handleCheck} aria-label="Hide this box until a new story has been added." />
<span className="ml-2">Check the box to hide this modal until a new story has been added.</span>
</InputGroupText>
</InputGroup>
@@ -33,6 +54,8 @@ ModalStart.propTypes = {
toggleModalStart: PropTypes.func.isRequired,
selectTour: PropTypes.func.isRequired,
showTourAlert: PropTypes.func.isRequired,
+ hideTour: PropTypes.func.isRequired,
+ showTour: PropTypes.func.isRequired,
className: PropTypes.string
};
diff --git a/web/js/components/tour/tour.js b/web/js/components/tour/tour.js
index 527b62b46..f94b533c9 100644
--- a/web/js/components/tour/tour.js
+++ b/web/js/components/tour/tour.js
@@ -22,7 +22,8 @@ class Tour extends React.Component {
currentStoryIndex: props.currentStoryIndex,
currentStory: props.currentStory,
currentStoryId: props.currentStoryId,
- showTourAlert: props.showTourAlert
+ showTourAlert: props.showTourAlert,
+ hideTour: props.hideTour
};
this.toggleModalStart = this.toggleModalStart.bind(this);
@@ -78,6 +79,8 @@ class Tour extends React.Component {
toggleModalComplete={this.toggleModalComplete}
selectTour={this.props.selectTour}
showTourAlert={this.props.showTourAlert}
+ hideTour={this.props.hideTour}
+ showTour={this.props.showTour}
></TourStart>
<TourInProgress
@@ -101,6 +104,7 @@ class Tour extends React.Component {
></TourInProgress>
<TourComplete
+ currentStory={this.state.currentStory}
modalComplete={this.state.modalComplete}
toggleModalStart={this.toggleModalStart}
toggleModalInProgress={this.toggleModalInProgress}
@@ -132,7 +136,9 @@ Tour.propTypes = {
currentStoryId: PropTypes.string,
startTour: PropTypes.func.isRequired,
selectTour: PropTypes.func.isRequired,
- showTourAlert: PropTypes.func.isRequired
+ showTourAlert: PropTypes.func.isRequired,
+ hideTour: PropTypes.func.isRequired,
+ showTour: PropTypes.func.isRequired
};
export default Tour;
diff --git a/web/js/tour/ui.js b/web/js/tour/ui.js
index 5e9180fc7..0a2d9f70d 100644
--- a/web/js/tour/ui.js
+++ b/web/js/tour/ui.js
@@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import Tour from '../components/tour/tour';
+import util from '../util/util';
export function tourUi(models, ui, config) {
var self = {};
@@ -23,7 +24,7 @@ export function tourUi(models, ui, config) {
ui: ui,
stories: config['stories'],
storyOrder: config['storyOrder'],
- modalStart: !localStorage.tourAlert,
+ modalStart: !localStorage.hideTour,
modalInProgress: false,
modalComplete: false,
currentStep: 1,
@@ -35,7 +36,9 @@ export function tourUi(models, ui, config) {
startTour: self.startTour,
selectTour: self.selectTour,
notifyUserOfTour: self.notifyUserOfTour,
- showTourAlert: ui.alert.showTourAlert
+ showTourAlert: ui.alert.showTourAlert,
+ hideTour: self.hideTour,
+ showTour: self.showTour
};
};
@@ -62,6 +65,24 @@ export function tourUi(models, ui, config) {
});
};
+ self.hideTour = function(e) {
+ var hideTour = localStorage.getItem('hideTour');
+
+ if (!util.browser.localStorage) return;
+ if (hideTour) return;
+
+ localStorage.setItem('hideTour', !hideTour);
+ };
+
+ self.showTour = function(e) {
+ var hideTour = localStorage.getItem('hideTour');
+
+ if (!util.browser.localStorage) return;
+ if (!hideTour) return;
+
+ localStorage.removeItem('hideTour', !hideTour);
+ };
+
init();
return self;
}