Interactive interface for browsing global, full-resolution satellite imagery
revise geosearch config feature check in the event it's an older config
Ed Plato24231c376317
diff --git a/web/js/components/geosearch/geosearch.js b/web/js/components/geosearch/geosearch.jsindex 03a8fae8d..8013e232e 100644--- a/web/js/components/geosearch/geosearch.js+++ b/web/js/components/geosearch/geosearch.js@@ -5,6 +5,7 @@ import GeosearchModal from './geosearch-modal';import {toggleShowGeosearch,} from '../../modules/geosearch/actions';+import { isGeosearchFeatureEnabled } from '../../modules/geosearch/util';class Geosearch extends Component {constructor(props) {@@ -74,8 +75,7 @@ const mapStateToProps = (state) => {geosearch,ui,} = state;- const { features: { geocodeSearch: { url: requestUrl } } } = config;- const isFeatureEnabled = !!requestUrl;+ const isFeatureEnabled = isGeosearchFeatureEnabled(config);const { gifActive } = animation;const {isExpanded,diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.jsindex d9b493f93..34309b1b2 100644--- a/web/js/containers/toolbar.js+++ b/web/js/containers/toolbar.js@@ -31,6 +31,7 @@ import Notify from '../components/image-download/notify';import { hasCustomPaletteInActiveProjection } from '../modules/palettes/util';import Geosearch from '../components/geosearch/geosearch';import { toggleShowGeosearch, toggleDialogVisible } from '../modules/geosearch/actions';+import { isGeosearchFeatureEnabled } from '../modules/geosearch/util';import { getAllActiveLayers } from '../modules/layers/selectors';@@ -221,15 +222,13 @@ class toolbarContainer extends Component {shouldBeCollapsed,toggleShowGeosearch,} = this.props;- const { features: { geocodeSearch: { url: requestUrl } } } = config;- const buttonId = 'wv-geosearch-button';- const labelText = 'Search places by location';- const isFeatureEnabled = !!requestUrl;+ const isFeatureEnabled = isGeosearchFeatureEnabled(config);// do not render if geosearch feature isn't enabledif (!isFeatureEnabled) {return null;}-+ const buttonId = 'wv-geosearch-button';+ const labelText = 'Search places by location';const handleButtonClick = isMobile? () => openModal('TOOLBAR_GEOSEARCH_MOBILE',diff --git a/web/js/modules/geosearch/util.js b/web/js/modules/geosearch/util.jsindex 44d87772c..671c779e4 100644--- a/web/js/modules/geosearch/util.js+++ b/web/js/modules/geosearch/util.js@@ -175,3 +175,9 @@ export function getLocalStorageCollapseState() {export function setLocalStorageCollapseState(storageValue) {safeLocalStorage.setItem(GEOSEARCH_COLLAPSED, storageValue);}++/**+ * @param {Object} config+ * @return {Boolean} is geosearch feature enabled+ */+export const isGeosearchFeatureEnabled = ({ features }) => !!(features.geocodeSearch && features.geocodeSearch.url);