Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

move geosearch to toolbar, reduce toolbar button size, match zoom and measure buttons, minor style change on map scale and timeline, add different test map pin colors

Ed Platodc81f7f6d640
diff --git a/package-lock.json b/package-lock.json
index 643708952..5ddc8a0df 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7204,6 +7204,11 @@
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=",
"dev": true
},
+ "coordinate-parser": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/coordinate-parser/-/coordinate-parser-1.0.7.tgz",
+ "integrity": "sha512-pkcjigkAEjU5JsTYnuXLkRgR6T5fF/7GXR4p9vWJesy8fKwsheN8zC5d3sSvdMmWihHB4u48xWZ5mUCcgBIEpw=="
+ },
"copy-concurrently": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
@@ -8228,6 +8233,11 @@
"@babel/runtime": "^7.1.2"
}
},
+ "dom-scroll-into-view": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dom-scroll-into-view/-/dom-scroll-into-view-1.0.1.tgz",
+ "integrity": "sha1-Mqu5Lw2P7KYhUWKu9D5LRJq42Zw="
+ },
"dom-serializer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz",
@@ -10506,6 +10516,16 @@
"dev": true,
"optional": true
},
+<<<<<<< HEAD
+=======
+ "ini": {
+ "version": "1.3.5",
+ "resolved": false,
+ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
+ "dev": true,
+ "optional": true
+ },
+>>>>>>> 1a7dc3bb7 (move geosearch to toolbar, reduce toolbar button size, match zoom and measure buttons, minor style change on map scale and timeline, add different test map pin colors)
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": false,
@@ -20012,6 +20032,15 @@
"prop-types": "^15.6.2"
}
},
+ "react-autocomplete": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/react-autocomplete/-/react-autocomplete-1.8.1.tgz",
+ "integrity": "sha1-67vEAABqqRrVOLLRRye55+XQYxA=",
+ "requires": {
+ "dom-scroll-into-view": "1.0.1",
+ "prop-types": "^15.5.10"
+ }
+ },
"react-beautiful-dnd": {
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/react-beautiful-dnd/-/react-beautiful-dnd-13.0.0.tgz",
diff --git a/web/css/geosearch.css b/web/css/geosearch.css
index caf533275..3df905d77 100644
--- a/web/css/geosearch.css
+++ b/web/css/geosearch.css
@@ -1,137 +1,155 @@
-.geosearch-results-menu {
- position: absolute;
- width: 250px;
-}
-
-.geosearch-item:hover {
- cursor: pointer;
-}
-
-.geosearch-input-container {
- margin-right: 5px;
+/* Autocomplete Input */
+.geosearch-search-input-group {
+ flex-wrap: nowrap;
}
.geosearch-autocomplete {
+ height: 38px;
padding: 0 5px;
+ border-radius: 0;
+ border: none;
+ &::placeholder {
+ color: #999;
+ }
}
-.geosearch-autocomplete::placeholder {
- color: #999;
+.geosearch-results-menu {
+ position: absolute;
+ width: 85%;
}
.geosearch-item {
padding: 5px 0 5px 7px;
color: #333;
+ &:hover {
+ cursor: pointer;
+ }
}
-.geosearch-component-expanded-search {
+/* Autocomplete Input Submit Button */
+.geosearch-submit-input-group-addon {
+ height: 38px;
position: absolute;
- right: 0;
- width: 350px;
- transition: width 0.4s, height 0.4s;
+ top: 0;
+ right: 62px;
+ & .btn {
+ background: none;
+ border: none;
+ color: #999;
+ }
}
-.geosearch-component-expanded-search > div {
- background: #fff;
- padding: 1px;
- border-radius: 2px;
-}
-
-.geosearch-component-minimized-button {
- border-radius: 10px;
- padding: 1px;
-}
-
-.geosearch-component-minimized-button.ui-button-click-prevent {
- pointer-events: none;
-}
-
-.geosearch-component-minimized-button.ui-button-click-prevent svg.svg-inline--fa {
- opacity: 0.4;
+/* Geosearch Component */
+.geosearch-component {
+ position: absolute;
+ right: 181px;
+ top: 10px;
+ width: 350px;
+ margin-right: 1px;
+ background: rgba(40, 40, 40, 0.85);
+ border-radius: 5px;
+ z-index: 100;
}
-.geosearch-component-minimized-button svg.svg-inline--fa {
- display: block;
- width: 38px;
- padding: 5px;
- height: 45px;
- color: #fff;
+/* Geosearch Component Coordinate Buttons */
+.geosearch-coordinate-group-container.grouped .geosearch-coordinate-button-addpoint {
+ margin-right: 1px;
}
-.geosearch-component-minimized-button svg.svg-inline--fa:hover {
- color: #000;
+.geosearch-coordinate-button-group {
+ margin-left: 0.5px;
+ & .btn {
+ width: 31px;
+ border: none;
+ background: #00457b;
+ &:focus,
+ &:hover {
+ box-shadow: none;
+ background-color: #eee;
+ color: #00457b;
+ }
+ }
}
-.geosearch-component-minimized-button:hover {
- background-color: #fff;
- color: #1a1a1a;
- border: 1px solid #333;
+.geosearch-coordinate-button-addpoint {
+ border-radius: 0;
+ border-top-right-radius: 5px;
+ border-bottom-right-radius: 5px;
}
-.geosearch-search-submit-container {
+.geosearch-coordinate-button-remove svg.svg-inline--fa.fa-slash {
position: absolute;
- border: 1px solid transparent;
+ top: 10px;
+ left: 6px;
+ font-size: 1.25em;
}
-.geosearch-search-submit-container .input-group-append .btn {
- background: #fff;
- border-top: 1px solid #ced4da;
- border-bottom: 1px solid #ced4da;
+/* Geosearch Component Minimize Button */
+.geosearch-search-minimize-button {
+ background: rgba(40, 40, 40, 0.15);
margin-right: 2px;
-}
-
-.geosearch-search-submit-container .btn {
- background: #fff;
border: none;
- color: #808080;
-}
-
-.geosearch-coordinate-button-group .btn-group > .btn-group:not(:last-child) > .btn, .btn-group > .btn:not(:last-child):not(.dropdown-toggle) {
- border-top-left-radius: 10px;
- border-bottom-left-radius: 10px;
-}
-
-.geosearch-coordinate-button-group .btn-group > .btn-group:not(:first-child) > .btn, .btn-group > .btn:not(:first-child) {
- border-top-right-radius: 10px;
- border-bottom-right-radius: 10px;
-}
-
-.geosearch-coordinate-button-group .btn {
- background: #0070c8;
-}
-.geosearch-coordinate-button-group .btn:hover {
- background: #00457b;
-}
-
-.geosearch-component-expanded-search .minimized {
- width: 42px;
-}
-
-.geosearch-component-expanded-search .expanded {
- width: 350px;
- height: 33.25px;
- opacity: 1;
-}
-
-.geosearch-component-button-container {
+ overflow: hidden;
+ &:focus {
+ box-shadow: none;
+ -webkit-box-shadow: none;
+ background-color: #eee;
+ color: #1a1a1a;
+ }
+ &:hover {
+ background-color: #eee;
+ color: #1a1a1a;
+ }
+ &.disabled:hover {
+ background-color: rgba(40, 40, 40, 0.85);
+ color: #eee;
+ }
+}
+
+.geosearch-search-minimize-button-chevron {
position: absolute;
- right: 11px;
- top: 95px;
- z-index: 10000;
- background: none rgba(40, 40, 40, 0.85);
- border-radius: 10px;
- width: 42px;
- height: 49px;
- transition: width 0.4s, height 0.4s;
-}
-
-.geosearch-component-button-container.expanded {
- border-radius: 1px;
- width: 349.95px;
- height: 33.25px;
-}
-
-.geosearch-coordinate-button-remove p {
- font-weight: 700;
- font-size: 1.3em;
+ background: url('../images/icon-sprite.svg') -206px -3px no-repeat;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ width: 57px;
+ left: -18px;
+ height: 30px;
+ transform: rotate(90deg);
+ &:hover {
+ background-position: -206px -63px;
+ }
+}
+
+/* Additional Styling */
+.dark-input,
+.dark-input:focus {
+ background: none;
+ background-color: none;
+ color: #fff;
+ box-shadow: none;
+}
+
+/* Mobile Styling */
+@media only screen and (max-width: 768px) {
+ .geosearch-component {
+ position: static;
+ width: 100%;
+ }
+ .geosearch-input-container {
+ width: 100%;
+ }
+ .geosearch-autocomplete {
+ font-size: 16px;
+ &::placeholder {
+ font-size: 14px;
+ }
+ }
+ .geosearch-results-menu {
+ width: 100%;
+ }
+ .geosearch-item {
+ padding: 8px 0 8px 7px;
+ line-height: 16px;
+ font-size: 16px;
+ }
}
diff --git a/web/css/layers.css b/web/css/layers.css
index 7b42502c4..d7ddbcdde 100644
--- a/web/css/layers.css
+++ b/web/css/layers.css
@@ -590,7 +590,7 @@
}
}
-@media (min-width: 768px) {
+@media (min-width: 769px) {
.category-width .layer-modal-content {
height: calc(var(--vh, 1vh) * 100 - 135px);
}
diff --git a/web/css/map.css b/web/css/map.css
index f6e38d60d..bd86c1808 100644
--- a/web/css/map.css
+++ b/web/css/map.css
@@ -15,6 +15,7 @@
z-index: 10000;
background: none rgba(40, 40, 40, 0.85);
border: 1px solid #333;
+ margin-right: 0;
}
.wv-map-zoom.ui-button-click-prevent {
@@ -25,11 +26,13 @@
opacity: 0.4;
}
-.wv-map-zoom svg.svg-inline--fa {
+.wv-map-zoom svg.svg-inline--fa,
+.wv-map-rotate-left svg.svg-inline--fa,
+.wv-map-rotate-right svg.svg-inline--fa {
display: block;
- width: 40px;
- padding: 14px;
- height: 45px;
+ width: 36px;
+ padding: 12px;
+ height: 37px;
}
.wv-map-zoom:hover {
@@ -45,15 +48,16 @@
}
.wv-map-zoom-out {
- top: 195px;
+ top: 189px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.wv-map-reset-rotation {
- top: 296px;
+ top: 290px;
border: 1px solid #333;
height: 54px;
+ width: 38px;
}
.wv-map-rotate-left {
@@ -63,7 +67,7 @@
}
.wv-map-rotate-right {
- top: 350px;
+ top: 344px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
@@ -101,24 +105,23 @@
.wv-map-scale-metric {
position: absolute;
z-index: 10;
- right: 75px;
+ right: 58px;
color: #fff;
background-color: rgba(40, 40, 40, 0.85);
text-shadow: -1px -1px 0 #000,
1px -1px 0 #000,
-1px 1px 0 #000,
1px 1px 0 #000;
- padding: 3px;
+ padding: 2px;
border-left: 2px solid #fff;
- border-right: 2px solid #fff;
}
.wv-map-scale-imperial {
- bottom: 150px;
+ bottom: 148px;
border-top: 2px solid #fff;
}
.wv-map-scale-metric {
- bottom: 169px;
+ bottom: 165px;
border-bottom: 2px solid #fff;
}
diff --git a/web/css/measure.css b/web/css/measure.css
index c33da4549..3377e45e8 100644
--- a/web/css/measure.css
+++ b/web/css/measure.css
@@ -2,7 +2,8 @@
position: absolute;
bottom: 148px;
right: 10px;
- padding: 6px 10px;
+ padding: 2.5px 5.5px;
+ margin-left: 0;
}
.modal-dialog.measure-tool-modal {
@@ -33,7 +34,7 @@
}
}
-@media (max-width: 740px) {
+@media (max-width: 768px) {
.wv-measure-button {
bottom: 10px;
}
diff --git a/web/css/mobile.css b/web/css/mobile.css
index 1a50ec2e5..604e94ba2 100644
--- a/web/css/mobile.css
+++ b/web/css/mobile.css
@@ -1,4 +1,4 @@
-@media only screen and (max-width: 739px) {
+@media only screen and (max-width: 768px) {
#wv-sidebar {
position: static;
}
@@ -90,6 +90,13 @@
display: none;
}
+ .wv-toolbar-button {
+ font-size: 14.3px;
+ height: 44px;
+ margin: 0 0 0 4px;
+ padding: 5.72px 9.1px;
+ }
+
div.olControlScaleLineCustom {
bottom: 10px;
}
diff --git a/web/css/palettes.css b/web/css/palettes.css
index b1b55f1bf..e9f3970fa 100644
--- a/web/css/palettes.css
+++ b/web/css/palettes.css
@@ -174,7 +174,7 @@
max-width: 231px;
margin-left: 0;
}
-@media (max-width: 740px) {
+@media (max-width: 768px) {
.wv-palettes-colorbar {
width: 100%;
max-width: 100%;
diff --git a/web/css/sidebar-panel.css b/web/css/sidebar-panel.css
index 9ad366508..7b46cca47 100644
--- a/web/css/sidebar-panel.css
+++ b/web/css/sidebar-panel.css
@@ -515,7 +515,7 @@ li.item.productsitem.inmotion,
color: #c5c5c8;
}
-@media (max-width: 739px) {
+@media (max-width: 768px) {
.sidebar-panel li.item {
h4 {
font-size: 16px;
diff --git a/web/css/timeline.css b/web/css/timeline.css
index 63f130d29..aa7d20461 100644
--- a/web/css/timeline.css
+++ b/web/css/timeline.css
@@ -330,7 +330,7 @@ button:focus {
}
.zoom-level-change {
- width: 75px;
+ width: 74px;
}
.zoom-level-change-arrows {
diff --git a/web/css/toolbar.css b/web/css/toolbar.css
index 127ca7e83..637bc20bb 100644
--- a/web/css/toolbar.css
+++ b/web/css/toolbar.css
@@ -8,13 +8,9 @@
.wv-toolbar-button,
[data-whatintent='mouse'] .wv-toolbar-button:focus {
- font-size: 14.3px;
- height: 44px;
display: inline-block;
- margin: 0 0 0 4px;
background: rgba(40, 40, 40, 0.85);
border: 1px solid #333;
- padding: 5.72px 14.3px;
border-radius: 5px;
&:focus {
box-shadow: none;
@@ -35,6 +31,10 @@
color: #1a1a1a;
}
+.wv-toolbar-button svg[data-icon="share-square"] {
+ width: 1em;
+}
+
.wv-toolbar .btn.disabled {
pointer-events: auto;
cursor: default;
@@ -126,11 +126,29 @@
width: 100%;
}
+/* Geosearch Mobile Modal */
+.toolbar-geosearch-modal {
+ top: 100px;
+ left: 0;
+ right: 0;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.toolbar-geosearch-modal,
+.toolbar-geosearch-modal .modal-content {
+ width: 100%;
+}
+
@media (min-width: 576px) {
.toolbar-modal {
top: 33px;
}
+ .toolbar-geosearch-modal {
+ top: 84px;
+ }
+
.toolbar-info-modal {
right: 10px;
}
@@ -150,7 +168,15 @@
}
}
-@media (min-width: 740px) {
+@media (min-width: 769px) {
+ .wv-toolbar-button,
+ [data-whatintent='mouse'] .wv-toolbar-button:focus {
+ font-size: 20px;
+ height: 38px;
+ margin: 0 0 0 5px;
+ padding: 2.5px 8px;
+ }
+
.toolbar-projection-modal {
right: 37px;
}
diff --git a/web/css/tour.css b/web/css/tour.css
index 1228739d1..acea427cc 100644
--- a/web/css/tour.css
+++ b/web/css/tour.css
@@ -649,7 +649,7 @@
}
}
-@media (min-width: 740px) {
+@media (min-width: 769px) {
.tour {
display: block;
}
diff --git a/web/images/b.png b/web/images/b.png
new file mode 100644
index 000000000..33e608b0c
Binary files /dev/null and b/web/images/b.png differ
diff --git a/web/images/o.png b/web/images/o.png
new file mode 100644
index 000000000..d0d604da9
Binary files /dev/null and b/web/images/o.png differ
diff --git a/web/images/o2.png b/web/images/o2.png
new file mode 100644
index 000000000..68837e667
Binary files /dev/null and b/web/images/o2.png differ
diff --git a/web/images/o3.png b/web/images/o3.png
new file mode 100644
index 000000000..a00c71fcb
Binary files /dev/null and b/web/images/o3.png differ
diff --git a/web/js/app.js b/web/js/app.js
index dc06ad634..34f0758aa 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -16,7 +16,7 @@ import Toolbar from './containers/toolbar';
import Sidebar from './containers/sidebar/sidebar';
// Modal
import Modal from './containers/modal';
-// GeoSearch
+// Geosearch
import Geosearch from './components/geosearch/geosearch';
// Other/MISC
@@ -181,6 +181,7 @@ class App extends React.Component {
render() {
const {
isAnimationWidgetActive,
+ isMobile,
isTourActive,
locationKey,
mapMouseEvents,
@@ -189,6 +190,7 @@ class App extends React.Component {
} = this.props;
return (
<div className="wv-content" id="wv-content" data-role="content">
+ {!isMobile && <Geosearch />}
<Toolbar />
<MapInteractions mouseEvents={mapMouseEvents} />
<div id="wv-alert-container" className="wv-alert-container">
@@ -205,7 +207,6 @@ class App extends React.Component {
<div id="wv-animation-widet-case">
{isAnimationWidgetActive ? <AnimationWidget key={locationKey || '2'} /> : null}
</div>
- <Geosearch />
<MeasureButton />
<Modal key={modalId} />
<ErrorBoundary>
@@ -220,6 +221,7 @@ function mapStateToProps(state, ownProps) {
return {
state,
isAnimationWidgetActive: state.animation.isActive,
+ isMobile: state.browser.lessThan.medium,
isTourActive: state.tour.active,
tour: state.tour,
config: state.config,
@@ -246,6 +248,7 @@ export default connect(
App.propTypes = {
// config: PropTypes.object,
isAnimationWidgetActive: PropTypes.bool,
+ isMobile: PropTypes.bool,
isTourActive: PropTypes.bool,
keyPressAction: PropTypes.func,
locationKey: PropTypes.string,
diff --git a/web/js/components/geosearch/geosearch-input.js b/web/js/components/geosearch/geosearch-input.js
index 5825e681e..e00f172ca 100644
--- a/web/js/components/geosearch/geosearch-input.js
+++ b/web/js/components/geosearch/geosearch-input.js
@@ -1,136 +1,165 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Autocomplete from 'react-autocomplete';
-import isValidCoordinates from './util';
-import { reverseGeocode, suggest, processMagicKey } from '../../modules/geosearch/selectors';
-
+import { Button, InputGroupAddon } from 'reactstrap';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { faSearchLocation } from '@fortawesome/free-solid-svg-icons';
class SearchBox extends Component {
constructor(props) {
super(props);
this.state = {
- searchResults: [],
};
- this.requestTimer = null;
+ this.highlightedItem = null;
}
componentDidMount() {
- this.input.focus();
+ const { geosearchMobileModalOpen, isExpanded } = this.props;
+ // timeout necessary to trigger input focus
+ if (isExpanded || geosearchMobileModalOpen) {
+ setTimeout(() => {
+ this.geosearchInput.focus();
+ }, 1);
+ }
}
- updateSearchResults = (searchResults) => this.setState({ searchResults });
-
- // handle selecting menu item in search results
- onSelect=(value, item) => {
- const { selectCoordinatesToFly, updateValue } = this.props;
- // set the menu to only the selected item
-
- this.updateSearchResults([item]);
- updateValue(value);
- const {
- magicKey,
- // text,
- } = item;
-
- processMagicKey(magicKey).then((result) => {
- const firstCandidate = result.candidates[0];
- const { location } = firstCandidate;
- // TODO TEST NO FIRST CANDIDATE
- const { x, y } = location;
- const parsedX = parseFloat(x.toPrecision(7));
- const parsedY = parseFloat(y.toPrecision(7));
- selectCoordinatesToFly([parsedX, parsedY]);
- });
+ // handle submit button click - required to select coordinates since no suggestions menu
+ handleSubmitClick = (e) => {
+ e.preventDefault();
+ const { onSelect, coordinatesPending, onCoordinateInputSelect } = this.props;
+ if (coordinatesPending.length > 0) {
+ onCoordinateInputSelect();
+ } else if (this.highlightedItem) {
+ onSelect(this.highlightedItem.text, this.highlightedItem);
+ }
}
- // handle input value change including text/coordinates typing, pasting, cutting
- onChange=(e, value) => {
- // e.preventDefault();
- const { selectCoordinatesToFly, updateValue } = this.props;
-
- updateValue(value);
- // check for coordinate value
- const coordinatesInputValue = isValidCoordinates(value);
- if (coordinatesInputValue) {
- clearTimeout(this.requestTimer);
- this.updateSearchResults([]);
-
- const { latitude, longitude } = coordinatesInputValue;
- // TODO: require click/enter to search coordinates
- reverseGeocode([longitude, latitude]).then((results) => {
- selectCoordinatesToFly([longitude, latitude], results);
- });
- } else {
- clearTimeout(this.requestTimer);
- if (!value) {
- this.updateSearchResults([]);
- } else {
- // provide suggestions to populate search result menu item(s)
- this.requestTimer = suggest(value).then((items) => {
- const { suggestions } = items;
- this.updateSearchResults(suggestions);
- });
+ // handle key press to use ENTER key to select
+ handleKeyPress = (e) => {
+ const { coordinatesPending, onCoordinateInputSelect } = this.props;
+ // check tab and enter key code
+ const { charCode } = e;
+ const entered = charCode === 13;
+ if (entered) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ if (coordinatesPending.length > 0) {
+ onCoordinateInputSelect();
}
}
}
- // search result menu item container
+ // render search result menu item container
renderMenu= (children) => (
<div className="geosearch-results-menu">
{children}
</div>
)
- // individual menu items with conditional styling
- renderItem=(item, isHighlighted) => (
- <div
- className="geosearch-item"
- style={{
- background: isHighlighted ? '#0070c8' : '#fff',
- color: isHighlighted ? '#fff' : '#000',
- }}
- key={item.text}
- >
- {item.text}
- </div>
- )
+ // render individual menu items with conditional styling
+ renderItem=(item, isHighlighted) => {
+ if (isHighlighted) {
+ this.highlightedItem = item;
+ }
+ return (
+ <div
+ className="geosearch-item highlighted-render-item"
+ style={{
+ background: isHighlighted ? '#0070c8' : '#fff',
+ color: isHighlighted ? '#fff' : '#000',
+ }}
+ key={item.text}
+ >
+ {item.text}
+ </div>
+ );
+ }
- render() {
- const { searchResults } = this.state;
- const { coordinates, inputValue } = this.props;
- const wrapperStyleWidth = `${coordinates.length > 0 ? '250px' : '283px'}`;
+ // render submit button
+ renderSubmitButton = () => {
+ const {
+ coordinates, inputValue, isMobile,
+ } = this.props;
+ const hasCoordinates = coordinates.length > 0;
+ const buttonContainerRight = hasCoordinates
+ ? isMobile ? '67px' : '62px'
+ : '31px';
return (
- <div className="geosearch-input-container">
+ <InputGroupAddon
+ className="geosearch-submit-input-group-addon"
+ addonType="append"
+ style={{
+ right: buttonContainerRight,
+ }}
+ >
+ <Button
+ style={{
+ color: `${inputValue ? '#0070c8' : ''}`,
+ boxShadow: 'none',
+ }}
+ disabled={!inputValue}
+ onClick={this.handleSubmitClick}
+ className="geosearch-search-submit-button"
+ title="Search by place name or reverse search using coordinates"
+ >
+ <FontAwesomeIcon icon={faSearchLocation} size="1x" />
+ </Button>
+ </InputGroupAddon>
+ );
+ }
+
+ render() {
+ const {
+ coordinates, inputValue, isMobile, onChange, onSelect, searchResults,
+ } = this.props;
+ const hasCoordinates = coordinates.length > 0;
+ const wrapperStyleWidth = hasCoordinates ? '268px' : '299px';
+ const wrapperStyle = {
+ width: isMobile ? '90%' : wrapperStyleWidth,
+ paddingRight: isMobile ? '0' : '26px',
+ };
+ return (
+ <div
+ className="geosearch-input-container"
+ onKeyPress={this.handleKeyPress}
+ >
<Autocomplete
// eslint-disable-next-line no-return-assign
- ref={(el) => this.input = el}
+ ref={(el) => this.geosearchInput = el}
inputProps={{
- className: 'form-control geosearch-autocomplete',
+ className: 'form-control geosearch-autocomplete dark-input',
id: 'geosearch-autocomplete',
- placeholder: 'Search for places and coordinates',
- }}
- wrapperStyle={{
- width: wrapperStyleWidth,
+ placeholder: 'Search for places or enter coordinates',
}}
+ wrapperStyle={wrapperStyle}
value={inputValue}
items={searchResults}
getItemValue={(item) => item.text}
- onSelect={this.onSelect}
- onChange={this.onChange}
+ onSelect={onSelect}
+ onChange={onChange}
+ onMenuVisibilityChange={this.resetHighlightedItem}
renderMenu={this.renderMenu}
renderItem={this.renderItem}
/>
+ {this.renderSubmitButton()}
</div>
);
}
}
SearchBox.propTypes = {
- selectCoordinatesToFly: PropTypes.func,
coordinates: PropTypes.array,
+ coordinatesPending: PropTypes.array,
+ onCoordinateInputSelect: PropTypes.func,
+ searchResults: PropTypes.array,
+ geosearchMobileModalOpen: PropTypes.bool,
inputValue: PropTypes.string,
- updateValue: PropTypes.func,
+ isExpanded: PropTypes.bool,
+ isMobile: PropTypes.bool,
+ onSelect: PropTypes.func,
+ onChange: PropTypes.func,
};
export default SearchBox;
diff --git a/web/js/components/geosearch/geosearch-modal.js b/web/js/components/geosearch/geosearch-modal.js
index 65da0f4fc..72dc0a8e1 100644
--- a/web/js/components/geosearch/geosearch-modal.js
+++ b/web/js/components/geosearch/geosearch-modal.js
@@ -3,88 +3,218 @@ import React, { Component } from 'react';
import {
ButtonGroup, Button, InputGroup, InputGroupAddon,
} from 'reactstrap';
+import { get as lodashGet } from 'lodash';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
- faSearchLocation,
faMapMarkerAlt,
- faChevronRight,
+ faSlash,
} from '@fortawesome/free-solid-svg-icons';
import SearchBox from './geosearch-input';
+import Alert from '../util/alert';
+
+import isValidCoordinates from './util';
+import { reverseGeocode, suggest, processMagicKey } from '../../modules/geosearch/selectors';
class SearchComponent extends Component {
constructor(props) {
super(props);
this.state = {
inputValue: '',
+ isTouchDevice: false,
+ searchResults: [],
+ selectingCoordinatesOnMap: false,
+ coordinatesPending: [],
+ showAlert: false,
};
+ this.requestTimer = null;
}
- updateValue = (inputValue) => {
- this.setState({
- inputValue,
+ componentDidUpdate(prevProps) {
+ const { coordinates } = this.props;
+ const { selectingCoordinatesOnMap, showAlert } = this.state;
+
+ if (showAlert && coordinates.length > 0) {
+ const [prevLong, prevLat] = prevProps.coordinates;
+ const [long, lat] = coordinates;
+ if (prevLong !== long || prevLat !== lat) {
+ this.dismissAlert();
+ }
+ }
+ }
+
+ // update input value
+ updateValue = (inputValue) => this.setState({ inputValue });
+
+ // update list of suggested search results
+ updateSearchResults = (searchResults) => this.setState({ searchResults });
+
+ // update array of pending coordinates
+ updatePendingCoordinates = (coordinatesPending) => this.setState({ coordinatesPending });
+
+ // dismiss message instruction alert
+ dismissAlert = () => this.setState({ showAlert: false });
+
+ // handle submitting search after inputing coordinates
+ onCoordinateInputSelect = () => {
+ const { selectCoordinatesToFly } = this.props;
+ const { coordinatesPending } = this.state;
+
+ const [longitude, latitude] = coordinatesPending;
+ reverseGeocode([longitude, latitude]).then((results) => {
+ selectCoordinatesToFly([longitude, latitude], results);
+ });
+ this.updatePendingCoordinates([]);
+ }
+
+ // handle selecting menu item in search results
+ onSelect=(value, item) => {
+ const { selectCoordinatesToFly } = this.props;
+
+ this.updateSearchResults([item]);
+ this.updateValue(value);
+ const {
+ magicKey,
+ // text,
+ } = item;
+
+ processMagicKey(magicKey).then((result) => {
+ if (lodashGet(result, 'candidates[0]')) {
+ const firstCandidate = result.candidates[0];
+ const { location, attributes } = firstCandidate;
+ const addressAttributes = { address: attributes };
+
+ const { x, y } = location;
+ const parsedX = parseFloat(x.toPrecision(9));
+ const parsedY = parseFloat(y.toPrecision(9));
+ selectCoordinatesToFly([parsedX, parsedY], addressAttributes);
+ }
});
}
+ // handle input value change including text/coordinates typing, pasting, cutting
+ onChange=(e, value) => {
+ e.preventDefault();
+ this.updateValue(value);
+
+ // check for coordinate value
+ const coordinatesInputValue = isValidCoordinates(value);
+ if (coordinatesInputValue) {
+ clearTimeout(this.requestTimer);
+ const { latitude, longitude } = coordinatesInputValue;
+ this.setState({
+ searchResults: [],
+ coordinatesPending: [longitude, latitude],
+ });
+ } else {
+ clearTimeout(this.requestTimer);
+ if (!value) {
+ this.updateSearchResults([]);
+ } else {
+ // provide suggestions to populate search result menu item(s)
+ this.requestTimer = suggest(value).then((items) => {
+ if (lodashGet(items, 'suggestions')) {
+ const { suggestions } = items;
+ this.updateSearchResults(suggestions);
+ }
+ });
+ }
+ }
+ }
+
+ // initiate instruction alert and activate store level toggleReverseGeocodeActive
selectCoordinatesFromMap = (e) => {
- const { toggleReverseGeocodeActive } = this.props;
e.preventDefault();
+ const isTouchDevice = e.type === 'touchend';
+ const { toggleReverseGeocodeActive } = this.props;
toggleReverseGeocodeActive(true);
+ this.setState({
+ selectingCoordinatesOnMap: true,
+ isTouchDevice,
+ showAlert: true,
+ inputValue: '',
+ });
}
- selectCoordinatesToFly = (coordinates) => {
+ // coordinates in array, addressAttributes with address key: object value
+ selectCoordinatesToFly = (coordinates, addressAttributes) => {
const { selectCoordinatesToFly } = this.props;
- selectCoordinatesToFly(coordinates);
+ selectCoordinatesToFly(coordinates, addressAttributes);
}
render() {
const {
- coordinates, clearCoordinates, shouldHide, toggleShowGeosearch,
+ coordinates,
+ clearCoordinates,
+ geosearchMobileModalOpen,
+ isExpanded,
+ isMobile,
+ toggleShowGeosearch,
} = this.props;
- const { inputValue } = this.state;
+ const {
+ coordinatesPending,
+ inputValue,
+ isTouchDevice,
+ searchResults,
+ showAlert,
+ } = this.state;
const hasCoordinates = coordinates.length > 0;
- const textEntered = inputValue;
- const containerClass = `geosearch-component-expanded-search ${!shouldHide ? 'expanded' : ''}`;
+ const alertMessage = `${isTouchDevice ? 'Tap' : 'Click'} on map to add a reverse geocode marker.`;
+ const coordinateButtonGroupContainerClassName = `geosearch-coordinate-group-container ${hasCoordinates ? 'grouped' : ''}`;
return (
- <div className={containerClass}>
- <div>
- <InputGroup>
- <InputGroupAddon addonType="prepend">
- <Button
- className="geosearch-search-minimize-button"
- title="Minimize search box"
- onClick={toggleShowGeosearch}
- >
- <FontAwesomeIcon icon={faChevronRight} size="1x" />
- </Button>
- </InputGroupAddon>
+ <>
+ {showAlert && (
+ <Alert
+ id="geosearch-select-coordinates-alert"
+ isOpen
+ iconClassName="faMapMarkerAlt"
+ title="Geosearch Select Coordinates"
+ timeout={6000}
+ message={alertMessage}
+ onDismiss={this.dismissAlert}
+ />
+ )}
+
+ <div className="geosearch-component">
+ <InputGroup className="geosearch-search-input-group">
+ {!isMobile
+ && (
+ <InputGroupAddon addonType="prepend">
+ <Button
+ className="geosearch-search-minimize-button"
+ title="Minimize search box"
+ onClick={toggleShowGeosearch}
+ >
+ <div className="geosearch-search-minimize-button-chevron" />
+ </Button>
+ </InputGroupAddon>
+ )}
<SearchBox
coordinates={coordinates}
- selectCoordinatesToFly={this.selectCoordinatesToFly}
- isCoordinateSearchActive={false}
- updateValue={this.updateValue}
+ coordinatesPending={coordinatesPending}
inputValue={inputValue}
+ onChange={this.onChange}
+ onCoordinateInputSelect={this.onCoordinateInputSelect}
+ onSelect={this.onSelect}
+ searchResults={searchResults}
+ geosearchMobileModalOpen={geosearchMobileModalOpen}
+ isExpanded={isExpanded}
+ isMobile={isMobile}
/>
- <InputGroupAddon className={`geosearch-search-submit-container ${hasCoordinates ? 'grouped' : ''}`} addonType="append">
- <Button
- style={{
- color: `${textEntered ? '#0070c8' : ''}`,
- left: `${hasCoordinates ? '244px' : '279px'}`,
- }}
- disabled={!textEntered}
- className="geosearch-search-submit-button"
- title="Search by place name or reverse search using coordinates"
+ <InputGroupAddon
+ addonType="append"
+ className={coordinateButtonGroupContainerClassName}
+ >
+ <ButtonGroup
+ className="geosearch-coordinate-button-group"
+
>
- <FontAwesomeIcon icon={faSearchLocation} size="1x" />
- </Button>
- </InputGroupAddon>
- <InputGroupAddon addonType="append" className={`geosearch-coordinate-group-container ${hasCoordinates ? 'grouped' : ''}`}>
- <ButtonGroup className="geosearch-coordinate-button-group">
<Button
onTouchEnd={this.selectCoordinatesFromMap}
onMouseDown={this.selectCoordinatesFromMap}
className="geosearch-coordinate-button-addpoint"
title="Add coordinates marker onto map"
+ style={{ marginRight: hasCoordinates && isMobile ? '6px' : '0' }}
>
<FontAwesomeIcon icon={faMapMarkerAlt} size="1x" />
</Button>
@@ -96,24 +226,27 @@ class SearchComponent extends Component {
className="geosearch-coordinate-button-remove"
title="Clear coordinates marker from map"
>
- <p>X</p>
+ <FontAwesomeIcon icon={faSlash} />
+ <FontAwesomeIcon icon={faMapMarkerAlt} size="1x" />
</Button>
)}
</ButtonGroup>
</InputGroupAddon>
</InputGroup>
</div>
- </div>
+ </>
);
}
}
SearchComponent.propTypes = {
+ clearCoordinates: PropTypes.func,
coordinates: PropTypes.array,
+ geosearchMobileModalOpen: PropTypes.bool,
+ isExpanded: PropTypes.bool,
+ isMobile: PropTypes.bool,
selectCoordinatesToFly: PropTypes.func,
toggleReverseGeocodeActive: PropTypes.func,
- clearCoordinates: PropTypes.func,
- shouldHide: PropTypes.bool,
toggleShowGeosearch: PropTypes.func,
};
diff --git a/web/js/components/geosearch/geosearch.js b/web/js/components/geosearch/geosearch.js
index d3bf0fae3..cf0895c95 100644
--- a/web/js/components/geosearch/geosearch.js
+++ b/web/js/components/geosearch/geosearch.js
@@ -1,10 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
-import { Button } from 'reactstrap';
// import googleTagManager from 'googleTagManager';
-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { faSearchLocation } from '@fortawesome/free-solid-svg-icons';
import GeosearchModal from './geosearch-modal';
import {
clearCoordinates,
@@ -20,64 +17,56 @@ class Geosearch extends React.Component {
};
}
- renderSearchComponent = () => {
+ componentDidUpdate(prevProps) {
+ const { isExpanded, isMobile, toggleShowGeosearch } = this.props;
+ if (isExpanded && prevProps.isMobile !== isMobile) {
+ toggleShowGeosearch();
+ }
+ }
+
+ renderSearchComponent = (isMobile) => {
const {
- coordinates,
clearCoordinates,
- isDistractionFreeModeActive,
+ coordinates,
+ geosearchMobileModalOpen,
isExpanded,
selectCoordinatesToFly,
- shouldBeCollapsed,
- toggleShowGeosearch,
toggleReverseGeocodeActive,
+ toggleShowGeosearch,
} = this.props;
- const shouldHide = shouldBeCollapsed || isDistractionFreeModeActive || !isExpanded;
+
return (
<GeosearchModal
- coordinates={coordinates}
- shouldHide={shouldHide}
+ geosearchMobileModalOpen={geosearchMobileModalOpen}
+ isExpanded={isExpanded}
+ isMobile={isMobile}
clearCoordinates={clearCoordinates}
+ coordinates={coordinates}
selectCoordinatesToFly={selectCoordinatesToFly}
- toggleShowGeosearch={toggleShowGeosearch}
toggleReverseGeocodeActive={toggleReverseGeocodeActive}
+ toggleShowGeosearch={toggleShowGeosearch}
/>
);
}
- renderSearchButton = () => {
- const { isExpanded, toggleShowGeosearch } = this.props;
- return (
- <Button
- id="wv-geosearch-button"
- className="geosearch-component-minimized-button"
- title="Search by place name or reverse search using coordinates"
- onTouchEnd={toggleShowGeosearch}
- onMouseDown={toggleShowGeosearch}
- disabled={isExpanded}
- color="none"
- >
- <FontAwesomeIcon icon={faSearchLocation} size="1x" />
- </Button>
- );
- }
-
render() {
const {
+ isDistractionFreeModeActive,
isExpanded,
isFeatureEnabled,
+ isMobile,
+ shouldBeCollapsed,
} = this.props;
if (!isFeatureEnabled) {
return null;
}
- const containerClass = `geosearch-component-button-container ${isExpanded ? 'expanded' : ''}`;
+ const shouldShowComponent = isExpanded && !shouldBeCollapsed && !isDistractionFreeModeActive;
return (
<>
- <div className={containerClass}>
- {isExpanded
- ? this.renderSearchComponent()
- : this.renderSearchButton()}
- </div>
+ {isMobile
+ ? this.renderSearchComponent(true)
+ : shouldShowComponent && this.renderSearchComponent()}
</>
);
}
@@ -85,6 +74,7 @@ class Geosearch extends React.Component {
const mapStateToProps = (state) => {
const {
+ browser,
config,
modal,
measure,
@@ -92,24 +82,28 @@ const mapStateToProps = (state) => {
geosearch,
ui,
} = state;
- const { features: { geocodeSearch: search } } = config;
+ const { features: { geocodeSearch: isFeatureEnabled } } = config;
const { coordinates, isExpanded } = geosearch;
const { isDistractionFreeModeActive } = ui;
+ const isMobile = browser.lessThan.medium;
const snapshotModalOpen = modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT';
+ const geosearchMobileModalOpen = modal.isOpen && modal.id === 'TOOLBAR_GEOSEARCH_MOBILE';
// Collapse when Image download / GIF / is open or measure tool active
const shouldBeCollapsed = snapshotModalOpen || measure.isActive || animation.gifActive;
return {
coordinates,
isExpanded,
+ geosearchMobileModalOpen,
+ isMobile,
shouldBeCollapsed,
- isFeatureEnabled: search,
+ isFeatureEnabled,
isDistractionFreeModeActive,
};
};
const mapDispatchToProps = (dispatch) => ({
- selectCoordinatesToFly: (coordinates) => {
- dispatch(selectCoordinatesToFly(coordinates));
+ selectCoordinatesToFly: (coordinates, addressAttributes) => {
+ dispatch(selectCoordinatesToFly(coordinates, addressAttributes));
},
toggleShowGeosearch: () => {
dispatch(toggleShowGeosearch());
@@ -123,11 +117,13 @@ const mapDispatchToProps = (dispatch) => ({
});
Geosearch.propTypes = {
- isFeatureEnabled: PropTypes.bool.isRequired,
+ isFeatureEnabled: PropTypes.bool,
clearCoordinates: PropTypes.func,
coordinates: PropTypes.array,
+ geosearchMobileModalOpen: PropTypes.bool,
isExpanded: PropTypes.bool,
isDistractionFreeModeActive: PropTypes.bool,
+ isMobile: PropTypes.bool,
selectCoordinatesToFly: PropTypes.func,
shouldBeCollapsed: PropTypes.bool,
toggleReverseGeocodeActive: PropTypes.func,
diff --git a/web/js/components/measure-tool/measure-button.js b/web/js/components/measure-tool/measure-button.js
index 70a0d5c72..1e3fb6278 100644
--- a/web/js/components/measure-tool/measure-button.js
+++ b/web/js/components/measure-tool/measure-button.js
@@ -54,8 +54,9 @@ class MeasureButton extends React.Component {
}
render() {
- const { isActive, isDistractionFreeModeActive } = this.props;
+ const { isActive, isDistractionFreeModeActive, isMobile } = this.props;
const { showAlert, isTouchDevice } = this.state;
+ const faSize = isMobile ? '2x' : '1x';
const shouldShowAlert = isActive && showAlert;
const message = isTouchDevice ? mobileHelpMsg : helpMsg;
const buttonId = 'wv-measure-button';
@@ -83,6 +84,7 @@ class MeasureButton extends React.Component {
onMouseDown={this.onButtonClick}
disabled={isActive}
>
+<<<<<<< HEAD
<UncontrolledTooltip
placement="top"
target={buttonId}
@@ -90,6 +92,9 @@ class MeasureButton extends React.Component {
{labelText}
</UncontrolledTooltip>
<FontAwesomeIcon icon="ruler" size="2x" />
+=======
+ <FontAwesomeIcon icon={faRuler} size={faSize} />
+>>>>>>> 859ca3689 (add ismobile check for conditional fa button size, clean up geosearch container)
</Button>
</>
);
@@ -99,6 +104,7 @@ class MeasureButton extends React.Component {
const mapStateToProps = (state, ownProps) => ({
isActive: state.measure.isActive,
isDistractionFreeModeActive: state.ui.isDistractionFreeModeActive,
+ isMobile: state.browser.lessThan.medium,
});
const mapDispatchToProps = (dispatch) => ({
openModal: (key, customParams) => {
@@ -114,5 +120,6 @@ export default connect(
MeasureButton.propTypes = {
isActive: PropTypes.bool,
isDistractionFreeModeActive: PropTypes.bool,
+ isMobile: PropTypes.bool,
openModal: PropTypes.func,
};
diff --git a/web/js/containers/modal.js b/web/js/containers/modal.js
index 1772cf2f2..7666d05fc 100644
--- a/web/js/containers/modal.js
+++ b/web/js/containers/modal.js
@@ -98,6 +98,7 @@ class ModalContainer extends Component {
bodyComponentProps,
timeout,
desktopOnly,
+ mobileOnly,
size,
isDraggable,
isResizable,
@@ -110,7 +111,10 @@ class ModalContainer extends Component {
const allowOuterClick = !isOpen || type === 'selection' || clickableBehindModal;
const modalWrapClass = clickableBehindModal ? `clickable-behind-modal ${wrapClassName}` : wrapClassName;
const toggleFunction = toggleWithClose(onToggle, onClose, isOpen);
- if (isMobile && isOpen && desktopOnly) {
+ const shouldToggleMobile = isMobile && desktopOnly;
+ const shouldToggleDesktop = !isMobile && mobileOnly;
+ const toggleConditon = isOpen && (shouldToggleMobile || shouldToggleDesktop);
+ if (toggleConditon) {
toggleFunction();
}
return (
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index c13c26c6c..064a0724e 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -30,6 +30,9 @@ import { notificationWarnings } from '../modules/image-download/constants';
import Notify from '../components/image-download/notify';
import { hasCustomPaletteInActiveProjection } from '../modules/palettes/util';
import { getLayers } from '../modules/layers/selectors';
+// GeoSearch
+import Geosearch from '../components/geosearch/geosearch';
+import { toggleShowGeosearch } from '../modules/geosearch/actions';
Promise.config({ cancellation: true });
@@ -70,6 +73,16 @@ const CUSTOM_MODAL_PROPS = {
desktopOnly: true,
clickableBehindModal: true,
},
+ TOOLBAR_GEOSEARCH_MOBILE: {
+ headerText: 'Search for places or enter coordinates',
+ type: 'toolbar',
+ backdrop: false,
+ modalClassName: 'toolbar-geosearch-modal toolbar-modal toolbar-medium-modal',
+ clickableBehindModal: true,
+ wrapClassName: 'toolbar_modal_outer',
+ mobileOnly: true,
+ bodyComponent: Geosearch,
+ },
};
class toolbarContainer extends Component {
@@ -187,6 +200,50 @@ class toolbarContainer extends Component {
);
}
+ // handle rendering of geosearch button 1) visibility and 2) control of click (mobile vs desktop)
+ renderGeosearchButtonComponent = () => {
+ const {
+ config,
+ isGeosearchExpanded,
+ isMobile,
+ openModal,
+ shouldBeCollapsed,
+ toggleShowGeosearch,
+ } = this.props;
+ const { features: { geocodeSearch: isFeatureEnabled } } = config;
+ const faSize = isMobile ? '2x' : '1x';
+
+ // do not render if geosearch feature isn't enabled
+ if (!isFeatureEnabled) {
+ return null;
+ }
+
+ const handleButtonClick = isMobile
+ ? () => openModal(
+ 'TOOLBAR_GEOSEARCH_MOBILE',
+ CUSTOM_MODAL_PROPS.TOOLBAR_GEOSEARCH_MOBILE,
+ )
+ : () => toggleShowGeosearch();
+
+ const buttonDisplayConditions = isMobile || (!isMobile && !isGeosearchExpanded) || shouldBeCollapsed;
+ return (
+ <Button
+ style={{
+ display: buttonDisplayConditions ? 'inline-block' : 'none',
+ }}
+ type="button"
+ id="wv-geosearch-button"
+ className="wv-toolbar-button"
+ title="Search by place name or reverse search using coordinates"
+ // onTouchEnd={toggleShowGeosearch}
+ // onMouseDown={toggleShowGeosearch}
+ onClick={handleButtonClick}
+ >
+ <FontAwesomeIcon icon="search-location" size={faSize} />
+ </Button>
+ );
+ }
+
renderSnapshotsButton () {
const {
isImageDownloadActive,
@@ -259,6 +316,7 @@ class toolbarContainer extends Component {
className="wv-toolbar"
>
{this.renderShareButton()}
+ {this.renderGeosearchButtonComponent()}
{this.renderProjectionButton()}
{this.renderSnapshotsButton()}
{this.renderInfoButton()}
@@ -270,7 +328,7 @@ class toolbarContainer extends Component {
const mapStateToProps = (state) => {
const {
- notifications, palettes, compare, map, layers, proj, data, ui, browser,
+ animation, browser, notifications, palettes, compare, map, measure, modal, layers, proj, data, ui, geosearch,
} = state;
const { isDistractionFreeModeActive } = ui;
const { number, type } = notifications;
@@ -280,9 +338,16 @@ const mapStateToProps = (state) => {
{ proj: proj.id },
state,
);
+ const isMobile = browser.lessThan.medium;
const isCompareActive = compare.active;
const isDataDownloadActive = data.active;
+ const isGeosearchExpanded = geosearch.isExpanded;
const activePalettes = palettes[activeString];
+
+ // Collapse when Image download / GIF / is open or measure tool active
+ const snapshotModalOpen = modal.isOpen && modal.id === 'TOOLBAR_SNAPSHOT';
+ const shouldBeCollapsed = snapshotModalOpen || measure.isActive || animation.gifActive;
+
return {
notificationType: type,
notificationContentNumber: number,
@@ -295,7 +360,9 @@ const mapStateToProps = (state) => {
&& !isDataDownloadActive,
),
isCompareActive,
- isMobile: browser.lessThan.medium,
+ isGeosearchExpanded,
+ isMobile,
+ shouldBeCollapsed,
hasCustomPalette: hasCustomPaletteInActiveProjection(
activeLayersForProj,
activePalettes,
@@ -315,6 +382,9 @@ const mapDispatchToProps = (dispatch) => ({
toggleDistractionFreeMode: () => {
dispatch(toggleDistractionFreeMode());
},
+ toggleShowGeosearch: () => {
+ dispatch(toggleShowGeosearch());
+ },
refreshStateAfterImageDownload: (activePalettes, rotation, isGraticule) => {
if (activePalettes) {
dispatch(refreshPalettes(activePalettes));
@@ -378,6 +448,7 @@ toolbarContainer.propTypes = {
hasGraticule: PropTypes.bool,
isCompareActive: PropTypes.bool,
isDistractionFreeModeActive: PropTypes.bool,
+ isGeosearchExpanded: PropTypes.bool,
isImageDownloadActive: PropTypes.bool,
isMobile: PropTypes.bool,
isRotated: PropTypes.bool,
@@ -388,4 +459,6 @@ toolbarContainer.propTypes = {
refreshStateAfterImageDownload: PropTypes.func,
requestNotifications: PropTypes.func,
rotation: PropTypes.number,
+ shouldBeCollapsed: PropTypes.bool,
+ toggleShowGeosearch: PropTypes.func,
};
diff --git a/web/js/font-awesome-library.js b/web/js/font-awesome-library.js
index a4f691499..74b2a69b1 100644
--- a/web/js/font-awesome-library.js
+++ b/web/js/font-awesome-library.js
@@ -62,6 +62,7 @@ import {
faRuler,
faRulerCombined,
faSatellite,
+ faSearchLocation,
faShareSquare,
faSlidersH,
faTimes,
@@ -124,6 +125,7 @@ library.add(
faRuler,
faRulerCombined,
faSatellite,
+ faSearchLocation,
faShareSquare,
faSlidersH,
faTimes,
diff --git a/web/js/map/rotation.js b/web/js/map/rotation.js
index 0c86ef6cd..946fbc22d 100644
--- a/web/js/map/rotation.js
+++ b/web/js/map/rotation.js
@@ -54,8 +54,7 @@ export default function MapRotate(ui, models, store) {
const $resetButton = $('<button></button>')
.addClass('wv-map-reset-rotation wv-map-zoom')
- .attr('title', 'Click to reset')
- .attr('style', 'width: 42px');
+ .attr('title', 'Click to reset');
$rotateLeftButton.append($lefticon);
$rotateRightButton.append($righticon);
diff --git a/web/js/modules/geosearch/selectors.js b/web/js/modules/geosearch/selectors.js
index 51daf3a23..7fabd98db 100644
--- a/web/js/modules/geosearch/selectors.js
+++ b/web/js/modules/geosearch/selectors.js
@@ -86,13 +86,18 @@ const createPin = function(coordinates, transformedCoordinates = false, reverseG
rainfall: 500,
});
+ // TODO: test pin colors
+ // o, o2, o3, b, map-pin (default)
+ const src = localStorage.mapPin || 'map-pin';
+
+
const iconStyle = new Style({
image: new Icon({
anchorOrigin: 'bottom-left',
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
scale: 0.5,
- src: 'images/map-pin.png',
+ src: `images/${src}.png`,
}),
});
@@ -120,9 +125,10 @@ const GEOCODE_OPTIONS = {
export async function suggest(val) {
const { requestOptions, urlBase } = GEOCODE_OPTIONS;
+ const encodedValue = encodeURIComponent(val);
try {
- const response = await fetch(`${urlBase}suggest?text=${val}&f=json`, requestOptions);
+ const response = await fetch(`${urlBase}suggest?text=${encodedValue}&f=json`, requestOptions);
const result = await response.text();
return JSON.parse(result);
} catch (error) {
@@ -134,7 +140,7 @@ export async function processMagicKey(magicKey) {
const { requestOptions, urlBase } = GEOCODE_OPTIONS;
try {
- const response = await fetch(`${urlBase}findAddressCandidates?f=json&magicKey=${magicKey}=`, requestOptions);
+ const response = await fetch(`${urlBase}findAddressCandidates?f=json&outFields=*&magicKey=${magicKey}=`, requestOptions);
const result = await response.text();
return JSON.parse(result);
} catch (error) {
@@ -144,10 +150,9 @@ export async function processMagicKey(magicKey) {
export async function reverseGeocode(coordinates) {
const { requestOptions, urlBase } = GEOCODE_OPTIONS;
- console.log(`${urlBase}reverseGeocode?location=${coordinates}&f=json`);
+
try {
const response = await fetch(`${urlBase}reverseGeocode?location=${coordinates}&f=json`, requestOptions);
-
const result = await response.text();
return JSON.parse(result);
} catch (error) {
diff --git a/web/js/modules/geosearch/util.js b/web/js/modules/geosearch/util.js
index e97ef3ead..8a8340c1d 100644
--- a/web/js/modules/geosearch/util.js
+++ b/web/js/modules/geosearch/util.js
@@ -8,14 +8,18 @@ import update from 'immutability-helper';
export default function mapLocationToGeosearchState(
parameters,
stateFromLocation,
+ state,
) {
- if (parameters.marker) {
- stateFromLocation = update(stateFromLocation, {
- geosearch: {
- coordinates: { $set: parameters.marker.split(',') },
- },
- });
- }
+ const { marker } = parameters;
+ const coordinates = marker
+ ? marker.split(',')
+ : [];
+ stateFromLocation = update(stateFromLocation, {
+ geosearch: {
+ coordinates: { $set: coordinates },
+ isExpanded: { $set: !state.browser.lessThan.medium },
+ },
+ });
return stateFromLocation;
}
diff --git a/web/js/util/browser.js b/web/js/util/browser.js
index 333e52782..b60f2f04e 100644
--- a/web/js/util/browser.js
+++ b/web/js/util/browser.js
@@ -60,7 +60,7 @@ export default (function() {
self.touchDevice = false;
self.mobileDevice = false;
self.mobileAndTabletDevice = false;
- self.mobileWidth = 740;
+ self.mobileWidth = 768;
self.constrainedHeight = 320;
const init = function() {