Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Use interval select widget in animation widget

Jason Kent14b96c909b42
diff --git a/web/css/anim.widget.css b/web/css/anim.widget.css
index e5b2e9323..5c93119c4 100644
--- a/web/css/anim.widget.css
+++ b/web/css/anim.widget.css
@@ -9,6 +9,11 @@
bottom: 125px;
left: 50%;
color: #fff;
+
+ & .custom-interval-widget {
+ top: -61px;
+ left: 48px;
+ }
}
.wv-animation-widget.subdaily {
@@ -29,6 +34,20 @@
text-align: center;
margin-bottom: 7px;
text-transform: capitalize;
+
+ & .interval-btn-container,
+ & .interval-btn.interval-btn-active {
+ color: #ce4c21;
+ display: inline;
+ }
+ & .wv-tooltip {
+ bottom: 120px;
+ left: 44%;
+ position: absolute;
+ border-bottom: 8px solid transparent;
+ width: 100px;
+ z-index: 10;
+ }
}
.wv-animation-widget .wv-icon-case {
diff --git a/web/css/timeline.css b/web/css/timeline.css
index bed0cee55..aa315c02c 100644
--- a/web/css/timeline.css
+++ b/web/css/timeline.css
@@ -85,7 +85,6 @@ button:focus {
padding: 0;
}
- & .timeline-interval,
& .input-wrapper-hour,
& .input-time-divider,
& .input-wrapper-minute,
@@ -347,7 +346,6 @@ button:focus {
position: absolute;
top: -54px;
left: 0;
- display: none;
color: #fff;
border-bottom: thin solid #444;
}
@@ -426,10 +424,10 @@ button:focus {
#current-interval {
white-space: nowrap;
- padding-right: 6px;
+ padding: 2px 6px;
}
-#timeline-header .timeline-interval,
+.timeline-interval,
#zoom-btn-container-axis .wv-zoom-tooltip {
display: block;
width: 100%;
@@ -445,7 +443,7 @@ button:focus {
display: block;
}
-#timeline-interval-btn-container .wv-tooltip {
+.timeline-container .wv-tooltip {
position: absolute;
bottom: 100%;
border-bottom: 8px solid transparent;
diff --git a/web/js/components/animation-widget/header.js b/web/js/components/animation-widget/header.js
deleted file mode 100644
index 5b0e06b72..000000000
--- a/web/js/components/animation-widget/header.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import Tooltip from '../tooltip/tooltip';
-
-/*
- * @class AnimationWidgetHeader
- * @extends React.Component
- */
-class AnimationWidgetHeader extends React.Component {
- render() {
- return (
- <div className="wv-animation-widget-header">
- {'Animate Map in '}
- <Tooltip
- text={this.props.text}
- onClick={this.props.onClick}
- dataArray={this.props.toolTipTextArray}
- />
- {' Increments'}
- </div>
- );
- }
-}
-
-AnimationWidgetHeader.propTypes = {
- onClick: PropTypes.func,
- text: PropTypes.string,
- toolTipTextArray: PropTypes.array
-};
-
-export default AnimationWidgetHeader;
diff --git a/web/js/components/timeline/custom-interval-selector/interval-select.js b/web/js/components/timeline/custom-interval-selector/interval-select.js
index 7726f2709..cbeb43730 100644
--- a/web/js/components/timeline/custom-interval-selector/interval-select.js
+++ b/web/js/components/timeline/custom-interval-selector/interval-select.js
@@ -20,7 +20,7 @@ class TimeScaleSelect extends PureComponent {
render() {
let {
zoomLevel,
- hasSubdailyLayers
+ subDailyMode
} = this.props;
return (
<form
@@ -35,7 +35,7 @@ class TimeScaleSelect extends PureComponent {
<option className="custom-interval-timescale-select-option" value="year">year</option>
<option className="custom-interval-timescale-select-option" value="month">month</option>
<option className="custom-interval-timescale-select-option" value="day">day</option>
- {hasSubdailyLayers
+ {subDailyMode
? <React.Fragment>
<option className="custom-interval-timescale-select-option" value="hour">hour</option>
<option className="custom-interval-timescale-select-option" value="minute">minute</option>
@@ -50,7 +50,7 @@ class TimeScaleSelect extends PureComponent {
TimeScaleSelect.propTypes = {
changeZoomLevel: PropTypes.func,
- hasSubdailyLayers: PropTypes.bool,
+ subDailyMode: PropTypes.bool,
zoomLevel: PropTypes.string
};
diff --git a/web/js/components/timeline/custom-interval-selector/interval-selector-widget.js b/web/js/components/timeline/custom-interval-selector/interval-selector-widget.js
index c74dd8c7c..6ff28228d 100644
--- a/web/js/components/timeline/custom-interval-selector/interval-selector-widget.js
+++ b/web/js/components/timeline/custom-interval-selector/interval-selector-widget.js
@@ -19,40 +19,34 @@ class CustomIntervalSelectorWidget extends PureComponent {
this.props.changeCustomInterval(value, this.props.customIntervalZoomLevel);
}
}
-
changeZoomLevel = (zoomLevel) => {
this.props.changeCustomInterval(this.props.customDelta, timeScaleToNumberKey[zoomLevel]);
}
-
handleKeyPress = (e) => {
if (e.key === 'Escape') {
this.props.toggleCustomIntervalModal();
}
}
-
closeCustomIntervalModal = () => {
this.props.toggleCustomIntervalModal(false);
}
-
componentDidUpdate(prevProps) {
// handle focus widget on opening
if (this.props.customIntervalModalOpen && !prevProps.customIntervalModalOpen) {
this.customIntervalWidget.focus();
}
}
-
render() {
let {
customIntervalModalOpen,
- hasSubdailyLayers,
+ subDailyMode,
customDelta,
customIntervalZoomLevel
} = this.props;
- return (
+ return customIntervalModalOpen && (
<div
onKeyDown={this.handleKeyPress}
className="custom-interval-widget"
- style={{ display: customIntervalModalOpen ? 'block' : 'none' }}
tabIndex={0}
ref={(customIntervalWidget) => { this.customIntervalWidget = customIntervalWidget; }}
>
@@ -63,7 +57,7 @@ class CustomIntervalSelectorWidget extends PureComponent {
changeDelta={this.changeDelta}
/>
<TimeScaleSelect
- hasSubdailyLayers={hasSubdailyLayers}
+ subDailyMode={subDailyMode}
zoomLevel={timeScaleFromNumberKey[customIntervalZoomLevel]}
changeZoomLevel={this.changeZoomLevel}
/>
@@ -79,7 +73,7 @@ CustomIntervalSelectorWidget.propTypes = {
customDelta: PropTypes.number,
customIntervalModalOpen: PropTypes.bool,
customIntervalZoomLevel: PropTypes.number,
- hasSubdailyLayers: PropTypes.bool,
+ subDailyMode: PropTypes.bool,
toggleCustomIntervalModal: PropTypes.func
};
diff --git a/web/js/components/timeline/timeline-controls/interval-timescale-change.js b/web/js/components/timeline/timeline-controls/interval-timescale-change.js
index 85acaefd0..74f7a3bf9 100644
--- a/web/js/components/timeline/timeline-controls/interval-timescale-change.js
+++ b/web/js/components/timeline/timeline-controls/interval-timescale-change.js
@@ -98,13 +98,13 @@ class TimeScaleIntervalChange extends PureComponent {
} = this.state;
let {
customSelected,
- hasSubdailyLayers,
+ subDailyMode,
timeScaleChangeUnit
} = this.props;
return (
<React.Fragment>
<div id="timeline-interval-btn-container"
- className="noselect"
+ className="interval-btn-container noselect"
onMouseEnter={this.toolTipHoverOn}
onMouseLeave={this.toolTipHoverOff}
>
@@ -142,7 +142,7 @@ class TimeScaleIntervalChange extends PureComponent {
>
Day
</span>
- {hasSubdailyLayers ? (
+ {subDailyMode ? (
<React.Fragment>
<span
id="interval-hours"
@@ -187,8 +187,8 @@ TimeScaleIntervalChange.propTypes = {
customDelta: PropTypes.number,
customIntervalZoomLevel: PropTypes.string,
customSelected: PropTypes.bool,
- hasSubdailyLayers: PropTypes.bool,
setTimeScaleIntervalChangeUnit: PropTypes.func,
+ subDailyMode: PropTypes.bool,
timeScaleChangeUnit: PropTypes.string
};
diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.js
index f72a9f38f..15a669a0d 100644
--- a/web/js/containers/animation-widget.js
+++ b/web/js/containers/animation-widget.js
@@ -1,10 +1,10 @@
import React from 'react';
import { connect } from 'react-redux';
import {
- without as lodashWithout,
find as lodashFind,
get as lodashGet
} from 'lodash';
+import googleTagManager from 'googleTagManager';
import util from '../util/util';
import ErrorBoundary from './error-boundary';
import PropTypes from 'prop-types';
@@ -12,12 +12,12 @@ import Slider, { Handle } from 'rc-slider';
import TimeSelector from '../components/date-selector/date-selector';
import LoopButton from '../components/animation-widget/loop-button';
import PlayButton from '../components/animation-widget/play-button';
-import AnimWidgetHeader from '../components/animation-widget/header';
-import googleTagManager from 'googleTagManager';
+import TimeScaleIntervalChange from '../components/timeline/timeline-controls/interval-timescale-change';
+import CustomIntervalSelectorWidget from '../components/timeline/custom-interval-selector/interval-selector-widget';
import PlayQueue from '../components/animation-widget/play-queue';
import { Notify } from '../components/image-download/notify';
import { promiseImageryForTime } from '../modules/map/selectors';
-import { selectDate, selectInterval } from '../modules/date/actions';
+import { selectDate, selectInterval, changeCustomInterval } from '../modules/date/actions';
import GifContainer from './gif';
import {
timeScaleFromNumberKey,
@@ -81,7 +81,8 @@ class AnimationWidget extends React.Component {
this.state = {
speed: props.speed,
isSliding: false,
- isGifActive: false
+ isGifActive: false,
+ customIntervalModalOpen: false
};
this.onDateChange = this.onDateChange.bind(this);
this.onIntervalSelect = this.onIntervalSelect.bind(this);
@@ -173,21 +174,26 @@ class AnimationWidget extends React.Component {
*
* @method onIntervalSelect
*
- * @param {string} zoom - clicked header string (ex: 'day', 'year', '12 day')
+ * @param {string} timeScale - clicked header string (ex: 'day', 'year', '12 day')
* component
*
* @return {void}
*/
- onIntervalSelect(zoom) {
- let { customDelta, customInterval, onIntervalSelect } = this.props;
- let zoomToNumber = timeScaleToNumberKey[zoom]; // undefined if custom
- if (zoomToNumber) {
- onIntervalSelect(1, zoomToNumber, false);
+ onIntervalSelect(timeScale, modalOpen) {
+ let delta;
+ let { customInterval, customDelta } = this.props;
+ let customSelected = timeScale === 'custom';
+
+ if (customSelected && customInterval && customDelta) {
+ timeScale = customInterval;
+ delta = customDelta;
} else {
- onIntervalSelect(customDelta, customInterval, true);
+ timeScale = Number(timeScaleToNumberKey[timeScale]);
+ delta = 1;
}
+ this.props.onIntervalSelect(delta, timeScale, customSelected);
+ this.toggleCustomIntervalModal(modalOpen);
}
-
/*
* update global store startDate, endDate, and isPlaying
*
@@ -207,7 +213,6 @@ class AnimationWidget extends React.Component {
onUpdateStartAndEndDate(startDate, endDate);
onPushPlay();
}
-
/*
* Zeroes start and end animation dates to UTC 00:00:00 for predictable animation range
* subdaily intervals retain hours and minutes
@@ -240,157 +245,191 @@ class AnimationWidget extends React.Component {
endDate
};
}
+ /**
+ * @desc Toggle showing the custom interval modal
+ * @param {Boolean} isOpen
+ * @returns {void}
+ */
+ toggleCustomIntervalModal = (isOpen) => {
+ this.setState({
+ customIntervalModalOpen: isOpen
+ });
+ };
+ /**
+ * @desc handle SET of custom time scale panel
+ * @param {Number} delta
+ * @param {Number} timeScale
+ * @returns {void}
+ */
+ changeCustomInterval = (delta, timeScale) => {
+ this.props.changeCustomInterval(delta, timeScale);
+ };
- render() {
- const {
- increment,
- incrementArray,
- looping,
- isPlaying,
- maxDate,
- minDate,
- sliderLabel,
- startDate,
- endDate,
- onPushPause,
- isActive,
- interval,
- delta,
- layers,
- hasCustomPalettes,
- promiseImageryForTime,
- map,
- selectDate,
- currentDate,
- toggleGif,
- isGifActive,
- isCompareActive,
- subDailyMode
- } = this.props;
- if (!isActive) {
- return '';
- } else if (isGifActive) {
- return <GifContainer onClose={toggleGif} />;
- } else {
- const maxLength = getMaxQueueLength(this.state.speed);
- const queueLength = getQueueLength(
- startDate,
- endDate,
- this.state.speed,
- interval,
- delta
- );
-
- return (
- <ErrorBoundary>
- {isPlaying ? (
- <PlayQueue
- endDate={endDate}
- loop={looping}
- isPlaying={isPlaying}
- currentDate={currentDate}
- canPreloadAll={queueLength <= maxLength}
- startDate={startDate}
- hasCustomPalettes={hasCustomPalettes}
- map={map}
- maxQueueLength={maxLength}
- queueLength={queueLength}
- layers={layers}
- interval={interval}
- delta={delta}
- speed={this.state.speed}
- selectDate={selectDate}
- togglePlaying={onPushPause}
- promiseImageryForTime={promiseImageryForTime}
- onClose={onPushPause}
- />
- ) : null}
- <div
- id="wv-animation-widget"
- className={
- 'wv-animation-widget' + (subDailyMode ? ' subdaily' : '')
- }
- >
- <AnimWidgetHeader
- text={increment}
- toolTipTextArray={incrementArray}
- onClick={this.onIntervalSelect}
- />
+ render() {
+ const { customIntervalModalOpen } = this.state;
+ const {
+ looping,
+ isPlaying,
+ maxDate,
+ minDate,
+ sliderLabel,
+ startDate,
+ endDate,
+ onPushPause,
+ isActive,
+ layers,
+ hasCustomPalettes,
+ promiseImageryForTime,
+ map,
+ selectDate,
+ currentDate,
+ toggleGif,
+ isGifActive,
+ isCompareActive,
+ subDailyMode,
+ delta,
+ interval,
+ customSelected,
+ customDelta,
+ customInterval,
+ hasSubdailyLayers
+ } = this.props;
+ if (!isActive) {
+ return '';
+ } else if (isGifActive) {
+ return <GifContainer onClose={toggleGif} />;
+ } else {
+ const maxLength = getMaxQueueLength(this.state.speed);
+ const queueLength = getQueueLength(
+ startDate,
+ endDate,
+ this.state.speed,
+ interval,
+ delta
+ );
- <PlayButton
- playing={isPlaying}
- play={this.onPushPlay}
- pause={onPushPause}
- />
- <LoopButton looping={looping} onLoop={this.onLoop} />
- <div className="wv-slider-case">
- <Slider
- className="input-range"
- step={0.5}
- max={10}
- min={0.5}
- value={this.state.speed}
- onChange={num => this.setState({ speed: num })}
- handle={RangeHandle}
- onBeforeChange={() => this.setState({ isSliding: true })}
- onAfterChange={() => {
- this.setState({ isSliding: false });
- this.props.onSlide(this.state.speed);
- }}
- />
- <span className="wv-slider-label">{sliderLabel}</span>
- </div>
+ return (
+ <ErrorBoundary>
+ {isPlaying ? (
+ <PlayQueue
+ endDate={endDate}
+ loop={looping}
+ isPlaying={isPlaying}
+ currentDate={currentDate}
+ canPreloadAll={queueLength <= maxLength}
+ startDate={startDate}
+ hasCustomPalettes={hasCustomPalettes}
+ map={map}
+ maxQueueLength={maxLength}
+ queueLength={queueLength}
+ layers={layers}
+ interval={interval}
+ delta={delta}
+ speed={this.state.speed}
+ selectDate={selectDate}
+ togglePlaying={onPushPause}
+ promiseImageryForTime={promiseImageryForTime}
+ onClose={onPushPause}
+ />
+ ) : null}
+ <div
+ id="wv-animation-widget"
+ className={'wv-animation-widget' + (subDailyMode ? ' subdaily' : '')}
+ >
+ <div className="wv-animation-widget-header">
+ {'Animate Map in '}
+ <TimeScaleIntervalChange
+ setTimeScaleIntervalChangeUnit={this.onIntervalSelect}
+ customIntervalZoomLevel={timeScaleFromNumberKey[customInterval]}
+ customSelected={customSelected}
+ customDelta={customDelta}
+ timeScaleChangeUnit={interval}
+ subDailyMode={hasSubdailyLayers}
+ />
+ {' Increments'}
+ </div>
- <a
- href="javascript:void(null)"
- title={
- !isCompareActive
- ? 'Create Animated GIF'
- : 'Exit comparison mode to create GIF'
- }
- className={
- isCompareActive ? 'wv-icon-case disabled' : 'wv-icon-case'
- }
- disabled={isCompareActive}
- onClick={this.openGif}
- >
- <i
- id="wv-animation-widget-file-video-icon"
- className="fas fa-file-video wv-animation-widget-icon"
- />
- </a>
- <div className="wv-anim-dates-case">
- <TimeSelector
- id="start"
- idSuffix="animation-widget-start"
- width="120"
- height="30"
- date={startDate}
- onDateChange={this.onDateChange}
- maxDate={endDate}
- minDate={minDate}
- subDailyMode={subDailyMode}
- />
- <div className="thru-label">To</div>
+ <PlayButton
+ playing={isPlaying}
+ play={this.onPushPlay}
+ pause={onPushPause}
+ />
+ <LoopButton looping={looping} onLoop={this.onLoop} />
+ <div className="wv-slider-case">
+ <Slider
+ className="input-range"
+ step={0.5}
+ max={10}
+ min={0.5}
+ value={this.state.speed}
+ onChange={num => this.setState({ speed: num })}
+ handle={RangeHandle}
+ onBeforeChange={() => this.setState({ isSliding: true })}
+ onAfterChange={() => {
+ this.setState({ isSliding: false });
+ this.props.onSlide(this.state.speed);
+ }}
+ />
+ <span className="wv-slider-label">{sliderLabel}</span>
+ </div>
+ <a
+ href="javascript:void(null)"
+ title={
+ !isCompareActive
+ ? 'Create Animated GIF'
+ : 'Exit comparison mode to create GIF'
+ }
+ className={
+ isCompareActive ? 'wv-icon-case disabled' : 'wv-icon-case'
+ }
+ disabled={isCompareActive}
+ onClick={this.openGif}
+ >
+ <i
+ id="wv-animation-widget-file-video-icon"
+ className="fas fa-file-video wv-animation-widget-icon"
+ />
+ </a>
+ <div className="wv-anim-dates-case">
+ <TimeSelector
+ id="start"
+ idSuffix="animation-widget-start"
+ width="120"
+ height="30"
+ date={startDate}
+ onDateChange={this.onDateChange}
+ maxDate={endDate}
+ minDate={minDate}
+ subDailyMode={subDailyMode}
+ />
+ <div className="thru-label">To</div>
- <TimeSelector
- id="end"
- idSuffix="animation-widget-end"
- width="120"
- height="30"
- date={endDate}
- onDateChange={this.onDateChange}
- maxDate={maxDate}
- minDate={startDate}
- subDailyMode={subDailyMode}
- />
- </div>
- <i className="fa fa-times wv-close" onClick={this.props.onClose} />
- </div>
- </ErrorBoundary>
- );
- }
- }
+ <TimeSelector
+ id="end"
+ idSuffix="animation-widget-end"
+ width="120"
+ height="30"
+ date={endDate}
+ onDateChange={this.onDateChange}
+ maxDate={maxDate}
+ minDate={startDate}
+ subDailyMode={subDailyMode}
+ />
+ </div>
+ <i className="fa fa-times wv-close" onClick={this.props.onClose} />
+ <CustomIntervalSelectorWidget
+ customDelta={customDelta}
+ customIntervalZoomLevel={customInterval}
+ toggleCustomIntervalModal={this.toggleCustomIntervalModal}
+ customIntervalModalOpen={customIntervalModalOpen}
+ changeCustomInterval={this.changeCustomInterval}
+ subDailyMode={hasSubdailyLayers}
+ />
+ </div>
+ </ErrorBoundary>
+ );
+ }
+ }
}
function mapStateToProps(state) {
const {
@@ -406,27 +445,11 @@ function mapStateToProps(state) {
proj,
browser
} = state;
- let {
- startDate,
- endDate,
- speed,
- loop,
- isPlaying,
- isActive,
- gifActive
- } = animation;
+ let { startDate, endDate, speed, loop, isPlaying, isActive, gifActive } = animation;
+ let { customSelected, interval, delta, customInterval, customDelta, appNow } = date;
const activeStr = compare.activeString;
const activeDateStr = compare.isCompareA ? 'selected' : 'selectedB';
const hasSubdailyLayers = hasSubDailySelector(layers[activeStr]);
- const zoomObj = getZoomObject(date, hasSubdailyLayers);
- let {
- customSelected,
- interval,
- delta,
- customInterval,
- customDelta,
- appNow
- } = date;
const activeLayersForProj = getLayers(
layers[activeStr],
{ proj: proj.id },
@@ -441,32 +464,32 @@ function mapStateToProps(state) {
const subDailyMode = subDailyInterval && hasSubdailyLayers;
const minDate = new Date(config.startDate);
const maxDate = appNow;
+ const animationIsActive = isActive &&
+ browser.greaterThan.small &&
+ lodashGet(map, 'ui.selected.frameState_') &&
+ sidebar.activeTab !== 'download' && // No Animation when data download is active
+ !compare.active &&
+ !(modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT'); // No Animation when Image download is open
return {
+ customSelected,
startDate,
endDate,
currentDate: date[activeDateStr],
minDate,
maxDate,
- isActive:
- isActive &&
- browser.greaterThan.small &&
- lodashGet(map, 'ui.selected.frameState_') &&
- sidebar.activeTab !== 'download' && // No Animation when data download is active
- !compare.active &&
- !(modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT'), // No Animation when Image download is open
+ isActive: animationIsActive,
+ hasSubdailyLayers,
subDailyMode,
- incrementArray: zoomObj.array,
- increment: zoomObj.increment,
- customDelta: zoomObj.customDelta,
- customInterval: zoomObj.customInterval,
+ delta: customSelected && customDelta ? customDelta : delta,
+ interval: timeScaleFromNumberKey[useInterval] || 'day',
+ customDelta: customDelta || 1,
+ customInterval: customInterval || 3,
sliderLabel: 'Frames Per Second',
layers: getLayers(layers[activeStr], {}, state),
speed,
isPlaying,
looping: loop,
- delta: customSelected && customDelta ? customDelta : delta || 1,
- interval: timeScaleFromNumberKey[useInterval] || 'day',
hasCustomPalettes,
map,
promiseImageryForTime: (date, layers) => {
@@ -529,8 +552,11 @@ const mapDispatchToProps = dispatch => ({
onSlide: num => {
dispatch(changeFrameRate(num));
},
- onIntervalSelect: (delta, zoom, customSelected) => {
- dispatch(selectInterval(delta, zoom, customSelected));
+ onIntervalSelect: (delta, timeScale, customSelected) => {
+ dispatch(selectInterval(delta, timeScale, customSelected));
+ },
+ changeCustomInterval: (delta, timeScale) => {
+ dispatch(changeCustomInterval(delta, timeScale));
},
onUpdateStartDate(date) {
dispatch(changeStartDate(date));
@@ -547,21 +573,23 @@ export default connect(
mapStateToProps,
mapDispatchToProps
)(AnimationWidget);
+
RangeHandle.propTypes = {
dragging: PropTypes.object,
offset: PropTypes.number,
value: PropTypes.number
};
AnimationWidget.propTypes = {
+ changeCustomInterval: PropTypes.func,
currentDate: PropTypes.object,
customDelta: PropTypes.number,
customInterval: PropTypes.number,
+ customSelected: PropTypes.bool,
delta: PropTypes.number,
endDate: PropTypes.object,
hasCustomPalettes: PropTypes.bool,
hasGraticule: PropTypes.bool,
- increment: PropTypes.string,
- incrementArray: PropTypes.array,
+ hasSubdailyLayers: PropTypes.bool,
interval: PropTypes.string,
isActive: PropTypes.bool,
isCompareActive: PropTypes.bool,
@@ -592,34 +620,3 @@ AnimationWidget.propTypes = {
subDailyMode: PropTypes.bool,
toggleGif: PropTypes.func
};
-
-const getZoomObject = function(dateModel, hasSubDaily) {
- let zooms = [];
- let headerText = '';
- const customText =
- dateModel.customDelta && dateModel.customInterval
- ? `${dateModel.customDelta} ${
- timeScaleFromNumberKey[dateModel.customInterval]
- }`
- : 'custom';
- if (hasSubDaily) {
- zooms = [customText, 'year', 'month', 'day', 'hour', 'minute'];
- } else {
- zooms = [customText, 'year', 'month', 'day'];
- }
- if (dateModel.customSelected) {
- headerText = zooms[0];
- } else {
- let interval = dateModel.interval
- ? dateModel.interval
- : dateModel.selectedZoom - 1;
- headerText = '1 ' + zooms[interval];
- }
- let array = lodashWithout(zooms, headerText);
- return {
- increment: headerText,
- array: [...array],
- customDelta: dateModel.customDelta || 1,
- customInterval: dateModel.customInterval || 3
- };
-};
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 910bd5665..494b2bb60 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -446,6 +446,7 @@ class Timeline extends React.Component {
let delta;
let { customIntervalZoomLevel, customIntervalValue } = this.props;
let customSelected = timeScale === 'custom';
+
if (customSelected && customIntervalZoomLevel && customIntervalValue) {
timeScale = customIntervalZoomLevel;
delta = customIntervalValue;
@@ -659,10 +660,7 @@ class Timeline extends React.Component {
dateB,
isAnimationPlaying,
isAnimationWidgetOpen,
- isGifActive,
- customSelected,
- customIntervalValue,
- customIntervalZoomLevel
+ isGifActive
} = this.props;
// handle update animation positioning and local state from play button/gif creation
@@ -682,18 +680,8 @@ class Timeline extends React.Component {
this.animationDraggerDateUpdate(animStartLocationDate, animEndLocationDate);
}
}
-
- // handle open/close custom interval panel if 'custom' selected in animation widget
- // and no custom value has been initialized
- if (customIntervalValue === 1 && customIntervalZoomLevel === 3) {
- if (!prevProps.customSelected && customSelected) {
- this.toggleCustomIntervalModal(true);
- }
- if (prevProps.customSelected && !customSelected) {
- this.toggleCustomIntervalModal(false);
- }
- }
}
+
if (dateA !== prevProps.dateA && dateA !== this.state.draggerTimeState) {
this.updateDraggerTimeState(dateA, false);
}
@@ -835,6 +823,7 @@ class Timeline extends React.Component {
} = this.state;
let selectedDate = draggerSelected === 'selected' ? draggerTimeState : draggerTimeStateB;
let isTimelineHidden = timelineHidden || hideTimeline;
+ const chevronDirection = isTimelineHidden ? 'left' : 'right';
return (
<div className="timeline-container">
{initialLoadComplete
@@ -869,7 +858,7 @@ class Timeline extends React.Component {
customSelected={customSelected}
customDelta={customIntervalValue}
timeScaleChangeUnit={timeScaleChangeUnit}
- hasSubdailyLayers={hasSubdailyLayers}
+ subDailyMode={hasSubdailyLayers}
/>
<DateChangeArrows
leftArrowDown={this.throttleDecrementDate}
@@ -1043,9 +1032,7 @@ class Timeline extends React.Component {
{/* Open/Close Chevron */}
<div id="timeline-hide" onClick={this.toggleHideTimeline}>
<div
- className={`wv-timeline-hide wv-timeline-hide-double-chevron-${
- isTimelineHidden ? 'left' : 'right'
- }`}
+ className={'wv-timeline-hide wv-timeline-hide-double-chevron-' + chevronDirection}
/>
</div>
</section>
@@ -1056,6 +1043,7 @@ class Timeline extends React.Component {
);
}
}
+
function mapStateToProps(state) {
const {
config,
@@ -1085,7 +1073,6 @@ function mapStateToProps(state) {
const isCompareModeActive = compare.active;
const isSmallScreen = lessThan.medium;
let hasSubdailyLayers = hasSubDaily(layers[compare.activeString]);
- customSelected = Boolean(customSelected);
// handle reset of timescale and intervals if not subdaily
if (!hasSubdailyLayers) {
@@ -1102,8 +1089,7 @@ function mapStateToProps(state) {
let endTime;
if (isCompareModeActive) {
- hasSubdailyLayers =
- hasSubDaily(layers['active']) || hasSubDaily(layers['activeB']);
+ hasSubdailyLayers = hasSubDaily(layers['active']) || hasSubDaily(layers['activeB']);
endTime = getEndTime(layers, config);
} else {
hasSubdailyLayers = hasSubDaily(layers[compare.activeString]);
diff --git a/web/js/location.js b/web/js/location.js
index a53528afd..e1f9bd00d 100644
--- a/web/js/location.js
+++ b/web/js/location.js
@@ -247,10 +247,10 @@ const getParameters = function(config, parameters) {
if (customDelta === 1 && customInterval === 3) {
return undefined;
}
- return currentItemState.toString();
+ return currentItemState === 'true';
},
parse: val => {
- return val.toString();
+ return val === 'true';
}
}
},
diff --git a/web/js/modules/date/actions.js b/web/js/modules/date/actions.js
index b797d6578..825c0d52a 100644
--- a/web/js/modules/date/actions.js
+++ b/web/js/modules/date/actions.js
@@ -34,14 +34,14 @@ export function changeCustomInterval(delta, customInterval) {
return {
type: CHANGE_CUSTOM_INTERVAL,
value: customInterval,
- delta: delta
+ delta
};
}
export function selectInterval(delta, interval, customSelected) {
return {
type: CHANGE_INTERVAL,
value: interval,
- delta: delta,
- customSelected: Boolean(customSelected)
+ delta,
+ customSelected
};
}