Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2793 Embed Examples (#4555)

Ryan Weiler211aa5456848
diff --git a/web/js/components/timeline/mobile-date-picker.js b/web/js/components/timeline/mobile-date-picker.js
index c36b4bfd4..ca475bce2 100644
--- a/web/js/components/timeline/mobile-date-picker.js
+++ b/web/js/components/timeline/mobile-date-picker.js
@@ -68,6 +68,7 @@ const convertToLocalDateObject = (date) => {
function MobileDatePicker(props) {
const {
date,
+ isEmbedModeActive,
startDateLimit,
endDateLimit,
onDateChange,
@@ -83,7 +84,9 @@ function MobileDatePicker(props) {
}, [endDateLimit, date]);
const handleClickDateButton = () => {
- setIsOpen(true);
+ if (!isEmbedModeActive) {
+ setIsOpen(true);
+ }
};
const handleCancel = () => {
diff --git a/web/js/components/timeline/timeline-controls/animation-button.js b/web/js/components/timeline/timeline-controls/animation-button.js
index 0dd76c2a2..8676b5e1b 100644
--- a/web/js/components/timeline/timeline-controls/animation-button.js
+++ b/web/js/components/timeline/timeline-controls/animation-button.js
@@ -17,6 +17,7 @@ function AnimationButton(props) {
isMobileTablet,
isMobile,
hasSubdailyLayers,
+ isEmbedModeActive,
} = props;
const subdailyID = hasSubdailyLayers ? '-subdaily' : '';
@@ -24,10 +25,14 @@ function AnimationButton(props) {
const labelText = label || 'Set up animation';
const getButtonClassName = () => {
- if ((isMobilePhone && isPortrait) || (!isMobileTablet && screenWidth < 670 && hasSubdailyLayers) || (!isMobileTablet && screenWidth < 575 && !hasSubdailyLayers)) {
+ if (((isMobilePhone && isPortrait) || (!isMobileTablet && screenWidth < 670 && hasSubdailyLayers) || (!isMobileTablet && screenWidth < 575 && !hasSubdailyLayers)) && isEmbedModeActive) {
+ return 'phone-portrait-embed';
+ } if ((isMobilePhone && isPortrait) || (!isMobileTablet && screenWidth < 670 && hasSubdailyLayers) || (!isMobileTablet && screenWidth < 575 && !hasSubdailyLayers)) {
return `phone-portrait${subdailyID}`;
} if (isMobilePhone && isLandscape) {
return `phone-landscape${subdailyID}`;
+ } if (((isMobileTablet && isPortrait) || (!isMobilePhone && screenWidth < breakpoints.small)) && isEmbedModeActive) {
+ return `tablet-portrait${subdailyID}-embed`;
} if ((isMobileTablet && isPortrait) || (!isMobilePhone && screenWidth < breakpoints.small)) {
return `tablet-portrait${subdailyID}`;
} if (isMobileTablet && isLandscape) {
diff --git a/web/js/containers/animation-widget/animation-widget.js b/web/js/containers/animation-widget/animation-widget.js
index b2fb99934..9cc080bbc 100644
--- a/web/js/containers/animation-widget/animation-widget.js
+++ b/web/js/containers/animation-widget/animation-widget.js
@@ -109,6 +109,7 @@ function AnimationWidget (props) {
useEffect(() => {
if (isEmbedModeActive) {
setWidgetPosition({ x: 10, y: 0 });
+ toggleCollapse();
}
if (!isPlaying && autoplay && !isKioskModeActive) {
onPushPlay();
@@ -281,6 +282,7 @@ function AnimationWidget (props) {
breakpoints={breakpoints}
endDate={endDate}
hasSubdailyLayers={hasSubdailyLayers}
+ isEmbedModeActive={isEmbedModeActive}
isLandscape={isLandscape}
isMobile={isMobile}
isMobilePhone={isMobilePhone}
diff --git a/web/js/containers/animation-widget/mobile-animation-widget.js b/web/js/containers/animation-widget/mobile-animation-widget.js
index babc01c8b..337ef896d 100644
--- a/web/js/containers/animation-widget/mobile-animation-widget.js
+++ b/web/js/containers/animation-widget/mobile-animation-widget.js
@@ -14,6 +14,7 @@ function MobileAnimationWidget (props) {
breakpoints,
endDate,
hasSubdailyLayers,
+ isEmbedModeActive,
isLandscape,
isMobile,
isMobilePhone,
@@ -82,8 +83,12 @@ function MobileAnimationWidget (props) {
return (
<div className="wv-animation-widget-wrapper-mobile" id={`mobile-animation-widget-${mobileID}`}>
- <div className="mobile-animation-header">
- <span aria-label="Close" onClick={toggleCollapse} id="mobile-animation-close">
+ <div className="mobile-animation-header" style={{ justifyContent: isEmbedModeActive ? 'flex-start' : 'flex-end' }}>
+ <span
+ aria-label="Close"
+ onClick={toggleCollapse}
+ id="mobile-animation-close"
+ >
<FontAwesomeIcon icon="times" className="collapse-icon" style={collapseIconMobile} />
</span>
</div>
@@ -175,6 +180,7 @@ MobileAnimationWidget.propTypes = {
breakpoints: PropTypes.object,
endDate: PropTypes.object,
hasSubdailyLayers: PropTypes.bool,
+ isEmbedModeActive: PropTypes.bool,
isLandscape: PropTypes.bool,
isMobile: PropTypes.bool,
isMobilePhone: PropTypes.bool,
diff --git a/web/js/containers/embed.js b/web/js/containers/embed.js
index d035367ff..220a42468 100644
--- a/web/js/containers/embed.js
+++ b/web/js/containers/embed.js
@@ -9,15 +9,16 @@ import { getSelectedDate } from '../modules/date/selectors';
import HoverTooltip from '../components/util/hover-tooltip';
import history from '../main';
-function Embed (props) {
- const {
- isEmbedModeActive,
- } = props;
+function Embed ({ isEmbedModeActive, selectedDate, isMobile }) {
+ const [showClickToInteractMessage, setShowClickToInteractMessage] = useState(false);
+ const [hasClicked, setHasClicked] = useState(false);
- const [showOverlay, clickOverlay] = useState(true);
+ const handleOverlayClick = () => {
+ setShowClickToInteractMessage(false);
+ setHasClicked(true);
+ };
const newTabLink = function() {
- const { selectedDate } = props;
const queryString = history.location.search || '';
const permalink = getPermalink(queryString, selectedDate);
googleTagManager.pushEvent({
@@ -27,7 +28,6 @@ function Embed (props) {
};
const renderEmbedLinkBtn = function() {
- const { isMobile } = props;
const buttonId = 'wv-embed-link-button';
const labelText = 'Open this @NAME@ map in a new tab';
return (
@@ -49,10 +49,14 @@ function Embed (props) {
return (
isEmbedModeActive && (
- <>
- {showOverlay && (
+ <div
+ id={!hasClicked ? 'embed-mode-wrapper' : ''}
+ onMouseEnter={() => !hasClicked && setShowClickToInteractMessage(true)}
+ onMouseLeave={() => !hasClicked && setShowClickToInteractMessage(false)}
+ >
+ {showClickToInteractMessage && (
<>
- <div onClick={() => clickOverlay(false)} className="embed-overlay-bg" />
+ <div onClick={handleOverlayClick} className="embed-overlay-bg" />
<div className="embed-overlay-btn">
<FontAwesomeIcon icon="hand-pointer" size="2x" fixedWidth />
<p>Click anywhere to interact</p>
@@ -60,7 +64,7 @@ function Embed (props) {
</>
)}
{renderEmbedLinkBtn()}
- </>
+ </div>
)
);
}
diff --git a/web/js/containers/sidebar/events.js b/web/js/containers/sidebar/events.js
index 3eeb1da10..ed7141c2c 100644
--- a/web/js/containers/sidebar/events.js
+++ b/web/js/containers/sidebar/events.js
@@ -85,7 +85,7 @@ function Events(props) {
</div>
<Button
id="event-filter-button"
- className="filter-button"
+ className={isEmbedModeActive ? 'filter-button-hidden' : 'filter-button'}
aria-label="Filtered layer search"
onClick={openFilterModal}
color="primary"
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index dc94c8e1c..bfd537d72 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -928,7 +928,7 @@ class Timeline extends React.Component {
mobileBottom = 75;
if (isEmbedModeActive) {
mobileLeft = isCompareModeActive ? 90 : 10;
- mobileBottom = 60;
+ mobileBottom = 56;
}
}
@@ -973,6 +973,8 @@ class Timeline extends React.Component {
hasSubdailyLayers,
isCompareModeActive,
isDataDownload,
+ isEmbedModeActive,
+ isKioskModeActive,
isMobile,
isMobilePhone,
isMobileTablet,
@@ -983,7 +985,6 @@ class Timeline extends React.Component {
selectedDate,
timelineEndDateLimit,
timelineStartDateLimit,
- isKioskModeActive,
} = this.props;
return (
@@ -995,6 +996,7 @@ class Timeline extends React.Component {
onDateChange={this.onDateChange}
hasSubdailyLayers={hasSubdailyLayers}
isMobile={isMobile}
+ isEmbedModeActive={isEmbedModeActive}
/>
<MobileComparisonToggle />
<div
@@ -1018,6 +1020,7 @@ class Timeline extends React.Component {
clickAnimationButton={this.clickAnimationButton}
hasSubdailyLayers={hasSubdailyLayers}
isKioskModeActive={isKioskModeActive}
+ isEmbedModeActive={isEmbedModeActive}
disabled={animationDisabled}
label={
isCompareModeActive
diff --git a/web/scss/features/anim-widget.scss b/web/scss/features/anim-widget.scss
index 6de9e0bb4..3df6db256 100644
--- a/web/scss/features/anim-widget.scss
+++ b/web/scss/features/anim-widget.scss
@@ -530,6 +530,7 @@ a .wv-animation-widget-icon {
display: flex;
justify-content: center;
align-items: center;
+ margin-left: 40px;
& .mobile-date-picker-select-btn-text {
display: flex;
diff --git a/web/scss/features/embed.scss b/web/scss/features/embed.scss
index 7e38b674b..6d0b39a1a 100644
--- a/web/scss/features/embed.scss
+++ b/web/scss/features/embed.scss
@@ -1,3 +1,10 @@
+#embed-mode-wrapper {
+ position: fixed;
+ inset: 0;
+ z-index: 9999;
+ pointer-events: all;
+}
+
.embed-overlay-bg {
position: absolute;
top: 0;
@@ -80,6 +87,7 @@
#wv-sidebar {
transform: scale(0.75);
+ transform-origin: left center;
#download-sidebar-tab {
display: none;
@@ -154,7 +162,7 @@
.comparison-mobile-select-toggle {
transform-origin: bottom left;
transform: scale(0.75);
- bottom: 50px;
+ bottom: 56px;
}
.ab-swipe-dragger {
diff --git a/web/scss/features/event-filter.scss b/web/scss/features/event-filter.scss
index b84af0790..71abff306 100644
--- a/web/scss/features/event-filter.scss
+++ b/web/scss/features/event-filter.scss
@@ -37,6 +37,10 @@
display: inline-block;
vertical-align: top;
}
+
+ .filter-button-hidden {
+ display: none !important;
+ }
}
.event-filter-modal {
diff --git a/web/scss/features/timeline.scss b/web/scss/features/timeline.scss
index b7a099245..569a23d58 100644
--- a/web/scss/features/timeline.scss
+++ b/web/scss/features/timeline.scss
@@ -909,6 +909,12 @@ button:focus {
bottom: 75px;
}
+.animate-button-phone-portrait-embed {
+ left: 100px;
+ bottom: 52px;
+ transform: scale(.75);
+}
+
.animate-button-phone-portrait-subdaily {
left: 140px;
bottom: 75px;
@@ -929,6 +935,18 @@ button:focus {
bottom: 20px;
}
+.animate-button-tablet-portrait-embed {
+ left: 235px;
+ bottom: 15px;
+ transform: scale(.75);
+}
+
+.animate-button-tablet-portrait-subdaily-embed {
+ left: 315px;
+ bottom: 15px;
+ transform: scale(.75);
+}
+
.animate-button-tablet-portrait-subdaily {
left: 420px;
bottom: 20px;