Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2790 sidebar buttons (#4554)

Tom Cariellob0b66ce93ec2
diff --git a/package-lock.json b/package-lock.json
index a8ff4004c..be68763e5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4834,8 +4834,7 @@
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
- "dev": true
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/at-least-node": {
"version": "1.0.0",
@@ -4904,7 +4903,6 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz",
"integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
- "dev": true,
"dependencies": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
@@ -5940,7 +5938,6 @@
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
- "dev": true,
"dependencies": {
"delayed-stream": "~1.0.0"
},
@@ -6941,7 +6938,6 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
- "dev": true,
"engines": {
"node": ">=0.4.0"
}
@@ -8724,7 +8720,6 @@
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
- "dev": true,
"funding": [
{
"type": "individual",
@@ -8769,7 +8764,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
- "dev": true,
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
@@ -14904,8 +14898,7 @@
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
- "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
- "dev": true
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/psl": {
"version": "1.9.0",
diff --git a/web/js/containers/sidebar/footer-content.js b/web/js/containers/sidebar/footer-content.js
index 7286e916a..7d8353f3e 100644
--- a/web/js/containers/sidebar/footer-content.js
+++ b/web/js/containers/sidebar/footer-content.js
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
+import { isMobileOnly, isTablet } from 'react-device-detect';
import { connect } from 'react-redux';
import {
UncontrolledTooltip,
@@ -17,9 +18,11 @@ import {
import { openCustomContent } from '../../modules/modal/actions';
import { getFilteredEvents } from '../../modules/natural-events/selectors';
import { LIMIT_EVENT_REQUEST_COUNT } from '../../modules/natural-events/constants';
+import SearchUiProvider from '../../components/layer/product-picker/search-ui-provider';
import {
toggleOverlayGroups as toggleOverlayGroupsAction,
} from '../../modules/layers/actions';
+import { stop as stopAnimationAction } from '../../modules/animation/actions';
const FooterContent = React.forwardRef((props, ref) => {
const {
@@ -36,6 +39,10 @@ const FooterContent = React.forwardRef((props, ref) => {
openChartingInfoModal,
toggleCharting,
toggleCompare,
+ breakpoints,
+ screenWidth,
+ isPlaying,
+ addLayers,
} = props;
const compareBtnText = !isCompareActive
@@ -60,30 +67,37 @@ const FooterContent = React.forwardRef((props, ref) => {
googleTagManager.pushEvent({ event: 'charting_mode' });
};
+ const onClickAddLayers = (e) => {
+ e.stopPropagation();
+ addLayers(isPlaying, isMobile, breakpoints, screenWidth);
+ googleTagManager.pushEvent({ event: 'add_layers' });
+ };
+
const renderLayersFooter = () => (
- <div className="product-buttons">
- <CompareModeOptions
- isActive={isCompareActive}
- isMobile={isMobile}
- selected={compareMode}
- onclick={changeCompareMode}
- />
- <ChartingModeOptions
- isChartingActive={isChartingActive}
- isMobile={isMobile}
- />
- <div className="compare-chart-container">
- {!isCompareActive && chartFeature
- && (
- <Button
- id="chart-toggle-button"
- aria-label={chartBtnText}
- className={!isCompareActive && chartingModeAccessible ? 'chart-toggle-button btn' : 'chart-toggle-button btn disabled'}
- style={!chartFeature ? { display: 'none' } : null}
- onClick={!isCompareActive && chartingModeAccessible ? onClickToggleCharting : null}
- text={chartBtnText}
- />
- )}
+ <>
+ <div>
+ <CompareModeOptions
+ isActive={isCompareActive}
+ isMobile={isMobile}
+ selected={compareMode}
+ onclick={changeCompareMode}
+ />
+ <ChartingModeOptions
+ isChartingActive={isChartingActive}
+ isMobile={isMobile}
+ />
+ </div>
+ <div className="product-buttons">
+ {!isChartingActive
+ && (
+ <Button
+ id="layers-add"
+ aria-label="Add layers"
+ className="layers-add red"
+ text="+ Add Layers"
+ onClick={onClickAddLayers}
+ />
+ )}
{!isChartingActive
&& (
<Button
@@ -96,7 +110,20 @@ const FooterContent = React.forwardRef((props, ref) => {
/>
)}
</div>
- </div>
+ <div className="charting-button">
+ {!isMobile && !isCompareActive && chartFeature
+ && (
+ <Button
+ id="chart-toggle-button"
+ aria-label={chartBtnText}
+ className={!isCompareActive && chartingModeAccessible ? 'chart-toggle-button btn' : 'chart-toggle-button btn disabled'}
+ style={!chartFeature ? { display: 'none' } : null}
+ onClick={!isCompareActive && chartingModeAccessible ? onClickToggleCharting : null}
+ text={chartBtnText}
+ />
+ )}
+ </div>
+ </>
);
const renderEventsFooter = () => {
@@ -196,6 +223,21 @@ const mapDispatchToProps = (dispatch) => ({
}),
);
},
+ addLayers: (isPlaying) => {
+ const modalClassName = isMobileOnly || isTablet ? 'custom-layer-dialog-mobile custom-layer-dialog light' : 'custom-layer-dialog light';
+ if (isPlaying) {
+ dispatch(stopAnimationAction());
+ }
+ dispatch(
+ openCustomContent('LAYER_PICKER_COMPONENT', {
+ headerText: null,
+ modalClassName,
+ backdrop: true,
+ CompletelyCustomModal: SearchUiProvider,
+ wrapClassName: '',
+ }),
+ );
+ },
});
export default connect(
@@ -219,4 +261,8 @@ FooterContent.propTypes = {
openChartingInfoModal: PropTypes.func,
toggleCompare: PropTypes.func,
toggleCharting: PropTypes.func,
+ breakpoints: PropTypes.object,
+ isPlaying: PropTypes.bool,
+ screenWidth: PropTypes.number,
+ addLayers: PropTypes.func,
};
diff --git a/web/js/containers/sidebar/layers-container.js b/web/js/containers/sidebar/layers-container.js
index 85f30be97..329a55822 100644
--- a/web/js/containers/sidebar/layers-container.js
+++ b/web/js/containers/sidebar/layers-container.js
@@ -4,7 +4,6 @@ import { connect } from 'react-redux';
import { Draggable, Droppable, DragDropContext } from 'react-beautiful-dnd';
import PropTypes from 'prop-types';
import { isMobileOnly, isTablet } from 'react-device-detect';
-import googleTagManager from 'googleTagManager';
import LayerList from './layer-list';
import {
getAllActiveOverlaysBaselayers,
@@ -19,7 +18,6 @@ import {
} from '../../modules/layers/actions';
import Checkbox from '../../components/util/checkbox';
import util from '../../util/util';
-import Button from '../../components/util/button';
import SearchUiProvider from '../../components/layer/product-picker/search-ui-provider';
import { openCustomContent } from '../../modules/modal/actions';
import { stop as stopAnimationAction } from '../../modules/animation/actions';
@@ -39,11 +37,6 @@ function LayersContainer (props) {
reorderOverlayGroups,
toggleCollapse,
toggleOverlayGroups,
- isMobile,
- breakpoints,
- screenWidth,
- isPlaying,
- addLayers,
} = props;
const [overlaysCollapsed, toggleOverlaysCollapsed] = useState(false);
@@ -100,12 +93,6 @@ function LayersContainer (props) {
);
};
- const onClickAddLayers = (e) => {
- e.stopPropagation();
- addLayers(isPlaying, isMobile, breakpoints, screenWidth);
- googleTagManager.pushEvent({ event: 'add_layers' });
- };
-
const renderOverlayGroups = () => (
<DragDropContext onDragEnd={onDragEnd}>
<Droppable
@@ -178,13 +165,6 @@ function LayersContainer (props) {
{ !isEmbedModeActive && (
<div className="product-buttons">
<div className="layers-add-container">
- <Button
- id="layers-add"
- aria-label="Add layers"
- className="layers-add red"
- text="+ Add Layers"
- onClick={onClickAddLayers}
- />
<Checkbox
id="group-overlays-checkbox"
checked={groupOverlays}
diff --git a/web/scss/components/button.scss b/web/scss/components/button.scss
index 4f0af5c5f..a0cbf961e 100644
--- a/web/scss/components/button.scss
+++ b/web/scss/components/button.scss
@@ -14,11 +14,18 @@
}
.wv-button span {
- padding: 3px 6px;
+ padding: 6px 13px 7px;
display: block;
font-size: 13px;
}
+#compare-toggle-button.wv-button > span.button-text,
+#chart-toggle-button.wv-button > span.button-text{
+ display: block;
+ font-size: 13px;
+ padding: 3px 13px 4px;
+}
+
.wv-button.red {
background: #d54e21;
border-color: #d54e21;
@@ -28,7 +35,8 @@
background: #212121;
}
-.wv-button:hover {
+.wv-button:hover,
+#compare-toggle-button:hover {
border-color: #eee;
background-color: #eee;
transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease;
diff --git a/web/scss/features/sidebar.scss b/web/scss/features/sidebar.scss
index d10b7423c..bc8ac3811 100644
--- a/web/scss/features/sidebar.scss
+++ b/web/scss/features/sidebar.scss
@@ -193,11 +193,21 @@
margin-bottom: 10px;
}
-footer .product-buttons .layers-add-container {
+footer .product-buttons {
height: 47px;
- display: flex;
+ width: auto;
padding: 10px;
- justify-content: space-around;
+}
+
+.wv-button {
+ background-image: linear-gradient(#555,#666);
+ border: 1px solid #666;
+ color: #eee;
+ font-family: "Open Sans Bold",sans-serif;
+ font-size: 1em;
+ font-weight: 700;
+ padding: 0;
+ border-radius: 0;
}
.compare-chart-container {
@@ -205,10 +215,29 @@ footer .product-buttons .layers-add-container {
justify-content: space-around;
}
-.layers-add-container {
+.charting-button {
display: flex;
justify-content: space-around;
- margin: 10px 0;
+}
+
+#compare-toggle-button {
+ background-image: linear-gradient(#555,#666);
+ border: 1px solid #666;
+ color: #eee;
+ font-family: "Open Sans Bold",sans-serif;
+ font-size: 1em;
+ font-weight: 700;
+ padding: 0;
+}
+
+footer .compare-toggle-button {
+ border-bottom: none;
+ position: absolute;
+ right: 10px;
+}
+
+div#group-overlays-checkbox-case {
+ margin: 4px 0 0 4px;
}
.layer-group-baselayers {