Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

show loading spinner modal

Jason Kent9b766dc5f9f6
diff --git a/web/js/components/animation-widget/play-queue.js b/web/js/components/animation-widget/play-queue.js
index c243e9c25..30f86111a 100644
--- a/web/js/components/animation-widget/play-queue.js
+++ b/web/js/components/animation-widget/play-queue.js
@@ -1,9 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { Modal, ModalBody, ModalHeader } from 'reactstrap';
import { isEmpty as lodashIsEmpty } from 'lodash';
-import Spinner from 'react-loader';
import Queue from 'promise-queue';
+import PreloadSpinner from './preload-spinner';
import util from '../../util/util';
/*
@@ -448,31 +447,19 @@ class PlayAnimation extends React.Component {
this.interval = setTimeout(player, speed);
}
- renderSpinner() {
- const { onClose } = this.props;
- return (
- <Modal
- isOpen
- toggle={onClose}
- size="sm"
- backdrop={false}
- wrapClassName="clickable-behind-modal"
- >
- <ModalHeader toggle={onClose}> Preloading imagery </ModalHeader>
- <ModalBody>
- <div style={{ minHeight: 50 }}>
- <Spinner color="#fff" loaded={false}>
- Loaded
- </Spinner>
- </div>
- </ModalBody>
- </Modal>
- );
- }
-
render() {
const { isPlaying } = this.state;
- return !isPlaying ? this.renderSpinner() : '';
+ const { onClose } = this.props;
+
+ return isPlaying
+ ? ''
+ : (
+ <PreloadSpinner
+ title="Loading ..."
+ bodyMsg="Preloading imagery for smooth animation"
+ onClose={onClose}
+ />
+ );
}
}
diff --git a/web/js/components/animation-widget/preload-spinner.js b/web/js/components/animation-widget/preload-spinner.js
new file mode 100644
index 000000000..bc04ab213
--- /dev/null
+++ b/web/js/components/animation-widget/preload-spinner.js
@@ -0,0 +1,37 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { Modal, ModalBody, ModalHeader } from 'reactstrap';
+import Spinner from 'react-loader';
+
+export default function PreloadSpinner({ onClose, title, bodyMsg }) {
+ return (
+ <Modal
+ isOpen
+ toggle={onClose}
+ size="sm"
+ backdrop={false}
+ wrapClassName="clickable-behind-modal"
+ >
+ <ModalHeader toggle={onClose}>{title}</ModalHeader>
+ <ModalBody>
+ {bodyMsg && (
+ <div style={{
+ minHeight: 30, marginBottom: 30, fontSize: 14,
+ }}
+ >
+ {bodyMsg}
+ </div>
+ )}
+ <div style={{ minHeight: 50 }}>
+ <Spinner color="#fff" loaded={false} />
+ </div>
+ </ModalBody>
+ </Modal>
+ );
+}
+
+PreloadSpinner.propTypes = {
+ onClose: PropTypes.func,
+ title: PropTypes.string,
+ bodyMsg: PropTypes.string,
+};
diff --git a/web/js/components/timeline/timeline-controls/date-change-arrows.js b/web/js/components/timeline/timeline-controls/date-change-arrows.js
index 36fd848cd..ae03d7a7a 100644
--- a/web/js/components/timeline/timeline-controls/date-change-arrows.js
+++ b/web/js/components/timeline/timeline-controls/date-change-arrows.js
@@ -2,6 +2,7 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import HoverTooltip from '../../util/hover-tooltip';
+import PreloadSpinner from '../../animation-widget/preload-spinner';
import {
setArrowDown as setArrowDownAction,
setArrowUp as setArrowUpAction,
@@ -98,6 +99,8 @@ class DateChangeArrows extends PureComponent {
leftArrowDisabled,
nowButtonDisabled,
rightArrowDisabled,
+ arrowDown,
+ tilesPreloaded,
} = this.props;
const leftArrowDown = () => this.onArrowDown('left');
@@ -107,6 +110,13 @@ class DateChangeArrows extends PureComponent {
return (
<div>
+ {arrowDown && !tilesPreloaded && (
+ <PreloadSpinner
+ title="Loading ..."
+ bodyMsg="Keep holding to animate the map!"
+ />
+ )}
+
{/* LEFT ARROW */}
<div
className={`button-action-group${leftArrowDisabled ? ' button-disabled' : ''}`}