Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Collapse timeline/sidebar during GIF/Img-Download #1619

Benjamin King6f34f3f03c55
diff --git a/web/js/components/animation-widget/gif-panel.js b/web/js/components/animation-widget/gif-panel.js
index 883786330..e06768b4f 100644
--- a/web/js/components/animation-widget/gif-panel.js
+++ b/web/js/components/animation-widget/gif-panel.js
@@ -50,7 +50,6 @@ export default class GifPanel extends React.Component {
const width = dimensions.width;
const requestSize = ((width * height * 24) / 8388608).toFixed(2);
const valid = isFileSizeValid(requestSize, height, width);
- console.log(width, height);
return (
<div className="gif-dialog">
<div className="animation-gif-dialog-wrapper">
diff --git a/web/js/containers/animation-widget.js b/web/js/containers/animation-widget.js
index f76f6ca33..1498e134d 100644
--- a/web/js/containers/animation-widget.js
+++ b/web/js/containers/animation-widget.js
@@ -134,18 +134,14 @@ class AnimationWidget extends React.Component {
promiseImageryForTime,
map,
selectDate,
- currentDate
+ currentDate,
+ toggleGif,
+ isGifActive
} = this.props;
if (!isActive) {
return '';
- } else if (this.state.isGifActive) {
- return (
- <GifContainer
- onClose={() => {
- this.setState({ isGifActive: false });
- }}
- />
- );
+ } else if (isGifActive) {
+ return <GifContainer onClose={toggleGif} />;
} else {
const maxLength = getMaxQueueLength(this.state.speed);
const queueLength = getQueueLength(
@@ -220,9 +216,7 @@ class AnimationWidget extends React.Component {
href="javascript:void(null)"
title="Create Animated GIF"
className="wv-icon-case"
- onClick={() => {
- this.toggleGIF();
- }}
+ onClick={toggleGif}
>
<i
id="wv-animation-widget-file-video-icon"
@@ -274,7 +268,15 @@ function mapStateToProps(state) {
config,
legacy
} = state;
- const { startDate, endDate, speed, loop, isPlaying, isActive } = animation;
+ const {
+ startDate,
+ endDate,
+ speed,
+ loop,
+ isPlaying,
+ isActive,
+ gifActive
+ } = animation;
const activeStr = compare.activeString;
const activeDateStr = compare.isCompareA ? 'selected' : 'selectedB';
const hasSubdailyLayers = hasSubDailySelector(layers[activeStr]);
@@ -308,7 +310,8 @@ function mapStateToProps(state) {
map: legacy.map,
promiseImageryForTime: (date, layers) => {
return promiseImageryForTime(date, layers, state);
- }
+ },
+ isGifActive: gifActive
};
}
const mapDispatchToProps = dispatch => ({
diff --git a/web/js/containers/sidebar/sidebar.js b/web/js/containers/sidebar/sidebar.js
index 791c488e1..decad9ee4 100644
--- a/web/js/containers/sidebar/sidebar.js
+++ b/web/js/containers/sidebar/sidebar.js
@@ -203,7 +203,7 @@ class Sidebar extends React.Component {
}
}
function mapStateToProps(state) {
- const { browser, sidebar, compare, layers, config, modal } = state;
+ const { browser, sidebar, compare, layers, config, modal, animation } = state;
const { screenHeight } = browser;
const { activeTab, isCollapsed } = sidebar;
const { activeString } = compare;
@@ -218,7 +218,9 @@ function mapStateToProps(state) {
isCompareMode: compare.active,
numberOfLayers,
isCollapsed:
- isCollapsed || (modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT'), // Collapse when Image download is open,
+ isCollapsed ||
+ (modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT') ||
+ animation.gifActive, // Collapse when Image download / GIF is open,
tabTypes,
config
};
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index e840e062d..766117900 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -236,7 +236,8 @@ class Timeline extends React.Component {
animStartLocationDate,
animEndLocationDate,
isAnimationWidgetOpen,
- animationDisabled
+ animationDisabled,
+ hideTimeline
} = this.props;
return dateFormatted ? (
<ErrorBoundary>
@@ -287,7 +288,10 @@ class Timeline extends React.Component {
</div>
<div
id="timeline-footer"
- style={{ display: this.state.timelineHidden ? 'none' : 'block' }}
+ style={{
+ display:
+ this.state.timelineHidden || hideTimeline ? 'none' : 'block'
+ }}
>
<div id="wv-animation-widet-case">
{isAnimationWidgetOpen ? <AnimationWidget /> : null}
@@ -354,7 +358,8 @@ function mapStateToProps(state) {
browser,
date,
animation,
- sidebar
+ sidebar,
+ modal
} = state;
let {
customSelected,
@@ -445,8 +450,12 @@ function mapStateToProps(state) {
timelineEndDateLimit,
leftArrowDisabled,
rightArrowDisabled,
+ hideTimeline:
+ (modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT') || animation.gifActive,
animationDisabled:
- !legacy.map.selectedMap || !legacy.map.selectedMap.frameState_ || sidebar.activeTab === 'download'
+ !legacy.map.selectedMap ||
+ !legacy.map.selectedMap.frameState_ ||
+ sidebar.activeTab === 'download'
};
}