Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix tour checkout

Benjamin King12416b3ad221
diff --git a/web/js/components/tour/modal-tour-start.js b/web/js/components/tour/modal-tour-start.js
index 77047fbba..3a1abe346 100644
--- a/web/js/components/tour/modal-tour-start.js
+++ b/web/js/components/tour/modal-tour-start.js
@@ -17,7 +17,7 @@ class ModalStart extends React.Component {
constructor(props) {
super(props);
this.state = {
- checked: this.props.storageCheck
+ checked: this.props.checked
};
this.setWrapperRef = this.setWrapperRef.bind(this);
@@ -92,25 +92,25 @@ class ModalStart extends React.Component {
selectTour={this.props.selectTour}
/>
</ModalBody>
- {util.browser.localStorage &&
- <ModalFooter>
- <InputGroup>
- <InputGroupText className="w-100">
- <Input
- addon
- type="checkbox"
- className="float-right m-0"
- defaultChecked={this.state.checked}
- onChange={this.handleCheck}
- aria-label="Hide this box until a new story has been added."
- />
- <span className="ml-2">
- Do not show until a new story has been added.
- </span>
- </InputGroupText>
- </InputGroup>
- </ModalFooter>
- }
+ {util.browser.localStorage && (
+ <ModalFooter>
+ <InputGroup>
+ <InputGroupText className="w-100">
+ <Input
+ addon
+ type="checkbox"
+ className="float-right m-0"
+ defaultChecked={this.state.checked}
+ onChange={this.handleCheck}
+ aria-label="Hide this box until a new story has been added."
+ />
+ <span className="ml-2">
+ Do not show until a new story has been added.
+ </span>
+ </InputGroupText>
+ </InputGroup>
+ </ModalFooter>
+ )}
</Modal>
);
}
@@ -125,7 +125,7 @@ ModalStart.propTypes = {
showTourAlert: PropTypes.func.isRequired,
hideTour: PropTypes.func.isRequired,
showTour: PropTypes.func.isRequired,
- storageCheck: PropTypes.bool.isRequired,
+ checked: PropTypes.bool.isRequired,
className: PropTypes.string
};
diff --git a/web/js/containers/tour.js b/web/js/containers/tour.js
index 84d3524e6..44c1d78a3 100644
--- a/web/js/containers/tour.js
+++ b/web/js/containers/tour.js
@@ -6,6 +6,7 @@ import TourComplete from '../components/tour/modal-tour-complete';
import { connect } from 'react-redux';
import googleTagManager from 'googleTagManager';
import { endTour, selectStory, startTour } from '../modules/tour/actions';
+import { checkTourBuildTimestamp } from '../modules/tour/util';
import { findIndex as lodashFindIndex, get as lodashGet } from 'lodash';
import ErrorBoundary from './error-boundary';
import update from 'immutability-helper';
@@ -251,6 +252,11 @@ class Tour extends React.Component {
stories={stories}
storyOrder={storyOrder}
modalStart={modalStart}
+ checked={
+ util.browser.localStorage
+ ? !!localStorage.getItem('hideTour')
+ : false
+ }
toggleModalStart={this.toggleModalStart}
toggleModalInProgress={this.toggleModalInProgress}
toggleModalComplete={this.toggleModalComplete}
diff --git a/web/js/modules/tour/util.js b/web/js/modules/tour/util.js
index de2525ed3..12d286592 100644
--- a/web/js/modules/tour/util.js
+++ b/web/js/modules/tour/util.js
@@ -1,34 +1,6 @@
-import { cloneDeep as lodashCloneDeep, get } from 'lodash';
import googleTagManager from 'googleTagManager';
import util from '../../util/util';
-export function getTourParameterSetup(
- parameters,
- config,
- models,
- legacyState,
- errors
-) {
- const loadedModel = lodashCloneDeep(models.tour.load(legacyState, errors)); // use legacy parser
-
- return {
- tr: {
- stateKey: 'legacy.tour.selected.id',
- initialState: '',
- options: {
- setAsEmptyItem: true,
- parse: () => {
- return get(loadedModel, 'selected.id') || false;
- },
- serialize: () => {
- const tourActive = get(models, 'tour.active');
- const tourId = get(models, 'tour.selected.id');
- return tourActive && tourId ? tourId : undefined;
- }
- }
- }
- };
-}
export function checkTourBuildTimestamp(config) {
if (!util.browser.localStorage) return;
var hideTour = localStorage.getItem('hideTour');