Interactive interface for browsing global, full-resolution satellite imagery
Add ability to start tour from info button link
ZachTRice38de41ab1be9
diff --git a/web/js/components/tour/modal-complete.js b/web/js/components/tour/modal-complete.jsindex c336d9335..e97c27cf4 100644--- a/web/js/components/tour/modal-complete.js+++ b/web/js/components/tour/modal-complete.js@@ -12,7 +12,7 @@ class ModalComplete extends React.Component {<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></ModalBody><ModalFooter>- <button type="button" className="btn btn-primary" onClick={this.props.restartTour}>More Stories</button>+ <button type="button" className="btn btn-primary" onClick={this.props.startTour}>More Stories</button><button type="button" className="btn btn-secondary" onClick={this.props.toggleModalComplete}>Exit Tutorial</button></ModalFooter></Modal>@@ -24,7 +24,7 @@ class ModalComplete extends React.Component {ModalComplete.propTypes = {modalComplete: PropTypes.bool.isRequired,toggleModalComplete: PropTypes.func.isRequired,- restartTour: PropTypes.func.isRequired,+ startTour: PropTypes.func.isRequired,className: PropTypes.string};diff --git a/web/js/components/tour/modal-start.js b/web/js/components/tour/modal-start.jsindex 237f1c1c2..ab94d3e96 100644--- a/web/js/components/tour/modal-start.js+++ b/web/js/components/tour/modal-start.js@@ -12,7 +12,7 @@ class ModalStart extends React.Component {<ModalHeader toggle={this.props.toggleModalStart} charCode="">Welcome to Worldview!</ModalHeader><ModalBody><TourIntro toggleModalStart={this.props.toggleModalStart}></TourIntro>- <TourBoxes stories={this.props.stories} storyOrder={this.props.storyOrder} startTour={this.props.startTour}></TourBoxes>+ <TourBoxes stories={this.props.stories} storyOrder={this.props.storyOrder} selectTour={this.props.selectTour}></TourBoxes></ModalBody></Modal></div>@@ -25,7 +25,7 @@ ModalStart.propTypes = {storyOrder: PropTypes.array.isRequired,modalStart: PropTypes.bool.isRequired,toggleModalStart: PropTypes.func.isRequired,- startTour: PropTypes.func.isRequired,+ selectTour: PropTypes.func.isRequired,className: PropTypes.string};diff --git a/web/js/components/tour/tour-box.js b/web/js/components/tour/tour-box.jsindex e64dee496..b27cab5e2 100644--- a/web/js/components/tour/tour-box.js+++ b/web/js/components/tour/tour-box.js@@ -43,7 +43,7 @@ class TourBox extends React.Component {render() {return (- <a href="#" style={this.state.styles} onMouseOver={(e) => this.onMouseOver(e)} onMouseOut={(e) => this.onMouseOut(e)} className={this.props.className} onClick={(e) => this.props.startTour(e, this.props.story, this.props.index, this.props.storyId)}>+ <a href="#" style={this.state.styles} onMouseOver={(e) => this.onMouseOver(e)} onMouseOut={(e) => this.onMouseOut(e)} className={this.props.className} onClick={(e) => this.props.selectTour(e, this.props.story, this.props.index, this.props.storyId)}><div className="tour-box-content"><div className="tour-box-header"><h3 className="tour-box-title">{this.props.title}</h3>@@ -66,7 +66,7 @@ TourBox.propTypes = {backgroundImage: PropTypes.string,backgroundImageHover: PropTypes.string,className: PropTypes.string,- startTour: PropTypes.func.isRequired+ selectTour: PropTypes.func.isRequired};export default TourBox;diff --git a/web/js/components/tour/tour-boxes.js b/web/js/components/tour/tour-boxes.jsindex ac560a70b..8ce65d4f5 100644--- a/web/js/components/tour/tour-boxes.js+++ b/web/js/components/tour/tour-boxes.js@@ -4,13 +4,13 @@ import TourBox from './tour-box';class TourBoxes extends React.Component {render() {- const { stories, storyOrder, startTour } = this.props;+ const { stories, storyOrder, selectTour } = this.props;return (<div className="tour-box-container"><div className="tour-box-row">{storyOrder.map(function(storyId, i) {let story = stories[storyId];- return (<TourBox key={i} index={i} story={story} storyId={story.id} title={story.title} description={story.description} backgroundImage={story.backgroundImage} backgroundImageHover={story.backgroundImageHover} startTour={startTour} className={'tour-box ' + story.type}/>);+ return (<TourBox key={i} index={i} story={story} storyId={story.id} title={story.title} description={story.description} backgroundImage={story.backgroundImage} backgroundImageHover={story.backgroundImageHover} selectTour={selectTour} className={'tour-box ' + story.type}/>);})}</div></div>@@ -21,7 +21,7 @@ class TourBoxes extends React.Component {TourBoxes.propTypes = {stories: PropTypes.object.isRequired,storyOrder: PropTypes.array.isRequired,- startTour: PropTypes.func.isRequired+ selectTour: PropTypes.func.isRequired};export default TourBoxes;diff --git a/web/js/components/tour/tour.js b/web/js/components/tour/tour.jsindex 9677dc9ab..4334944da 100644--- a/web/js/components/tour/tour.js+++ b/web/js/components/tour/tour.js@@ -25,7 +25,6 @@ class Tour extends React.Component {this.toggleModalStart = this.toggleModalStart.bind(this);this.toggleModalInProgress = this.toggleModalInProgress.bind(this);this.toggleModalComplete = this.toggleModalComplete.bind(this);- this.restartTour = this.restartTour.bind(this);this.incrementStep = this.incrementStep.bind(this);this.decreaseStep = this.decreaseStep.bind(this);}@@ -51,16 +50,6 @@ class Tour extends React.Component {});}- restartTour(e) {- e.preventDefault();- this.setState({- steps: 1,- modalStart: true,- modalInProgress: false,- modalComplete: false- });- }-incrementStep(e) {if (this.state.currentStep + 1 <= this.state.totalSteps) this.setState({ currentStep: this.state.currentStep + 1 });if (this.state.currentStep + 1 === this.state.totalSteps + 1) {@@ -84,7 +73,7 @@ class Tour extends React.Component {toggleModalStart={this.toggleModalStart}toggleModalInProgress={this.toggleModalInProgress}toggleModalComplete={this.toggleModalComplete}- startTour={this.props.startTour}+ selectTour={this.props.selectTour}></TourStart><TourInProgress@@ -93,7 +82,7 @@ class Tour extends React.Component {toggleModalStart={this.toggleModalStart}toggleModalInProgress={this.toggleModalInProgress}toggleModalComplete={this.toggleModalComplete}- startTour={this.props.startTour}+ selectTour={this.props.selectTour}currentStep={this.state.currentStep}totalSteps={this.state.totalSteps}incrementStep={this.incrementStep}@@ -109,7 +98,7 @@ class Tour extends React.Component {toggleModalStart={this.toggleModalStart}toggleModalInProgress={this.toggleModalInProgress}toggleModalComplete={this.toggleModalComplete}- restartTour={this.restartTour}+ startTour={this.props.startTour}></TourComplete></div>);@@ -132,7 +121,8 @@ Tour.propTypes = {currentStoryIndex: PropTypes.number,currentStory: PropTypes.object,currentStoryId: PropTypes.string,- startTour: PropTypes.func.isRequired+ startTour: PropTypes.func.isRequired,+ selectTour: PropTypes.func.isRequired};export default Tour;diff --git a/web/js/tour/ui.js b/web/js/tour/ui.jsindex a2b46824d..7ff330938 100644--- a/web/js/tour/ui.js+++ b/web/js/tour/ui.js@@ -29,14 +29,25 @@ export function tourUi(models, ui, config) {currentStoryIndex: 0,currentStory: {},currentStoryId: '',- startTour: self.startTour+ startTour: self.startTour,+ selectTour: self.selectTour};};- self.startTour = function(e, currentStory, currentStoryIndex, currentStoryId) {+ self.startTour = function(e) {if (e) e.preventDefault();self.reactComponent.setState({- steps: 1,+ currentStep: 1,+ modalStart: true,+ modalInProgress: false,+ modalComplete: false+ });+ };++ self.selectTour = function(e, currentStory, currentStoryIndex, currentStoryId) {+ if (e) e.preventDefault();+ self.reactComponent.setState({+ currentStep: 1,currentStoryIndex: currentStoryIndex,modalStart: false,modalInProgress: true,diff --git a/web/js/ui/info.js b/web/js/ui/info.jsindex a522872a8..5a750f238 100644--- a/web/js/ui/info.js+++ b/web/js/ui/info.js@@ -101,7 +101,7 @@ export function uiInfo (ui, config) {feedbackModal.decorate($feedback.find('a'));$tour.click(function () {- ui.tour.start();+ ui.tour.startTour();});$('#wv-toolbar')