Interactive interface for browsing global, full-resolution satellite imagery
basic joyride integration
Jason Kentc587a64d5416
diff --git a/package-lock.json b/package-lock.jsonindex ea936cb87..e71fadd0f 100644--- a/package-lock.json+++ b/package-lock.json@@ -7934,8 +7934,7 @@"deepmerge": {"version": "4.2.2","resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",- "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==",- "dev": true+ "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg=="},"default-gateway": {"version": "4.2.0",@@ -9433,6 +9432,11 @@"clone-regexp": "^2.1.0"}},+ "exenv": {+ "version": "1.2.2",+ "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz",+ "integrity": "sha1-KueOhdmJQVhnCwPUe+wfA72Ru50="+ },"exit": {"version": "0.1.2","resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",@@ -12637,6 +12641,11 @@"integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==","dev": true},+ "is-lite": {+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/is-lite/-/is-lite-0.6.0.tgz",+ "integrity": "sha512-kJ16DuwOhtZg7RimZOf+zK86XOlPeNGGy20MhAfjN/zozuetECxOEtUDUAtzC5n21Yd2lVx6LqZvO1Zvd5DYhw=="+ },"is-negative-zero": {"version": "2.0.0","resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz",@@ -16198,6 +16207,11 @@"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==","dev": true},+ "nested-property": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/nested-property/-/nested-property-1.0.4.tgz",+ "integrity": "sha512-6fNIumJJUyP3rkB4FyVYCYpdW+PKUCaxRWRGLLf0kv/RKoG4mbTvInedA9x3zOyuOmOkGudKuAtPSI+dnhwj2g=="+ },"netmask": {"version": "1.0.6","resolved": "https://registry.npmjs.org/netmask/-/netmask-1.0.6.tgz",@@ -20055,6 +20069,19 @@"prop-types": "^15.6.0"}},+ "react-floater": {+ "version": "0.7.2",+ "resolved": "https://registry.npmjs.org/react-floater/-/react-floater-0.7.2.tgz",+ "integrity": "sha512-YKixUNXdySMqo4gh6ZGVLI/h7cI59MFQKOG38jAdBJl7XVC///w+sa7dmz+o2xWe4oUSey3z2vmg+AtX7A7Kug==",+ "requires": {+ "deepmerge": "^4.2.2",+ "exenv": "^1.2.2",+ "is-lite": "^0.6.0",+ "popper.js": "^1.16.0",+ "react-proptype-conditional-require": "^1.0.4",+ "tree-changes": "^0.5.1"+ }+ },"react-image-crop": {"version": "8.5.0","resolved": "https://registry.npmjs.org/react-image-crop/-/react-image-crop-8.5.0.tgz",@@ -20086,6 +20113,35 @@"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.11.0.tgz","integrity": "sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw=="},+ "react-joyride": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/react-joyride/-/react-joyride-2.2.1.tgz",+ "integrity": "sha512-2dcfuOPW1viQ7TxUxLajNJJiW+I4dh3dPaySuvc1uiWK1qC8uaxjhGwWSIdQitVw0j1/4NU7P2dPuB9d5umtlw==",+ "requires": {+ "deep-diff": "^1.0.2",+ "deepmerge": "^4.2.2",+ "exenv": "^1.2.2",+ "is-lite": "^0.6.0",+ "nested-property": "^1.0.2",+ "react-floater": "^0.7.2",+ "react-is": "^16.12.0",+ "scroll": "^3.0.1",+ "scrollparent": "^2.0.1",+ "tree-changes": "^0.5.1"+ },+ "dependencies": {+ "deep-diff": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-1.0.2.tgz",+ "integrity": "sha512-aWS3UIVH+NPGCD1kki+DCU9Dua032iSsO43LqQpcs4R3+dVv7tX0qBGjiVHJHjplsoUM2XRO/KB92glqc68awg=="+ },+ "react-is": {+ "version": "16.13.1",+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="+ }+ }+ },"react-lifecycles-compat": {"version": "3.0.4","resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",@@ -20140,6 +20196,11 @@"prop-types": "^15.5.8"}},+ "react-proptype-conditional-require": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/react-proptype-conditional-require/-/react-proptype-conditional-require-1.0.4.tgz",+ "integrity": "sha1-acLVdB5t9eCPIw82u8KUTuEiJVU="+ },"react-redux": {"version": "7.1.3","resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.1.3.tgz",@@ -21252,6 +21313,16 @@}}},+ "scroll": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/scroll/-/scroll-3.0.1.tgz",+ "integrity": "sha512-pz7y517OVls1maEzlirKO5nPYle9AXsFzTMNJrRGmT951mzpIBy7sNHOg5o/0MQd/NqliCiWnAi0kZneMPFLcg=="+ },+ "scrollparent": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/scrollparent/-/scrollparent-2.0.1.tgz",+ "integrity": "sha1-cV1bnMV3YPsivczDvvtb/gaxoxc="+ },"scss-tokenizer": {"version": "0.2.3","resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz",@@ -23934,6 +24005,27 @@"punycode": "^2.1.0"}},+ "tree-changes": {+ "version": "0.5.1",+ "resolved": "https://registry.npmjs.org/tree-changes/-/tree-changes-0.5.1.tgz",+ "integrity": "sha512-O873xzV2xRZ6N059Mn06QzmGKEE21LlvIPbsk2G+GS9ZX5OCur6PIwuuh0rWpAPvLWQZPj0XObyG27zZyLHUzw==",+ "requires": {+ "deep-diff": "^1.0.2",+ "nested-property": "1.0.1"+ },+ "dependencies": {+ "deep-diff": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-1.0.2.tgz",+ "integrity": "sha512-aWS3UIVH+NPGCD1kki+DCU9Dua032iSsO43LqQpcs4R3+dVv7tX0qBGjiVHJHjplsoUM2XRO/KB92glqc68awg=="+ },+ "nested-property": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/nested-property/-/nested-property-1.0.1.tgz",+ "integrity": "sha512-BnBBoo/8bBNRdAnJc7+m79oWk7dXwW1+vCesaEQhfDGVwXGLMvmI4NwYgLTW94R/x+R2s/yr2g/hB/4w/YSAvA=="+ }+ }+ },"trim": {"version": "0.0.1","resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz",diff --git a/package.json b/package.jsonindex 2abc78416..947aea6e5 100644--- a/package.json+++ b/package.json@@ -203,6 +203,7 @@"react-draggable": "^4.1.0","react-image-crop": "^8.5.0","react-infinite-scroller": "^1.2.4",+ "react-joyride": "^2.2.1","react-loader": "^2.4.7","react-masonry-component": "^6.2.1","react-mobile-datepicker": "^4.0.1",diff --git a/web/js/app.js b/web/js/app.jsindex c36181c71..073c8455f 100644--- a/web/js/app.js+++ b/web/js/app.js@@ -191,7 +191,7 @@ class App extends React.Component {<div id="layer-settings-modal" /><div id="eventsHolder" /><div id="imagedownload" />- <Timeline key={locationKey || '1'} />+ <Timeline /><div id="wv-animation-widet-case">{isAnimationWidgetActive ? <AnimationWidget key={locationKey || '2'} /> : null}</div>diff --git a/web/js/containers/tour.js b/web/js/containers/tour.jsindex d64888018..344c10a40 100644--- a/web/js/containers/tour.js+++ b/web/js/containers/tour.js@@ -5,6 +5,8 @@ import { connect } from 'react-redux';import googleTagManager from 'googleTagManager';import { findIndex as lodashFindIndex, get as lodashGet, uniqBy } from 'lodash';import update from 'immutability-helper';+import Joyride from 'react-joyride';+import TourStart from '../components/tour/modal-tour-start';import TourInProgress from '../components/tour/modal-tour-in-progress';import TourComplete from '../components/tour/modal-tour-complete';@@ -34,14 +36,13 @@ const { HIDE_TOUR } = safeLocalStorage.keys;class Tour extends React.Component {constructor(props) {super(props);- const { storyOrder } = props;- const { stories } = props;- const currentStoryIndex = lodashFindIndex(storyOrder, (id) => id === props.currentStoryId) || null;- const currentStory = currentStoryIndex >= 0 ? stories[props.currentStoryId] : {};+ const { storyOrder, stories, currentStoryId } = props;+ const currentStoryIndex = lodashFindIndex(storyOrder, (id) => id === currentStoryId) || null;+ const currentStory = currentStoryIndex >= 0 ? stories[currentStoryId] : {};const steps = lodashGet(currentStory, 'steps') || [];this.state = {- modalStart: !props.currentStoryId,- showSupportAlert: props.currentStoryId && currentStoryIndex === -1,+ modalStart: !currentStoryId,+ showSupportAlert: currentStoryId && currentStoryIndex === -1,showDisabledAlert: false,modalInProgress: currentStoryIndex !== -1,modalComplete: false,@@ -50,7 +51,7 @@ class Tour extends React.Component {metaLoaded: false,isLoadingMeta: false,currentStory,- currentStoryId: props.currentStoryId,+ currentStoryId,currentStoryIndex,tourEnded: false,};@@ -107,15 +108,12 @@ class Tour extends React.Component {selectTour(currentStoryId);this.fetchMetadata(currentStory, 0);const storyStep = currentStory.steps[0];- const transition = getTransitionAttr(- storyStep.transition.element,- storyStep.transition.action,- );+ const transitionParam = getTransitionAttr(storyStep.transition);processStepLink(currentStoryId,1,currentStory.steps.length,- `${storyStep.stepLink}&tr=${currentStoryId}${transition}`,+ `${storyStep.stepLink}&tr=${currentStoryId}${transitionParam}`,config,renderedPalettes,);@@ -124,9 +122,7 @@ class Tour extends React.Component {fetchMetadata(currentStory, stepIndex) {const { description } = currentStory.steps[stepIndex];const errorMessage = '<p>There was an error loading this description.</p>';- const uri = `config/metadata/stories/${- currentStory.id- }/${description}`;+ const uri = `config/metadata/stories/${currentStory.id}/${description}`;this.setState({isLoadingMeta: true,metaLoaded: false,@@ -205,18 +201,13 @@ class Tour extends React.Component {this.fetchMetadata(currentStory, currentStep);this.setState({ currentStep: newStep });const storyStep = currentStory.steps[newStep - 1];- const transition = getTransitionAttr(- storyStep.transition.element,- storyStep.transition.action,- );+ const { stepLink } = storyStep;+ const transitionParam = getTransitionAttr(storyStep.transition);processStepLink(currentStoryId,newStep,currentStory.steps.length,- `${currentStory.steps[newStep - 1].stepLink- }&tr=${- currentStoryId- }${transition}`,+ `${stepLink}&tr=${currentStoryId}${transitionParam}`,config,renderedPalettes,);@@ -239,18 +230,13 @@ class Tour extends React.Component {this.fetchMetadata(currentStory, newStep - 1);this.setState({ currentStep: newStep });const storyStep = currentStory.steps[newStep - 1];- const transition = getTransitionAttr(- storyStep.transition.element,- storyStep.transition.action,- );+ const { stepLink } = storyStep;+ const transitionParam = getTransitionAttr(storyStep.transition);processStepLink(currentStoryId,newStep,currentStory.steps.length,- `${currentStory.steps[newStep - 1].stepLink- }&tr=${- currentStoryId- }${transition}`,+ `${stepLink}&tr=${currentStoryId}${transitionParam}`,config,renderedPalettes,);@@ -300,18 +286,47 @@ class Tour extends React.Component {);}- render() {+ renderTourStart() {const {stories,storyOrder,showTourAlert,hideTour,showTour,- config,screenHeight,- screenWidth,- isActive,- endTour,+ } = this.props;+ const { modalStart } = this.state;+ const checked = !!safeLocalStorage.getItem(HIDE_TOUR);+ return (+ <TourStart+ stories={stories}+ storyOrder={storyOrder}+ modalStart={modalStart}+ height={screenHeight}+ checked={checked}+ toggleModalStart={this.toggleModalStart}+ toggleModalInProgress={this.toggleModalInProgress}+ toggleModalComplete={this.toggleModalComplete}+ selectTour={this.selectTour}+ showTourAlert={showTourAlert}+ hideTour={() => {+ hideTour();+ this.setState({ showDisabledAlert: true });+ }}+ showTour={() => {+ showTour();+ this.setState({ showDisabledAlert: false });+ }}+ endTour={this.endTour}+ />+ );+ }++ renderTourInProgress() {+ const {+ stories,+ showTourAlert,+ config,} = this.props;const {modalInProgress,@@ -320,12 +335,65 @@ class Tour extends React.Component {currentStoryId,currentStep,totalSteps,- modalComplete,models,- modalStart,currentStoryIndex,description,isLoadingMeta,+ } = this.state;+ return (+ <TourInProgress+ config={config}+ models={models}+ endTour={this.endTour}+ modalInProgress={modalInProgress}+ toggleModalStart={this.toggleModalStart}+ toggleModalInProgress={this.toggleModalInProgress}+ toggleModalComplete={this.toggleModalComplete}+ currentStep={currentStep}+ totalSteps={totalSteps}+ currentStoryIndex={currentStoryIndex}+ incrementStep={this.incrementStep}+ decreaseStep={this.decreaseStep}+ stories={stories}+ currentStoryId={currentStoryId}+ currentStory={currentStory}+ showTourAlert={showTourAlert}+ metaLoaded={metaLoaded}+ isLoadingMeta={isLoadingMeta}+ description={description}+ />+ );+ }++ renderTourComplete() {+ const { currentStory, modalComplete } = this.state;+ return (+ <TourComplete+ currentStory={currentStory}+ modalComplete={modalComplete}+ toggleModalStart={this.toggleModalStart}+ toggleModalInProgress={this.toggleModalInProgress}+ toggleModalComplete={this.toggleModalComplete}+ resetTour={this.resetTour}+ endTour={this.endTour}+ />+ );+ }++ render() {+ const {+ stories,+ screenHeight,+ screenWidth,+ isActive,+ endTour,+ } = this.props;+ const {+ currentStory,+ currentStep,+ modalInProgress,+ modalComplete,+ modalStart,showSupportAlert,showDisabledAlert,tourEnded,@@ -338,74 +406,50 @@ class Tour extends React.Component {if (showSupportAlert) {return this.renderSupportAlert();}- if (stories && isActive) {- if (!modalStart && !modalInProgress && !modalComplete) {- this.setState({ modalStart: true });- }- const checked = !!safeLocalStorage.getItem(HIDE_TOUR);- return (- <ErrorBoundary>- <div>- {modalStart ? (- <TourStart- stories={stories}- storyOrder={storyOrder}- modalStart={modalStart}- height={screenHeight}- checked={checked}- toggleModalStart={this.toggleModalStart}- toggleModalInProgress={this.toggleModalInProgress}- toggleModalComplete={this.toggleModalComplete}- selectTour={this.selectTour}- showTourAlert={showTourAlert}- hideTour={() => {- hideTour();- this.setState({ showDisabledAlert: true });- }}- showTour={() => {- showTour();- this.setState({ showDisabledAlert: false });- }}- endTour={this.endTour}- />- ) : modalInProgress ? (- <TourInProgress- config={config}- models={models}- endTour={this.endTour}- modalInProgress={modalInProgress}- toggleModalStart={this.toggleModalStart}- toggleModalInProgress={this.toggleModalInProgress}- toggleModalComplete={this.toggleModalComplete}- currentStep={currentStep}- totalSteps={totalSteps}- currentStoryIndex={currentStoryIndex}- incrementStep={this.incrementStep}- decreaseStep={this.decreaseStep}- stories={stories}- currentStoryId={currentStoryId}- currentStory={currentStory}- showTourAlert={showTourAlert}- metaLoaded={metaLoaded}- isLoadingMeta={isLoadingMeta}- description={description}- />- ) : (- <TourComplete- currentStory={currentStory}- modalComplete={modalComplete}- toggleModalStart={this.toggleModalStart}- toggleModalInProgress={this.toggleModalInProgress}- toggleModalComplete={this.toggleModalComplete}- resetTour={this.resetTour}- endTour={this.endTour}- />- )}- </div>- </ErrorBoundary>- );+ if (!stories && !isActive) {+ return null;+ }+ if (!modalStart && !modalInProgress && !modalComplete) {+ this.setState({ modalStart: true });}- return null;+++ const joyride = (currentStep && currentStory.steps[currentStep - 1].joyride) || {};+ const {+ continuous, spotlightClicks, steps, disableOverlayClose,+ } = joyride;+ const styleOptions = {+ arrowColor: '#ccc',+ backgroundColor: '#ccc',+ beaconSize: 44,+ overlayColor: 'rgba(0, 0, 0, 0.5)',+ primaryColor: '#d54e21',+ spotlightShadow: '0 0 25px rgba(0, 0, 0, 0.75)',+ textColor: '#333',+ width: undefined,+ zIndex: 1050,+ };++ return (+ <ErrorBoundary>+ <div>+ {joyride && (+ <Joyride+ steps={steps}+ continuous={continuous}+ spotlightClicks={spotlightClicks}+ disableOverlayClose={disableOverlayClose || false}+ styles={{ options: styleOptions }}+ />+ )}+ {modalStart+ ? this.renderTourStart()+ : modalInProgress+ ? this.renderTourInProgress()+ : this.renderTourComplete()}+ </div>+ </ErrorBoundary>+ );}}@@ -485,8 +529,10 @@ function mapStateToProps(state) {};}-const getTransitionAttr = function(el, action) {- if (el === 'animation' && action === 'play') {+const getTransitionAttr = function(transition) {+ if (!transition) return '';+ const { element, action } = transition;+ if (element === 'animation' && action === 'play') {return '&playanim=true';}return '';