Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add PropTypes and fix lint errors

ZachTRicec0f4930e0d88
diff --git a/web/js/components/toolbar/toolbar.js b/web/js/components/toolbar/toolbar.js
index 85692c96e..d28c6d74f 100644
--- a/web/js/components/toolbar/toolbar.js
+++ b/web/js/components/toolbar/toolbar.js
@@ -60,4 +60,4 @@ class Toolbar extends React.Component {
}
}
-export default Toolbar;
\ No newline at end of file
+export default Toolbar;
diff --git a/web/js/components/tour/content-intro.js b/web/js/components/tour/content-intro.js
index 1c81a28eb..2ab4b626c 100644
--- a/web/js/components/tour/content-intro.js
+++ b/web/js/components/tour/content-intro.js
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
class TourIntro extends React.Component {
render() {
@@ -15,4 +16,8 @@ class TourIntro extends React.Component {
}
}
+TourIntro.propTypes = {
+ toggleModalStart: PropTypes.func.isRequired
+};
+
export default TourIntro;
diff --git a/web/js/components/tour/modal-complete.js b/web/js/components/tour/modal-complete.js
index d37340846..c336d9335 100644
--- a/web/js/components/tour/modal-complete.js
+++ b/web/js/components/tour/modal-complete.js
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
class ModalComplete extends React.Component {
@@ -20,4 +21,11 @@ class ModalComplete extends React.Component {
}
}
-export default ModalComplete;
\ No newline at end of file
+ModalComplete.propTypes = {
+ modalComplete: PropTypes.bool.isRequired,
+ toggleModalComplete: PropTypes.func.isRequired,
+ restartTour: PropTypes.func.isRequired,
+ className: PropTypes.string
+};
+
+export default ModalComplete;
diff --git a/web/js/components/tour/modal-in-progress.js b/web/js/components/tour/modal-in-progress.js
index 0f38666f3..63ef0d242 100644
--- a/web/js/components/tour/modal-in-progress.js
+++ b/web/js/components/tour/modal-in-progress.js
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import Steps from './widget-steps';
import util from '../../util/util';
@@ -74,20 +75,20 @@ class ModalInProgress extends React.Component {
}
selectLink() {
- var models, config, ui, state, stepLink, state, projection, layersA, layersB, timeA, timeB, view, zoom, comparisonOn;
+ var models, state, projection, layersA, timeA, timeB;
models = this.props.models;
- config = this.props.config;
- ui = this.props.ui;
+ // var config = this.props.config;
+ // var ui = this.props.ui;
state = util.fromQueryString(location.search);
- comparisonOn = state.ca;
+ // var comparisonOn = state.ca;
timeA = state.t;
timeB = state.t1;
layersA = state.l;
- layersB = state.l1;
+ // var layersB = state.l1;
projection = state.p;
- view = state.v;
- zoom = state.z;
+ // var view = state.v;
+ // var zoom = state.z;
// Set Projection
if (projection) models.proj.select(projection);
@@ -163,4 +164,18 @@ class ModalInProgress extends React.Component {
}
}
+ModalInProgress.propTypes = {
+ models: PropTypes.object.isRequired,
+ modalInProgress: PropTypes.bool.isRequired,
+ toggleModalInProgress: PropTypes.func.isRequired,
+ currentStep: PropTypes.number.isRequired,
+ totalSteps: PropTypes.number.isRequired,
+ currentStoryIndex: PropTypes.number.isRequired,
+ currentStory: PropTypes.object.isRequired,
+ currentStoryId: PropTypes.string.isRequired,
+ decreaseStep: PropTypes.func.isRequired,
+ incrementStep: PropTypes.func.isRequired,
+ className: PropTypes.string
+};
+
export default ModalInProgress;
diff --git a/web/js/components/tour/modal-start.js b/web/js/components/tour/modal-start.js
index 6139c0f2b..237f1c1c2 100644
--- a/web/js/components/tour/modal-start.js
+++ b/web/js/components/tour/modal-start.js
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
import TourIntro from './content-intro';
import TourBoxes from './tour-boxes';
@@ -19,4 +20,13 @@ class ModalStart extends React.Component {
}
}
-export default ModalStart;
\ No newline at end of file
+ModalStart.propTypes = {
+ stories: PropTypes.object.isRequired,
+ storyOrder: PropTypes.array.isRequired,
+ modalStart: PropTypes.bool.isRequired,
+ toggleModalStart: PropTypes.func.isRequired,
+ startTour: PropTypes.func.isRequired,
+ className: PropTypes.string
+};
+
+export default ModalStart;
diff --git a/web/js/components/tour/tour-box.js b/web/js/components/tour/tour-box.js
index 5915de293..b724e7039 100644
--- a/web/js/components/tour/tour-box.js
+++ b/web/js/components/tour/tour-box.js
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
class TourBox extends React.Component {
constructor(props) {
@@ -42,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.box, 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.startTour(e, this.props.story, this.props.key, this.props.storyId)}>
<div className="tour-box-content">
<div className="tour-box-header">
<h3 className="tour-box-title">{this.props.title}</h3>
@@ -56,4 +57,16 @@ class TourBox extends React.Component {
}
}
-export default TourBox;
\ No newline at end of file
+TourBox.propTypes = {
+ key: PropTypes.number.isRequired,
+ story: PropTypes.object.isRequired,
+ storyId: PropTypes.string.isRequired,
+ title: PropTypes.string,
+ description: PropTypes.string,
+ backgroundImage: PropTypes.string,
+ backgroundImageHover: PropTypes.string,
+ className: PropTypes.string,
+ startTour: PropTypes.func.isRequired
+};
+
+export default TourBox;
diff --git a/web/js/components/tour/tour-boxes.js b/web/js/components/tour/tour-boxes.js
index 1c2008cd0..a2441d6e9 100644
--- a/web/js/components/tour/tour-boxes.js
+++ b/web/js/components/tour/tour-boxes.js
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
import TourBox from './tour-box';
class TourBoxes extends React.Component {
@@ -9,7 +10,7 @@ class TourBoxes extends React.Component {
<div className="tour-box-row">
{storyOrder.map(function(storyId, i) {
let story = stories[storyId];
- return (<TourBox key={i} box={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} story={story} storyId={story.id} title={story.title} description={story.description} backgroundImage={story.backgroundImage} backgroundImageHover={story.backgroundImageHover} startTour={startTour} className={'tour-box ' + story.type}/>);
})}
</div>
</div>
@@ -17,4 +18,10 @@ class TourBoxes extends React.Component {
}
}
+TourBoxes.propTypes = {
+ stories: PropTypes.object.isRequired,
+ storyOrder: PropTypes.array.isRequired,
+ startTour: PropTypes.func.isRequired
+};
+
export default TourBoxes;
diff --git a/web/js/components/tour/tour.js b/web/js/components/tour/tour.js
index 87644962e..58c01a55c 100644
--- a/web/js/components/tour/tour.js
+++ b/web/js/components/tour/tour.js
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
import TourStart from './modal-start';
import TourInProgress from './modal-in-progress';
import TourComplete from './modal-complete';
@@ -17,8 +18,6 @@ class Tour extends React.Component {
modalComplete: false,
currentStep: 1,
totalSteps: 10,
- isLoading: false,
- error: null,
tourParameter: this.props.config.parameters.tr || null,
currentStoryIndex: 0,
currentStory: {},
@@ -138,4 +137,21 @@ class Tour extends React.Component {
}
}
+Tour.propTypes = {
+ models: PropTypes.object.isRequired,
+ ui: PropTypes.object.isRequired,
+ config: PropTypes.object.isRequired,
+ stories: PropTypes.object.isRequired,
+ storyOrder: PropTypes.array.isRequired,
+ modalStart: PropTypes.bool.isRequired,
+ modalInProgress: PropTypes.bool.isRequired,
+ modalComplete: PropTypes.bool.isRequired,
+ currentStep: PropTypes.number,
+ totalSteps: PropTypes.number,
+ tourParameter: PropTypes.string,
+ currentStoryIndex: PropTypes.number,
+ currentStory: PropTypes.object,
+ currentStoryId: PropTypes.string
+};
+
export default Tour;
diff --git a/web/js/components/tour/widget-steps.js b/web/js/components/tour/widget-steps.js
index b566b0043..8b002395f 100644
--- a/web/js/components/tour/widget-steps.js
+++ b/web/js/components/tour/widget-steps.js
@@ -1,7 +1,7 @@
import React from 'react';
+import PropTypes from 'prop-types';
class Steps extends React.Component {
-
render() {
return (
<div className="step-container">
@@ -20,4 +20,11 @@ class Steps extends React.Component {
}
}
+Steps.propTypes = {
+ currentStep: PropTypes.number.isRequired,
+ totalSteps: PropTypes.number.isRequired,
+ decreaseStep: PropTypes.func.isRequired,
+ incrementStep: PropTypes.func.isRequired
+};
+
export default Steps;