Interactive interface for browsing global, full-resolution satellite imagery
Implement toolbar as a react component and improve tour functionality
ZachTRice5b56ba156136
diff --git a/web/css/toolbar.css b/web/css/toolbar.cssindex a097400fc..c2f95b430 100644--- a/web/css/toolbar.css+++ b/web/css/toolbar.css@@ -1,4 +1,4 @@-#wv-toolbar {+.wv-toolbar {position: absolute;right: 10px;top: 10px;@@ -6,7 +6,7 @@border-radius: 0;}-#wv-toolbar li {+.wv-toolbar li {font-size: 14.3px;display: inline-block;margin: 0 0 0 4px;@@ -15,7 +15,7 @@border-radius: 5px;}-#wv-toolbar li label {+.wv-toolbar li label {border-radius: 5px;margin: 0;border: 0;@@ -24,25 +24,34 @@background-image: none;}-#wv-toolbar li label span {+.wv-toolbar li label:hover {+ border: 0;+}++.wv-toolbar li label span {display: inline-block;width: 0;padding: 0;line-height: normal;}-#wv-toolbar li .ui-state-default {+.wv-toolbar li .ui-state-default {background-color: transparent;background-image: none;}-#wv-toolbar li:hover label {+.wv-toolbar li:hover label {background-color: #fff;color: #1a1a1a;}-#wv-toolbar li:hover label.ui-state-disabled {+.wv-toolbar li:hover label.ui-state-disabled {background-color: transparent;}++.wv-toolbar li input[type="checkbox"] {+ margin: 0;+}+.wv-menu .ui-menu .ui-menu-item a {position: relative;border: 0;diff --git a/web/js/components/share/links.js b/web/js/components/toolbar/share/links.jssimilarity index 100%rename from web/js/components/share/links.jsrename to web/js/components/toolbar/share/links.jsdiff --git a/web/js/components/share/share.js b/web/js/components/toolbar/share/share.jssimilarity index 100%rename from web/js/components/share/share.jsrename to web/js/components/toolbar/share/share.jsdiff --git a/web/js/components/toolbar/toolbar.js b/web/js/components/toolbar/toolbar.jsnew file mode 100644index 000000000..4eb4a7f8d--- /dev/null+++ b/web/js/components/toolbar/toolbar.js@@ -0,0 +1,63 @@+import React from 'react';+// import Share from './share/index.js';+// import Projection from './projection/index.js';+// import Snapshot from './snapshot/index.js';+// import Info from './info/index.js'++class Tour extends React.Component {+ constructor(props) {+ super(props);+ this.state = {+ modalShare: false,+ modalProjection: false,+ modalSnapshot: false,+ modalInfo: false+ };++ this.toggleModalShare = this.toggleModalShare.bind(this);+ this.toggleModalProjection = this.toggleModalProjection.bind(this);+ this.toggleModalSnapshot = this.toggleModalSnapshot.bind(this);+ this.toggleModalInfo = this.toggleModalInfo.bind(this);+ }++ toggleModalShare(e) {+ e.preventDefault();+ this.setState({+ modalShare: !this.state.modalShare+ });+ }++ toggleModalProjection(e) {+ e.preventDefault();+ this.setState({+ modalProjection: !this.state.modalProjection+ });+ }++ toggleModalSnapshot(e) {+ e.preventDefault();+ this.setState({+ modalSnapshot: !this.state.modalSnapshot+ });+ }++ toggleModalInfo(e) {+ e.preventDefault();+ this.setState({+ modalInfo: !this.state.modalInfo+ });+ }++ render() {+ return (+ <React.Fragment>+ <li id="wv-link-button" className="wv-toolbar-button"></li>+ <li id="wv-proj-button" className="wv-toolbar-button"></li>+ <li id="wv-image-button" className="wv-toolbar-button"></li>+ <li id="wv-info-button" className="wv-toolbar-button wv-status-hide"></li>+ </React.Fragment>+ );+ }+}++export default Tour;\ No newline at end of filediff --git a/web/js/components/tour/in-progress.js b/web/js/components/tour/in-progress.jsindex 1515f9817..76e51a69b 100644--- a/web/js/components/tour/in-progress.js+++ b/web/js/components/tour/in-progress.js@@ -32,7 +32,7 @@ class ModalInProgress extends React.Component {</div></div></a>- <a href="#" className="tour-box volcano">+ <a href="#" className="tour-box volcano"><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">diff --git a/web/js/components/tour/start.js b/web/js/components/tour/start.jsindex e462f1329..f67d8e2b4 100644--- a/web/js/components/tour/start.js+++ b/web/js/components/tour/start.js@@ -5,20 +5,20 @@ class ModalStart extends React.Component {render() {return (<div>- <Modal isOpen={this.props.modalStart} toggle={this.toggleStart} wrapClassName='tour tour-start' className={this.props.className} backdrop={true}>- <ModalHeader toggle={this.toggle}>Welcome to Worldview!</ModalHeader>+ <Modal isOpen={this.props.modalStart} toggle={this.props.toggleModalStart} wrapClassName='tour tour-start' className={this.props.className} backdrop={true}>+ <ModalHeader toggle={this.props.toggleModalStart} charCode="">Welcome to Worldview!</ModalHeader><ModalBody><div className="tour-intro"><p className="intro">The NASA Worldview app provides a satellite's perspective of the planet as itlooks today and as it has in the past. Click an event below to analyze the event ingreat detail within the application. These guides will walk you through new and- create ways to use Worldview. <a href="#" title="Start using Worldview">Start using Worldview <i class="fa fa-arrow-right" aria-hidden="true"></i></a>+ create ways to use Worldview. <a href="#" title="Start using Worldview" onClick={this.props.toggleModalStart}>Start using Worldview <i className="fa fa-arrow-right" aria-hidden="true"></i></a></p></div><div className="tour-box-container"><div className="tour-box-row">- <a href="#" className="tour-box wildfire" onClick={this.props.toggleInProgress}>+ <a href="#" className="tour-box wildfire" onClick={this.props.startTour}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">@@ -32,7 +32,7 @@ class ModalStart extends React.Component {</div></div></a>- <a href="#" className="tour-box volcano" onClick={this.props.toggleInProgress}>+ <a href="#" className="tour-box volcano" onClick={this.props.startTour}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">@@ -45,7 +45,7 @@ class ModalStart extends React.Component {</div></div></a>- <a href="#" className="tour-box snow" onClick={this.props.toggleInProgress}>+ <a href="#" className="tour-box snow" onClick={this.props.startTour}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">Snow Event</h3>@@ -57,7 +57,7 @@ class ModalStart extends React.Component {</a></div><div className="tour-box-row">- <a href="#" className="tour-box sea-and-lake-ice" onClick={this.props.toggleInProgress}>+ <a href="#" className="tour-box sea-and-lake-ice" onClick={this.props.startTour}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">Sea and Lake Ice Event</h3>@@ -67,7 +67,7 @@ class ModalStart extends React.Component {</div></div></a>- <a href="#" className="tour-box iceberg" onClick={this.props.toggleInProgress}>+ <a href="#" className="tour-box iceberg" onClick={this.props.startTour}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">Iceberg Event</h3>@@ -77,7 +77,7 @@ class ModalStart extends React.Component {</div></div></a>- <a href="#" className="tour-box water-color" onClick={this.props.toggleInProgress}>+ <a href="#" className="tour-box water-color" onClick={this.props.startTour}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">Water Color Event</h3>@@ -89,7 +89,7 @@ class ModalStart extends React.Component {</a></div><div className="tour-box-row">- <a href="#" className="tour-box dust-and-haze" onClick={this.props.toggleInProgress}>+ <a href="#" className="tour-box dust-and-haze" onClick={this.props.startTour}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">Dust and Haze Event</h3>@@ -99,7 +99,7 @@ class ModalStart extends React.Component {</div></div></a>- <a href="#" className="tour-box severe-storm" onClick={this.props.toggleInProgress}>+ <a href="#" className="tour-box severe-storm" onClick={this.props.startTour}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">Severe Storm Event</h3>@@ -109,7 +109,7 @@ class ModalStart extends React.Component {</div></div></a>- <a href="#" className="tour-box man-made" onClick={this.props.toggleInProgress}>+ <a href="#" className="tour-box man-made" onClick={this.props.startTour}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">Man Made Event</h3>diff --git a/web/js/components/tour/tour.js b/web/js/components/tour/tour.jsindex 8ac9b1a9b..3e4fd1cfe 100644--- a/web/js/components/tour/tour.js+++ b/web/js/components/tour/tour.js@@ -1,10 +1,9 @@import React from 'react';-import { Modal, ModalHeader, ModalBody } from 'reactstrap';import TourStart from './start';import TourInProgress from './in-progress';import TourComplete from './complete';-class ModalTour extends React.Component {+class Tour extends React.Component {constructor(props) {super(props);this.state = {@@ -13,42 +12,51 @@ class ModalTour extends React.Component {modalComplete: false};+ this.toggleModalStart = this.toggleModalStart.bind(this);+ this.toggleModalInProgress = this.toggleModalInProgress.bind(this);+ this.toggleModalComplete = this.toggleModalComplete.bind(this);- this.toggleStart = this.toggleStart.bind(this)- this.toggleInProgress = this.toggleInProgress.bind(this)- this.toggleComplete = this.toggleComplete.bind(this)+ this.startTour = this.startTour.bind(this);}- toggleStart(e) {+ toggleModalStart(e) {e.preventDefault();this.setState({modalStart: !this.state.modalStart});}- toggleInProgress(e) {+ toggleModalInProgress(e) {e.preventDefault();this.setState({modalInProgress: !this.state.modalInProgress});}- toggleComplete(e) {+ toggleModalComplete(e) {e.preventDefault();this.setState({modalComplete: !this.state.modalComplete});}+ startTour(e) {+ e.preventDefault();+ this.setState({+ modalStart: false,+ modalInProgress: true+ });+ }+render() {return (<div>- <TourStart modalStart={this.state.modalStart} toggleStart={this.toggleStart} toggleInProgress={this.toggleInProgress} toggleComplete={this.toggleComplete}></TourStart>- <TourInProgress modalInProgress={this.state.modalInProgress} toggleStart={this.toggleStart} toggleInProgress={this.toggleInProgress} toggleComplete={this.toggleComplete}></TourInProgress>- <TourComplete modalComplete={this.state.modalComplete} toggleStart={this.toggleStart} toggleInProgress={this.toggleInProgress} toggleComplete={this.toggleComplete}></TourComplete>+ <TourStart modalStart={this.state.modalStart} toggleModalStart={this.toggleModalStart} toggleModalInProgress={this.toggleModalInProgress} toggleModalComplete={this.toggleModalComplete} startTour={this.startTour}></TourStart>+ <TourInProgress modalInProgress={this.state.modalInProgress} toggleModalStart={this.toggleModalStart} toggleModalInProgress={this.toggleModalInProgress} toggleModalComplete={this.toggleModalComplete} startTour={this.startTour}></TourInProgress>+ <TourComplete modalComplete={this.state.modalComplete} toggleModalStart={this.toggleModalStart} toggleModalInProgress={this.toggleModalInProgress} toggleModalComplete={this.toggleModalComplete} startTour={this.startTour}></TourComplete></div>);}}-export default ModalTour;\ No newline at end of file+export default Tour;\ No newline at end of filediff --git a/web/js/link/ui.js b/web/js/link/ui.jsindex ec79b6786..26d0ac8eb 100644--- a/web/js/link/ui.js+++ b/web/js/link/ui.js@@ -4,7 +4,7 @@ import lodashThrottle from 'lodash/throttle';import React from 'react';import ReactDOM from 'react-dom';import Clipboard from 'clipboard';-import Share from '../components/share/share';+import Share from '../components/toolbar/share/share';import googleTagManager from 'googleTagManager';import util from '../util/util';diff --git a/web/js/toolbar/ui.js b/web/js/toolbar/ui.jsnew file mode 100644index 000000000..22af40338--- /dev/null+++ b/web/js/toolbar/ui.js@@ -0,0 +1,29 @@+import React from 'react';+import ReactDOM from 'react-dom';+import Toolbar from '../components/toolbar/toolbar';++export function toolbarUi(models, ui, config) {+ var self = {};++ var init = function() {+ self.reactComponent = ReactDOM.render(+ React.createElement(Toolbar),+ document.getElementById('wv-toolbar')+ );+ };+ init();+ return self;+}+// var init = function() {+// self.show();+// };++// self.show = function() {+// var TourWidget = React.createElement(TourStart);++// self.reactComponent = ReactDOM.render(TourWidget, document.getElementById('app'));+// };++// init();+// return self;+// }