Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add sandbox allow modal, no alerts, style height tweaks

Ed Plato664a451fafd7
diff --git a/doc/embed.md b/doc/embed.md
index e86095198..1e1285ba4 100644
--- a/doc/embed.md
+++ b/doc/embed.md
@@ -8,4 +8,4 @@ See [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe](https://d
```<iframe src="https://worldview.earthdata.nasa.gov/?em=true" role="application" sandbox="allow-scripts allow-same-origin allow-forms allow-popups" width="100%" height="100%" allow="fullscreen; autoplay;" loading="lazy"></iframe>```
-**Note:** Certain application features and button/tab interactions are not available in embed mode. We recommend to limit the number of layers you share - hidden layers will be filtered out and are not included. A helpful tip is to provide detailed captions to assist the user in better understanding the science concepts that you are presenting.
+**Note:** Certain application features and button/tab interactions are not available in embed mode. We recommend to limit the number of layers you share - hidden layers will be filtered out and are not toggleable by the end user. A helpful tip is to provide detailed captions to assist the user in better understanding the science concepts that you are sharing.
diff --git a/web/css/embed.css b/web/css/embed.css
index 18fbc625d..45c800dae 100644
--- a/web/css/embed.css
+++ b/web/css/embed.css
@@ -46,17 +46,16 @@
}
#productsHolder {
width: 125px !important;
- height: 80vh;
}
#layers-scroll-container {
min-height: 50px;
}
.event-container {
- min-height: 25vh;
+ min-height: 175px;
}
.layer-group-case .layer-group-header {
margin-top: 0;
- &.layer-group-title {
+ & .layer-group-title {
font-size: 12px;
}
}
diff --git a/web/js/containers/alerts.js b/web/js/containers/alerts.js
index d13b0d5cd..ce35c3373 100644
--- a/web/js/containers/alerts.js
+++ b/web/js/containers/alerts.js
@@ -64,6 +64,7 @@ class DismissableAlerts extends React.Component {
dismissVectorAlert,
isCompareActive,
isDistractionFreeModeActive,
+ isEmbedModeActive,
isEventsActive,
isSmall,
isVectorAlertPresent,
@@ -76,8 +77,11 @@ class DismissableAlerts extends React.Component {
distractionFreeModeInitLoad,
} = this.state;
const { eventModalProps, compareModalProps, vectorModalProps } = MODAL_PROPERTIES;
- if (distractionFreeModeInitLoad) return null;
- if (isSmall || !HAS_LOCAL_STORAGE) return null;
+ const hasFailCondition = isSmall
+ || !HAS_LOCAL_STORAGE
+ || isEmbedModeActive
+ || distractionFreeModeInitLoad;
+ if (hasFailCondition) return null;
return isDistractionFreeModeActive
? !hasDismissedDistractionFree && (
@@ -130,7 +134,7 @@ const mapDispatchToProps = (dispatch) => ({
});
const mapStateToProps = (state) => {
const {
- browser, events, sidebar, compare, alerts, ui,
+ browser, embed, events, sidebar, compare, alerts, ui,
} = state;
const { isVectorAlertActive } = alerts;
const activeLayers = getActiveLayers(state);
@@ -138,6 +142,7 @@ const mapStateToProps = (state) => {
return {
isCompareActive: compare.active,
isDistractionFreeModeActive: ui.isDistractionFreeModeActive,
+ isEmbedModeActive: embed.isEmbedModeActive,
isEventsActive: !!(events.selected.id && sidebar.activeTab === 'events'),
isSmall: browser.lessThan.small,
isVectorAlertPresent: hasVectorLayers(activeLayers) && isVectorAlertActive,
@@ -152,6 +157,7 @@ DismissableAlerts.propTypes = {
dismissVectorAlert: PropTypes.func,
isCompareActive: PropTypes.bool,
isDistractionFreeModeActive: PropTypes.bool,
+ isEmbedModeActive: PropTypes.bool,
isEventsActive: PropTypes.bool,
isSmall: PropTypes.bool,
isVectorAlertPresent: PropTypes.bool,
diff --git a/web/js/containers/sidebar/events.js b/web/js/containers/sidebar/events.js
index 11a7f6822..d2a505aed 100644
--- a/web/js/containers/sidebar/events.js
+++ b/web/js/containers/sidebar/events.js
@@ -46,7 +46,7 @@ function Events(props) {
const toggle = () => setDropdownOpen((prevState) => !prevState);
const dropdownHeight = 34;
- const scrollbarMaxHeight = isEmbedModeActive ? '55vh' : `${height - dropdownHeight}px`;
+ const scrollbarMaxHeight = isEmbedModeActive ? '50vh' : `${height - dropdownHeight}px`;
let showInactiveEventAlert = selected.id && !selected.date;
const errorOrLoadingText = isLoading
diff --git a/web/js/containers/sidebar/sidebar.js b/web/js/containers/sidebar/sidebar.js
index 4df298c2b..d5093bc71 100644
--- a/web/js/containers/sidebar/sidebar.js
+++ b/web/js/containers/sidebar/sidebar.js
@@ -263,6 +263,11 @@ class Sidebar extends React.Component {
const { naturalEvents } = config.features;
const { smartHandoffs } = config.features;
+ const maxHeight = isCollapsed
+ ? '0'
+ : isEmbedModeActive
+ ? '70vh'
+ : `${screenHeight}px`;
return (
<ErrorBoundary>
<section id="wv-sidebar">
@@ -282,7 +287,7 @@ class Sidebar extends React.Component {
this.sideBarCase = el;
}}
style={{
- maxHeight: isCollapsed ? '0' : `${screenHeight}px`,
+ maxHeight,
display: isDistractionFreeModeActive ? 'none' : 'block',
}}
onWheel={wheelCallBack}
diff --git a/web/js/modules/link/util.js b/web/js/modules/link/util.js
index bf2c47bd1..c3a1c1aa9 100644
--- a/web/js/modules/link/util.js
+++ b/web/js/modules/link/util.js
@@ -108,4 +108,4 @@ export function getPermalink(queryString, selectedDate, isEmbed) {
return permalink;
}
-export function wrapWithIframe(value) { return `<iframe src="${value}" role="application" sandbox="allow-scripts allow-same-origin allow-forms allow-popups" width="100%" height="100%" allow="fullscreen; autoplay;" loading="lazy"></iframe>`; }
+export function wrapWithIframe(value) { return `<iframe src="${value}" role="application" sandbox="allow-modals allow-scripts allow-same-origin allow-forms allow-popups" width="100%" height="100%" allow="fullscreen; autoplay;" loading="lazy"></iframe>`; }