Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

set update conditions to reset on tour step without interval, and reset if delta set to 1

Ed Plato8d2be1ddc505
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 08065c9f5..cfe6ce7ee 100644
--- a/web/js/components/timeline/timeline-controls/interval-timescale-change.js
+++ b/web/js/components/timeline/timeline-controls/interval-timescale-change.js
@@ -31,10 +31,21 @@ class TimeScaleIntervalChange extends PureComponent {
timeScaleChangeUnit,
customSelected,
} = this.props;
- if (customSelected && customDelta && timeScaleChangeUnit) {
+ const {
+ customIntervalText,
+ } = this.state;
+ const isCustomIntervalTextSet = customIntervalText !== 'Custom';
+ const defaultDelta = !customDelta || customDelta === 1;
+ if (!customSelected && isCustomIntervalTextSet && (defaultDelta || !timeScaleChangeUnit)) {
+ // reset from tour step change where previous step has custom interval and next step doesn't
+ this.resetCustomIntervalText();
+ } else if (customSelected && customDelta && timeScaleChangeUnit) {
const didCustomDeltaChange = customDelta !== prevProps.customDelta;
const didTimeScaleChangeUnitChange = timeScaleChangeUnit !== prevProps.timeScaleChangeUnit;
- if (didCustomDeltaChange || didTimeScaleChangeUnitChange) {
+ if (isCustomIntervalTextSet && defaultDelta) {
+ // setting custom to '1' will reset; ex: '1 day' won't be duplicated in interval list
+ this.resetCustomIntervalText();
+ } else if (didCustomDeltaChange || didTimeScaleChangeUnitChange) {
this.setCustomIntervalText();
}
}
@@ -78,6 +89,13 @@ class TimeScaleIntervalChange extends PureComponent {
});
}
+ // reset custom text for custom interval
+ resetCustomIntervalText = () => {
+ this.setState({
+ customIntervalText: 'Custom',
+ });
+ }
+
render() {
const {
customIntervalText,