Interactive interface for browsing global, full-resolution satellite imagery
WV-2834: Enabling Tour Stories in Embed Mode (#4650)
Ryan Weilerc84c86e7a2c4
diff --git a/web/js/containers/tour.js b/web/js/containers/tour.jsindex efb9b6db6..5a9e1c4d7 100644--- a/web/js/containers/tour.js+++ b/web/js/containers/tour.js@@ -88,11 +88,17 @@ class Tour extends React.Component {}componentDidMount() {- const { currentStory, currentStoryIndex, currentStoryId } = this.state;+ const {+ currentStory, currentStoryIndex, currentStoryId, modalStart, modalInProgress, modalComplete,+ } = this.state;// If app loads with tour link at step other than 1, restart that tour storyif (currentStory && currentStoryIndex !== -1) {this.selectTour(null, currentStory, 1, currentStoryId);}++ if (!modalStart && !modalInProgress && !modalComplete) {+ this.setState({ modalStart: true });+ }}hideTour() {@@ -132,7 +138,7 @@ class Tour extends React.Component {selectTour(e, currentStory, currentStoryIndex, currentStoryId) {const {- config, renderedPalettes, selectTour, processStepLink, isKioskModeActive,+ config, renderedPalettes, selectTour, processStepLink, isKioskModeActive, isEmbedModeActive,} = this.props;if (e) e.preventDefault();const kioskParam = this.getKioskParam(isKioskModeActive);@@ -155,7 +161,7 @@ class Tour extends React.Component {currentStoryId,1,currentStory.steps.length,- `${storyStep.stepLink}&tr=${currentStoryId}${transitionParam}${kioskParam}`,+ `${storyStep.stepLink}&tr=${currentStoryId}${transitionParam}${kioskParam}&em=${isEmbedModeActive}`,config,renderedPalettes,);@@ -237,7 +243,7 @@ class Tour extends React.Component {currentStoryId,} = this.state;const {- config, renderedPalettes, processStepLink, isKioskModeActive, activeTab, changeTab,+ config, renderedPalettes, processStepLink, isKioskModeActive, activeTab, changeTab, isEmbedModeActive,} = this.props;const kioskParam = this.getKioskParam(isKioskModeActive);@@ -254,7 +260,7 @@ class Tour extends React.Component {currentStoryId,newStep,currentStory.steps.length,- `${stepLink}&tr=${currentStoryId}${transitionParam}${kioskParam}`,+ `${stepLink}&tr=${currentStoryId}${transitionParam}${kioskParam}&em=${isEmbedModeActive}`,config,renderedPalettes,);@@ -271,7 +277,7 @@ class Tour extends React.Component {decreaseStep(e) {const {- config, renderedPalettes, processStepLink, isKioskModeActive, activeTab, changeTab,+ config, renderedPalettes, processStepLink, isKioskModeActive, activeTab, changeTab, isEmbedModeActive,} = this.props;const {currentStep, currentStory, currentStoryId,@@ -291,7 +297,7 @@ class Tour extends React.Component {currentStoryId,newStep,currentStory.steps.length,- `${stepLink}&tr=${currentStoryId}${transitionParam}${kioskParam}`,+ `${stepLink}&tr=${currentStoryId}${transitionParam}${kioskParam}&em=${isEmbedModeActive}`,config,renderedPalettes,);@@ -427,25 +433,18 @@ class Tour extends React.Component {const {map,stories,- screenHeight,- screenWidth,isActive,- endTour,resetProductPicker,} = this.props;const {currentStory,currentStep,modalInProgress,- modalComplete,modalStart,showSupportAlert,showDisabledAlert,tourEnded,} = this.state;- if (screenWidth < 740 || screenHeight < 450) {- endTour();- }if (showDisabledAlert && tourEnded) return this.renderDisableAlert();if (showSupportAlert) {@@ -454,9 +453,7 @@ class Tour extends React.Component {if (!stories && !isActive) {return null;}- if (!modalStart && !modalInProgress && !modalComplete) {- this.setState({ modalStart: true });- }+return (<ErrorBoundary><div>@@ -548,9 +545,11 @@ const mapStateToProps = (state) => {} = state;const { screenWidth, screenHeight } = screenSize;const { isKioskModeActive } = state.ui;+ const { isEmbedModeActive } = state.embed;return {config,isActive: tour.active,+ isEmbedModeActive,isKioskModeActive,map,models,diff --git a/web/js/modules/tour/util.js b/web/js/modules/tour/util.jsindex d20239ada..16f9995ce 100644--- a/web/js/modules/tour/util.js+++ b/web/js/modules/tour/util.js@@ -19,7 +19,12 @@ export function mapLocationToTourState(config,) {const isEmbedModeActive = parameters.em && parameters.em === 'true';- if (parameters.tr && !isEmbedModeActive) {+ if (parameters.tr && isEmbedModeActive) {+ stateFromLocation = update(stateFromLocation, {+ tour: { active: { $set: true } },+ embed: { isEmbedModeActive: { $set: true } },+ });+ } else if (parameters.tr) {stateFromLocation = update(stateFromLocation, {tour: { active: { $set: true } },});