Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix proptype validations

Benjamin King92d83c5010db
diff --git a/web/js/components/util/spinner-modal.js b/web/js/components/util/spinner-modal.js
index 5e5d2f3cf..ad23e9afd 100644
--- a/web/js/components/util/spinner-modal.js
+++ b/web/js/components/util/spinner-modal.js
@@ -41,12 +41,10 @@ export default class SpinnerModal extends React.Component {
}
SpinnerModal.defaultProps = {
- headerText: 'Loading',
- valid: true,
- id: '',
- style: null
+ headerText: 'Loading'
};
SpinnerModal.propTypes = {
onClose: PropTypes.func,
- headerText: PropTypes.string
+ headerText: PropTypes.string,
+ delay: PropTypes.number
};
diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.js
index 72e0dc857..03f3d90a6 100644
--- a/web/js/containers/animation-widget.js
+++ b/web/js/containers/animation-widget.js
@@ -18,7 +18,10 @@ import PlayQueue from '../components/animation-widget/play-queue';
import { promiseImageryForTime } from '../modules/map/util';
import { selectDate, selectInterval } from '../modules/date/actions';
import GifContainer from './gif';
-import { timeScaleFromNumberKey, timeScaleToNumberKey } from '../modules/date/constants';
+import {
+ timeScaleFromNumberKey,
+ timeScaleToNumberKey
+} from '../modules/date/constants';
import { getQueueLength, getMaxQueueLength } from '../modules/animation/util';
import {
hasSubDaily as hasSubDailySelector,
@@ -35,6 +38,7 @@ import {
changeEndDate,
toggleComponentGifActive
} from '../modules/animation/actions';
+import util from '../util/util';
const RangeHandle = props => {
const { value, offset, dragging, ...restProps } = props;
@@ -113,16 +117,16 @@ class AnimationWidget extends React.Component {
}
}
/*
- * Changes selected default or custom interval in header and
- * changes left/right date arrow increments
- *
- * @method onZoomSelect
- *
- * @param {string} zoom - clicked header string (ex: 'day', 'year', '12 day')
- * component
- *
- * @return {void}
- */
+ * Changes selected default or custom interval in header and
+ * changes left/right date arrow increments
+ *
+ * @method onZoomSelect
+ *
+ * @param {string} zoom - clicked header string (ex: 'day', 'year', '12 day')
+ * component
+ *
+ * @return {void}
+ */
onZoomSelect(zoom) {
let { customDelta, customInterval, onZoomSelect } = this.props;
let zoomToNumber = timeScaleToNumberKey[zoom]; // undefined if custom
@@ -157,7 +161,8 @@ class AnimationWidget extends React.Component {
selectDate,
currentDate,
toggleGif,
- isGifActive
+ isGifActive,
+ isCompareActive
} = this.props;
if (!isActive) {
return '';
@@ -235,9 +240,18 @@ class AnimationWidget extends React.Component {
<a
href="javascript:void(null)"
- title="Create Animated GIF"
- className="wv-icon-case"
- onClick={toggleGif}
+ title={
+ !isCompareActive
+ ? 'Create Animated GIF'
+ : 'Exit comparison mode to create GIF'
+ }
+ className={
+ isCompareActive ? 'wv-icon-case disabled' : 'wv-icon-case'
+ }
+ disabled={isCompareActive}
+ onClick={e => {
+ toggleGif(e, isCompareActive);
+ }}
>
<i
id="wv-animation-widget-file-video-icon"
@@ -308,7 +322,7 @@ function mapStateToProps(state) {
startDate,
endDate,
currentDate: date[activeDateStr],
- minDate: config.startDate,
+ minDate: util.parseDateUTC(config.startDate),
maxDate: layersLastDateTime(layers[activeStr], config),
isActive:
isActive &&
@@ -334,7 +348,8 @@ function mapStateToProps(state) {
promiseImageryForTime: (date, layers) => {
return promiseImageryForTime(date, layers, state);
},
- isGifActive: gifActive
+ isGifActive: gifActive,
+ isCompareActive: compare.active
};
}
const mapDispatchToProps = dispatch => ({
@@ -353,8 +368,8 @@ const mapDispatchToProps = dispatch => ({
onPushLoop: () => {
dispatch(toggleLooping());
},
- toggleGif: () => {
- dispatch(toggleComponentGifActive());
+ toggleGif: (e, isCompareActive) => {
+ if (!isCompareActive) dispatch(toggleComponentGifActive());
},
onSlide: num => {
dispatch(changeFrameRate(num));
diff --git a/web/js/containers/error-boundary.js b/web/js/containers/error-boundary.js
index e4dcf8daf..269a3a7ff 100644
--- a/web/js/containers/error-boundary.js
+++ b/web/js/containers/error-boundary.js
@@ -52,6 +52,9 @@ export default connect(
mapDispatchToProps
)(ErrorBoundary);
ErrorBoundary.propTypes = {
- children: PropTypes.object,
+ children: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.node),
+ PropTypes.node
+ ]),
errorAlert: PropTypes.func
};
diff --git a/web/js/containers/gif.js b/web/js/containers/gif.js
index b98add56a..c4132bff5 100644
--- a/web/js/containers/gif.js
+++ b/web/js/containers/gif.js
@@ -280,7 +280,7 @@ class GIF extends Component {
<ModalHeader toggle={onClose}>{headerText}</ModalHeader>
<ModalBody>
<div style={{ minHeight: 50 }}>
- <Spinner color={'#fff'} loaded={progress}>
+ <Spinner color={'#fff'} loaded={progress > 0}>
<Progress value={progress} />
</Spinner>
</div>
diff --git a/web/js/containers/image-download.js b/web/js/containers/image-download.js
index c93185e6f..aedb4112d 100644
--- a/web/js/containers/image-download.js
+++ b/web/js/containers/image-download.js
@@ -173,7 +173,6 @@ export default connect(
ImageDownloadContainer.propTypes = {
proj: PropTypes.object.isRequired,
map: PropTypes.object.isRequired,
- models: PropTypes.object.isRequired,
url: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
screenWidth: PropTypes.number,
diff --git a/web/js/containers/sidebar/events.js b/web/js/containers/sidebar/events.js
index 8756ef7de..4195e78c0 100644
--- a/web/js/containers/sidebar/events.js
+++ b/web/js/containers/sidebar/events.js
@@ -191,9 +191,12 @@ Events.propTypes = {
height: PropTypes.number,
deselectEvent: PropTypes.func,
tabTypes: PropTypes.object,
- requestSources: PropTypes.object,
- requestCategories: PropTypes.object,
- requestEvents: PropTypes.object,
+ requestedSources: PropTypes.object,
+ requestedCategories: PropTypes.object,
+ requestedEvents: PropTypes.object,
+ requestEvents: PropTypes.func,
+ requestSources: PropTypes.func,
+ requestCategories: PropTypes.func,
apiURL: PropTypes.string,
config: PropTypes.object,
showAll: PropTypes.bool,
diff --git a/web/js/containers/sidebar/layers.js b/web/js/containers/sidebar/layers.js
index 637adc396..e49b51b7f 100644
--- a/web/js/containers/sidebar/layers.js
+++ b/web/js/containers/sidebar/layers.js
@@ -5,7 +5,7 @@ import LayerList from './layer-list';
import { getLayers } from '../../modules/layers/selectors';
import Scrollbars from '../../components/util/scrollbar';
-class Products extends React.Component {
+class Layers extends React.Component {
render() {
const {
overlays,
@@ -67,14 +67,14 @@ const mapDispatchToProps = dispatch => ({});
export default connect(
mapStateToProps,
mapDispatchToProps
-)(Products);
+)(Layers);
-Products.propTypes = {
+Layers.propTypes = {
overlays: PropTypes.array,
baselayers: PropTypes.array,
isActive: PropTypes.bool,
layerGroupName: PropTypes.string,
height: PropTypes.number,
- checkerBoardPattern: PropTypes.node,
- layerSplit: PropTypes.object
+ checkerBoardPattern: PropTypes.object,
+ layerSplit: PropTypes.number
};
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 4eaba6b93..ddf07434d 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -82,15 +82,14 @@ class Timeline extends React.Component {
* @return {void}
*/
animateByIncrement = (delta, increment) => {
- const {
- endTime,
- startDate,
- hasSubdailyLayers,
- changeDate
- } = this.props;
+ const { endTime, startDate, hasSubdailyLayers, changeDate } = this.props;
let animate = () => {
- var nextTime = getNextTimeSelection(delta, increment, this.props.selectedDate);
+ var nextTime = getNextTimeSelection(
+ delta,
+ increment,
+ this.props.selectedDate
+ );
if (hasSubdailyLayers) {
// can we remove this logic?
if (new Date(startDate) <= nextTime && nextTime <= endTime) {
@@ -134,7 +133,11 @@ class Timeline extends React.Component {
customIntervalModalOpen
) => {
let delta;
- let { customIntervalZoomLevel, customIntervalValue, selectInterval } = this.props;
+ let {
+ customIntervalZoomLevel,
+ customIntervalValue,
+ selectInterval
+ } = this.props;
let customSelected = intervalSelected === 'custom';
if (customSelected && customIntervalZoomLevel && customIntervalValue) {
intervalSelected = customIntervalZoomLevel;
@@ -262,8 +265,12 @@ class Timeline extends React.Component {
</div>
<div id="zoom-buttons-group">
<TimeScaleIntervalChange
- setTimeScaleIntervalChangeUnit={this.setTimeScaleIntervalChangeUnit}
- customIntervalZoomLevel={timeScaleFromNumberKey[customIntervalZoomLevel]}
+ setTimeScaleIntervalChangeUnit={
+ this.setTimeScaleIntervalChangeUnit
+ }
+ customIntervalZoomLevel={
+ timeScaleFromNumberKey[customIntervalZoomLevel]
+ }
customSelected={customSelected}
customDelta={customIntervalValue}
timeScaleChangeUnit={timeScaleChangeUnit}
@@ -495,11 +502,6 @@ export default connect(
)(Timeline);
Timeline.propTypes = {
- proj: PropTypes.object.isRequired,
- map: PropTypes.object.isRequired,
- models: PropTypes.object.isRequired,
- url: PropTypes.string.isRequired,
- onClose: PropTypes.func.isRequired,
screenWidth: PropTypes.number,
screenHeight: PropTypes.number,
draggerSelected: PropTypes.string,