Interactive interface for browsing global, full-resolution satellite imagery
revise to use alert box, update e2e
Ed Plato186676b0cc5d
diff --git a/e2e/features/image-download/crosses-dateline-test.js b/e2e/features/image-download/crosses-dateline-test.jsindex de7ebba0f..a31a15563 100644--- a/e2e/features/image-download/crosses-dateline-test.js+++ b/e2e/features/image-download/crosses-dateline-test.js@@ -5,8 +5,8 @@ const {const TIME_LIMIT = 10000;-const datelineAlertIcon = '.snapshot-date-alert-icon';-const datelineAlertIconTooltipText = '.snapshot-date-warning-tooltip-inner';+const datelineAlert = '#snapshot-dateline-alert';+const datelineAlertMessage = '#snapshot-dateline-alert .wv-alert-message';const withinMapURLParams = '?v=-67.80916012733559,-56.052180562072095,-30.50743102883792,-30.873513420586164&t=2021-08-08-T0';const crossesPrevDayURLParams = '?v=161.16767164758798,-54.46571918482002,198.46940074608565,-29.287052043334096&t=2021-08-08-T0';@@ -23,7 +23,7 @@ module.exports = {openImageDownloadPanel(c);c.pause(500);- c.expect.element(datelineAlertIcon).to.not.be.present;+ c.expect.element(datelineAlert).to.not.be.present;},'Dateline alert icon with previous day message if crosses previous day dateline': (c) => {@@ -32,10 +32,9 @@ module.exports = {openImageDownloadPanel(c);c.pause(500);- c.expect.element(datelineAlertIcon).to.be.present;- c.moveToElement(datelineAlertIcon, 0, 0);- c.waitForElementVisible(datelineAlertIconTooltipText, TIME_LIMIT, (e) => {- c.assert.containsText(datelineAlertIconTooltipText, 'The selected snapshot area crosses the dateline and uses imagery from the previous day 2021 AUG 07.');+ c.expect.element(datelineAlert).to.be.present;+ c.waitForElementVisible(datelineAlertMessage, TIME_LIMIT, (e) => {+ c.assert.containsText(datelineAlertMessage, 'The selected snapshot area crosses the dateline and uses imagery from the previous day 2021 AUG 07.');});},@@ -45,10 +44,9 @@ module.exports = {openImageDownloadPanel(c);c.pause(500);- c.expect.element(datelineAlertIcon).to.be.present;- c.moveToElement(datelineAlertIcon, 0, 0);- c.waitForElementVisible(datelineAlertIconTooltipText, TIME_LIMIT, (e) => {- c.assert.containsText(datelineAlertIconTooltipText, 'The selected snapshot area crosses the dateline and uses imagery from the next day 2021 AUG 09.');+ c.expect.element(datelineAlert).to.be.present;+ c.waitForElementVisible(datelineAlertMessage, TIME_LIMIT, (e) => {+ c.assert.containsText(datelineAlertMessage, 'The selected snapshot area crosses the dateline and uses imagery from the next day 2021 AUG 09.');});},diff --git a/web/css/image.css b/web/css/image.cssindex e790d0516..e279ecc7d 100644--- a/web/css/image.css+++ b/web/css/image.css@@ -93,23 +93,3 @@.wv-image-top {text-align: right;}--.snapshots-date-header {- display: flex;- & .date-text {- font: 400 12px 'Arial';- }-}--.snapshot-date-alert-icon {- font-size: 10px;- position: absolute;- bottom: 8px;- right: 5px;- color: #f60;- cursor: pointer;-}--.snapshot-date-warning-tooltip-inner {- line-height: 16px;-}diff --git a/web/css/toolbar.css b/web/css/toolbar.cssindex 8ca98a11f..b892d74be 100644--- a/web/css/toolbar.css+++ b/web/css/toolbar.css@@ -103,7 +103,8 @@/* Snapshot modal */.toolbar-snapshot-modal {- right: 70px;+ top: 85px;+ right: 10px;}.toolbar-snapshot-modal .modal-body {@@ -148,7 +149,7 @@}@media (min-width: 576px) {- .toolbar-modal {+ .toolbar-modal:not(.toolbar-snapshot-modal) {top: 33px;}diff --git a/web/js/components/image-download/panel.js b/web/js/components/image-download/panel.jsindex d065647f2..e93124703 100644--- a/web/js/components/image-download/panel.js+++ b/web/js/components/image-download/panel.js@@ -1,7 +1,6 @@import React from 'react';import PropTypes from 'prop-types';import googleTagManager from 'googleTagManager';-import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';import {imageSizeValid,getDimensions,@@ -9,7 +8,7 @@ import {} from '../../modules/image-download/util';import SelectionList from '../util/selector';import ResTable from './grid';-import HoverTooltip from '../util/hover-tooltip';+import AlertUtil from '../util/alert';const MAX_DIMENSION_SIZE = 8200;const RESOLUTION_KEY = {@@ -147,27 +146,15 @@ export default class ImageResSelection extends React.Component {}}- getDatelineAlertIcon() {+ crossesDatelineAlert() {const { datelineMessage } = this.props;return datelineMessage && (- <div- className="snapshot-date-alert-icon"- >- <FontAwesomeIcon- icon="exclamation-triangle"- id="snapshot-date-warning-tooltip"- size="2x"- />- <HoverTooltip- isMobile={false}- labelText={datelineMessage}- target="snapshot-date-warning-tooltip"- delay={{ show: 0, hide: 200 }}- fade={false}- placement="left-start"- innerClassName="snapshot-date-warning-tooltip-inner"- />- </div>+ <AlertUtil+ id="snapshot-dateline-alert"+ isOpen+ title="Crosses Dateline Alert"+ message={datelineMessage}+ />);}@@ -184,35 +171,37 @@ export default class ImageResSelection extends React.Component {const layerList = getLayers();return (- <div className="wv-re-pick-wrapper wv-image">- <div- id="wv-image-download-url"- style={{ display: 'none' }}- url={debugUrl}- />- <div className="wv-image-header">- <SelectionList- id="wv-image-resolution"- optionArray={resolutions}- value={resolution}- optionName="resolution"- onChange={this.handleChange}+ <>+ {this.crossesDatelineAlert()}+ <div className="wv-re-pick-wrapper wv-image">+ <div+ id="wv-image-download-url"+ style={{ display: 'none' }}+ url={debugUrl}+ />+ <div className="wv-image-header">+ <SelectionList+ id="wv-image-resolution"+ optionArray={resolutions}+ value={resolution}+ optionName="resolution"+ onChange={this.handleChange}+ />+ {firstLabel}+ </div>+ {filetypeSelect}+ {worldfileSelect}+ <ResTable+ width={width}+ height={height}+ fileSize={((width * height * 24) / 8388608).toFixed(2)}+ maxImageSize={maxImageSize}+ validSize={imageSizeValid(height, width, MAX_DIMENSION_SIZE)}+ validLayers={layerList.length > 0}+ onClick={this.onDownload}/>- {firstLabel}</div>- {filetypeSelect}- {worldfileSelect}- <ResTable- width={width}- height={height}- fileSize={((width * height * 24) / 8388608).toFixed(2)}- maxImageSize={maxImageSize}- validSize={imageSizeValid(height, width, MAX_DIMENSION_SIZE)}- validLayers={layerList.length > 0}- onClick={this.onDownload}- />- {this.getDatelineAlertIcon()}- </div>+ </>);}}