Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

revise df sidebar display vs no render for ref mounting, limit gtm to brand url only, add touch listen for detect outer click

Ed Plato5f6f6084ef9e
diff --git a/web/js/app.js b/web/js/app.js
index 91e33d2b0..6ba2bc52b 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -133,14 +133,14 @@ class App extends React.Component {
if (config.scripts) {
util.loadScripts(config.scripts);
}
- if (config.features.googleTagManager) {
- if (!/localhost/.test(window.location.href)) {
- googleTagManager.getIpAddress();
- }
- }
- // Console notifications
if (Brand.release()) {
+ if (config.features.googleTagManager) {
+ if (window.location.href.includes(Brand.BRAND_URL)) {
+ googleTagManager.getIpAddress();
+ }
+ }
+ // Console build version notifications
console.info(
`${Brand.NAME
} - Version ${
diff --git a/web/js/brand.js b/web/js/brand.js
index 5044aca12..5d37832f5 100644
--- a/web/js/brand.js
+++ b/web/js/brand.js
@@ -46,6 +46,13 @@ export default (function() {
*/
self.BUILD_NONCE = '@BUILD_NONCE@';
+ /**
+ * @attribute BRAND_URL
+ * @type String
+ * @static
+ */
+ self.BRAND_URL = '@URL@';
+
/**
* Determines if this is a release build.
*
diff --git a/web/js/components/util/detect-outer-click.js b/web/js/components/util/detect-outer-click.js
index 0b91bd226..646a1f5ca 100644
--- a/web/js/components/util/detect-outer-click.js
+++ b/web/js/components/util/detect-outer-click.js
@@ -14,10 +14,12 @@ export default class OutsideAlerter extends Component {
}
componentDidMount() {
+ document.addEventListener('touchstart', this.handleClickOutside);
document.addEventListener('mousedown', this.handleClickOutside);
}
componentWillUnmount() {
+ document.addEventListener('touchstart', this.handleClickOutside);
document.removeEventListener('mousedown', this.handleClickOutside);
}
diff --git a/web/js/containers/sidebar/sidebar.js b/web/js/containers/sidebar/sidebar.js
index b3f90e662..5b5ef1ea8 100644
--- a/web/js/containers/sidebar/sidebar.js
+++ b/web/js/containers/sidebar/sidebar.js
@@ -222,73 +222,70 @@ class Sidebar extends React.Component {
ref={(iconElement) => { this.iconElement = iconElement; }}
onWheel={wheelCallBack}
/>
- {isDistractionFreeModeActive
- ? null
- : (
- <>
- {isCollapsed && (
- <CollapsedButton
- isMobile={isMobile}
- onclick={this.toggleSidebar}
- numberOfLayers={numberOfLayers}
- />
- )}
- <div
- id="productsHolder"
- className="products-holder-case"
- ref={(el) => {
- this.sideBarCase = el;
- }}
- style={{
- maxHeight: isCollapsed ? '0' : `${screenHeight}px`,
- }}
- onWheel={wheelCallBack}
- >
- {!isCollapsed && (
- <>
- <NavCase
- activeTab={activeTab}
- onTabClick={onTabClick}
+ <>
+ {!isDistractionFreeModeActive && isCollapsed && (
+ <CollapsedButton
+ isMobile={isMobile}
+ onclick={this.toggleSidebar}
+ numberOfLayers={numberOfLayers}
+ />
+ )}
+ <div
+ id="productsHolder"
+ className="products-holder-case"
+ ref={(el) => {
+ this.sideBarCase = el;
+ }}
+ style={{
+ maxHeight: isCollapsed ? '0' : `${screenHeight}px`,
+ display: isDistractionFreeModeActive ? 'none' : 'block',
+ }}
+ onWheel={wheelCallBack}
+ >
+ {!isCollapsed && (
+ <>
+ <NavCase
+ activeTab={activeTab}
+ onTabClick={onTabClick}
+ tabTypes={tabTypes}
+ isMobile={isMobile}
+ toggleSidebar={this.toggleSidebar}
+ isCompareMode={isCompareMode}
+ isDataDisabled={isDataDisabled}
+ />
+ <TabContent activeTab={activeTab}>
+ <TabPane tabId="layers">
+ {this.getProductsToRender(activeTab, isCompareMode)}
+ </TabPane>
+ <TabPane tabId="events">
+ {naturalEvents && activeTab === 'events' && (
+ <Events
+ height={subComponentHeight}
+ isLoading={isLoadingEvents}
+ hasRequestError={hasEventRequestError}
+ eventsData={eventsData}
+ sources={eventsSources}
+ />
+ )}
+ </TabPane>
+ <TabPane tabId="download">
+ {smartHandoffs && (
+ <SmartHandoff
+ isActive={activeTab === 'download'}
tabTypes={tabTypes}
- isMobile={isMobile}
- toggleSidebar={this.toggleSidebar}
- isCompareMode={isCompareMode}
- isDataDisabled={isDataDisabled}
/>
- <TabContent activeTab={activeTab}>
- <TabPane tabId="layers">
- {this.getProductsToRender(activeTab, isCompareMode)}
- </TabPane>
- <TabPane tabId="events">
- {naturalEvents && activeTab === 'events' && (
- <Events
- height={subComponentHeight}
- isLoading={isLoadingEvents}
- hasRequestError={hasEventRequestError}
- eventsData={eventsData}
- sources={eventsSources}
- />
- )}
- </TabPane>
- <TabPane tabId="download">
- {smartHandoffs && (
- <SmartHandoff
- isActive={activeTab === 'download'}
- tabTypes={tabTypes}
- />
- )}
- </TabPane>
- <footer
- ref={(footerElement) => { this.footerElement = footerElement; }}
- >
- <FooterContent tabTypes={tabTypes} activeTab={activeTab} />
- </footer>
- </TabContent>
- </>
- )}
- </div>
- </>
- )}
+ )}
+ </TabPane>
+ <footer
+ ref={(footerElement) => { this.footerElement = footerElement; }}
+ >
+ <FooterContent tabTypes={tabTypes} activeTab={activeTab} />
+ </footer>
+ </TabContent>
+ </>
+ )}
+ </div>
+ </>
</section>
</ErrorBoundary>
);