Prevent tour from displaying twice (#10594)

* Prevent tour from displaying twice

* Removed forced and prevent overlay click
This commit is contained in:
Keith Holliday 2018-08-16 16:53:37 -05:00 committed by GitHub
parent 8b0101c74c
commit 5ae89761b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,9 @@
import times from 'lodash/times';
import Intro from 'intro.js/';
import introjs from 'intro.js';
import * as Analytics from 'client/libs/analytics';
let showingTour = false;
export default {
data () {
return {
@ -13,6 +15,8 @@ export default {
},
watch: {
$route () {
if (showingTour) return;
showingTour = true;
this.routeChange();
},
},
@ -168,13 +172,15 @@ export default {
});
// @TODO: Do we always need to initialize here?
let intro = Intro.introJs();
const intro = introjs();
intro.setOptions({
exitOnOverlayClick: false,
steps: opts.steps,
doneLabel: this.$t('letsgo'),
});
intro.start();
intro.oncomplete(() => {
showingTour = false;
this.markTourComplete(chapter);
});
},
@ -187,19 +193,6 @@ export default {
return;
}
// if (true) { // -2 indicates complete
// if (chapter === 'intro') {
// // Manually show bunny scroll reward
// // let rewardData = {
// // reward: [Shared.content.quests.dustbunnies],
// // rewardKey: ['inventory_quest_scroll_dustbunnies'],
// // rewardText: Shared.content.quests.dustbunnies.text(),
// // message: this.$t('checkinEarned'),
// // nextRewardAt: 1,
// // };
// // @TODO: Notification.showLoginIncentive(this.user, rewardData, Social.loadWidgets);
// }
// Mark tour complete
ups[`flags.tour.${chapter}`] = -2; // @TODO: Move magic numbers to enum
@ -211,7 +204,6 @@ export default {
eventValue: lastKnownStep,
complete: true,
});
// }
this.$store.dispatch('user:set', ups);
},