mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
New client tour (#8921)
* Linted tour. Added intro tour * Added initial tours * Fixed page number for intro * Lint fix * Updated shrinkwrap * Removed bootstrap tour * Lint fix
This commit is contained in:
5
npm-shrinkwrap.json
generated
5
npm-shrinkwrap.json
generated
@@ -5189,6 +5189,11 @@
|
|||||||
"from": "intersect@>=0.0.3 <0.1.0",
|
"from": "intersect@>=0.0.3 <0.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/intersect/-/intersect-0.0.3.tgz"
|
"resolved": "https://registry.npmjs.org/intersect/-/intersect-0.0.3.tgz"
|
||||||
},
|
},
|
||||||
|
"intro.js": {
|
||||||
|
"version": "2.6.0",
|
||||||
|
"from": "intro.js@latest",
|
||||||
|
"resolved": "http://registry.npmjs.org/intro.js/-/intro.js-2.6.0.tgz"
|
||||||
|
},
|
||||||
"invariant": {
|
"invariant": {
|
||||||
"version": "2.2.2",
|
"version": "2.2.2",
|
||||||
"from": "invariant@>=2.2.0 <3.0.0",
|
"from": "invariant@>=2.2.0 <3.0.0",
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
"html-webpack-plugin": "^2.8.1",
|
"html-webpack-plugin": "^2.8.1",
|
||||||
"image-size": "~0.3.2",
|
"image-size": "~0.3.2",
|
||||||
"in-app-purchase": "^1.1.6",
|
"in-app-purchase": "^1.1.6",
|
||||||
|
"intro.js": "^2.6.0",
|
||||||
"jade": "~1.11.0",
|
"jade": "~1.11.0",
|
||||||
"jquery": "^3.1.1",
|
"jquery": "^3.1.1",
|
||||||
"js2xmlparser": "~1.0.0",
|
"js2xmlparser": "~1.0.0",
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style src="intro.js/minified/introjs.min.css"></style>
|
||||||
<style src="bootstrap/scss/bootstrap.scss" lang="scss"></style>
|
<style src="bootstrap/scss/bootstrap.scss" lang="scss"></style>
|
||||||
<style src="assets/scss/index.scss" lang="scss"></style>
|
<style src="assets/scss/index.scss" lang="scss"></style>
|
||||||
<style src="assets/css/index.css"></style>
|
<style src="assets/css/index.css"></style>
|
||||||
|
|||||||
@@ -84,10 +84,10 @@
|
|||||||
v-for="group in itemsGroups",
|
v-for="group in itemsGroups",
|
||||||
v-if="viewOptions[group.key].selected",
|
v-if="viewOptions[group.key].selected",
|
||||||
:key="group.key",
|
:key="group.key",
|
||||||
|
:class='group.key',
|
||||||
)
|
)
|
||||||
h2
|
h2
|
||||||
| {{ group.label }}
|
| {{ group.label }}
|
||||||
|
|
|
||||||
span.badge.badge-pill.badge-default {{items[group.key].length}}
|
span.badge.badge-pill.badge-default {{items[group.key].length}}
|
||||||
|
|
||||||
.items
|
.items
|
||||||
|
|||||||
@@ -105,11 +105,9 @@
|
|||||||
div.potion-icon(:class="'Pet_HatchingPotion_'+currentDraggingPotion.key")
|
div.potion-icon(:class="'Pet_HatchingPotion_'+currentDraggingPotion.key")
|
||||||
div.popover
|
div.popover
|
||||||
div.popover-content {{ $t('clickOnEggToHatch', {potionName: currentDraggingPotion.text() }) }}
|
div.popover-content {{ $t('clickOnEggToHatch', {potionName: currentDraggingPotion.text() }) }}
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.hatchingPotionInfo {
|
.hatchingPotionInfo {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -500px;
|
left: -500px;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ div
|
|||||||
|
|
||||||
import { mapState } from 'client/libs/store';
|
import { mapState } from 'client/libs/store';
|
||||||
import notifications from 'client/mixins/notifications';
|
import notifications from 'client/mixins/notifications';
|
||||||
|
import guide from 'client/mixins/guide';
|
||||||
|
|
||||||
import welcomeModal from './achievements/welcome';
|
import welcomeModal from './achievements/welcome';
|
||||||
import newStuff from './achievements/newStuff';
|
import newStuff from './achievements/newStuff';
|
||||||
@@ -49,7 +50,7 @@ import ultimateGear from './achievements/ultimateGear';
|
|||||||
import wonChallenge from './achievements/wonChallenge';
|
import wonChallenge from './achievements/wonChallenge';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [notifications],
|
mixins: [notifications, guide],
|
||||||
components: {
|
components: {
|
||||||
wonChallenge,
|
wonChallenge,
|
||||||
ultimateGear,
|
ultimateGear,
|
||||||
@@ -132,8 +133,8 @@ export default {
|
|||||||
invitedToQuest () {
|
invitedToQuest () {
|
||||||
return this.user.party.quest.RSVPNeeded && !this.user.party.quest.completed;
|
return this.user.party.quest.RSVPNeeded && !this.user.party.quest.completed;
|
||||||
},
|
},
|
||||||
userDailies () {
|
userTasks () {
|
||||||
return this.$store.state.tasks.data.dailys;
|
return this.$store.state.tasks.data;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -223,7 +224,8 @@ export default {
|
|||||||
if (after !== true) return;
|
if (after !== true) return;
|
||||||
this.$root.$emit('show::modal', 'quest-invitation');
|
this.$root.$emit('show::modal', 'quest-invitation');
|
||||||
},
|
},
|
||||||
userDailies () {
|
userTasks () {
|
||||||
|
// @TODO: Is this the best way to check for loaded?
|
||||||
this.runYesterDailies();
|
this.runYesterDailies();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -231,6 +233,12 @@ export default {
|
|||||||
if (!this.user.flags.welcomed) {
|
if (!this.user.flags.welcomed) {
|
||||||
this.$root.$emit('show::modal', 'welcome');
|
this.$root.$emit('show::modal', 'welcome');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.setTimeout(() => {
|
||||||
|
this.initTour();
|
||||||
|
if (this.user.flags.tour.intro === this.TOUR_END) return;
|
||||||
|
this.goto('intro', 0);
|
||||||
|
}, 2000);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
playSound () {
|
playSound () {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.tasks-column
|
.tasks-column(:class='type')
|
||||||
b-modal(ref="editTaskModal")
|
b-modal(ref="editTaskModal")
|
||||||
span Hello From My Modal!
|
span Hello From My Modal!
|
||||||
.d-flex
|
.d-flex
|
||||||
|
|||||||
@@ -1,325 +1,355 @@
|
|||||||
// var chapters = {
|
// import each from 'lodash/each';
|
||||||
// intro: [
|
// import flattenDeep from 'lodash/flattenDeep';
|
||||||
// [
|
import times from 'lodash/times';
|
||||||
// {
|
import Intro from 'intro.js/';
|
||||||
// state: 'options.profile.avatar',
|
|
||||||
// element: '.tab-content.ng-scope',
|
export default {
|
||||||
// content: this.$t('tourAvatar'),
|
data () {
|
||||||
// placement: 'top',
|
return {
|
||||||
// proceed: this.$t('tourAvatarProceed'),
|
TOUR_END: -2,
|
||||||
// backdrop: false,
|
tour: {},
|
||||||
// orphan: true,
|
chapters: {},
|
||||||
// gold: 4,
|
loaded: false,
|
||||||
// experience: 29
|
};
|
||||||
// },
|
},
|
||||||
// {
|
watch: {
|
||||||
// state: 'tasks',
|
$route () {
|
||||||
// element: '.task-column.todos',
|
this.routeChange();
|
||||||
// content: this.$t('tourToDosBrief'),
|
},
|
||||||
// placement: 'top',
|
},
|
||||||
// proceed: this.$t('tourOkay'),
|
methods: {
|
||||||
// gold: 4,
|
load () {
|
||||||
// experience: 29
|
// @TODO: this should be called after app is loaded
|
||||||
// },
|
// Init and show the welcome tour (only after user is pulled from server & wrapped).
|
||||||
// {
|
if (window.env.IS_MOBILE) return; // Don't show tour immediately on mobile devices
|
||||||
// state: 'tasks',
|
|
||||||
// element: '.task-column.dailys',
|
// let alreadyShown = (before, after) => {
|
||||||
// content: this.$t('tourDailiesBrief'),
|
// return Boolean(!before && after === true);
|
||||||
// placement: 'top',
|
// };
|
||||||
// proceed: this.$t('tourDailiesProceed'),
|
// $rootScope.$watch('user.flags.dropsEnabled', _.flow(alreadyShown, function(already) { //FIXME requires lodash@~3.2.0
|
||||||
// gold: 4,
|
},
|
||||||
// experience: 29
|
initTour () {
|
||||||
// },
|
if (this.loaded) return;
|
||||||
// {
|
this.chapters = {
|
||||||
// state: 'tasks',
|
intro: [
|
||||||
// element: '.task-column.habits',
|
[
|
||||||
// content: this.$t('tourHabitsBrief'),
|
{
|
||||||
// placement: 'top',
|
// state: 'options.profile.avatar',
|
||||||
// proceed: this.$t('tourHabitsProceed'),
|
element: '.member-details',
|
||||||
// gold: 4,
|
intro: this.$t('tourAvatar'),
|
||||||
// experience: 29
|
// placement: 'top',
|
||||||
// },
|
// proceed: this.$t('tourAvatarProceed'),
|
||||||
// {
|
// backdrop: false,
|
||||||
// state: 'tasks',
|
// orphan: true,
|
||||||
// element: 'h2.task-column_title.reward-title',
|
// gold: 4,
|
||||||
// content: User.user.flags.armoireEnabled ? this.$t('tourRewardsArmoire') : this.$t('tourRewardsBrief'),
|
// experience: 29,
|
||||||
// placement: 'left',
|
},
|
||||||
// proceed: this.$t('tourRewardsProceed'),
|
{
|
||||||
// gold: 4,
|
// state: 'tasks',
|
||||||
// experience: 29,
|
element: '.todo',
|
||||||
// final: true
|
intro: this.$t('tourToDosBrief'),
|
||||||
// }
|
placement: 'top',
|
||||||
// ]
|
// proceed: this.$t('tourOkay'),
|
||||||
// ],
|
// gold: 4,
|
||||||
// classes: [
|
// experience: 29,
|
||||||
// [
|
},
|
||||||
// {
|
{
|
||||||
// orphan: true,
|
// state: 'tasks',
|
||||||
// content: this.$t('classGearText'),
|
element: '.daily',
|
||||||
// final: true,
|
intro: this.$t('tourDailiesBrief'),
|
||||||
// state: 'options.inventory.equipment',
|
placement: 'top',
|
||||||
// element: '.equipment-tab',
|
// proceed: this.$t('tourDailiesProceed'),
|
||||||
// title: this.$t('classGear'),
|
// gold: 4,
|
||||||
// hideNavigation: true
|
// experience: 29,
|
||||||
// }
|
},
|
||||||
// /*, {
|
{
|
||||||
// state: 'options.profile.stats',
|
// state: 'tasks',
|
||||||
// element: '.allocate-stats',
|
element: '.habit',
|
||||||
// title: this.$t('stats'),
|
intro: this.$t('tourHabitsBrief'),
|
||||||
// content: this.$t('classStats')
|
placement: 'top',
|
||||||
// }, {
|
// proceed: this.$t('tourHabitsProceed'),
|
||||||
// state: 'options.profile.stats',
|
// gold: 4,
|
||||||
// element: '.auto-allocate',
|
// experience: 29,
|
||||||
// title: this.$t('autoAllocate'),
|
},
|
||||||
// placement: 'left',
|
{
|
||||||
// content: this.$t('autoAllocateText')
|
// state: 'tasks',
|
||||||
// }, {
|
element: '.reward',
|
||||||
// element: '.meter.mana',
|
intro: this.user.flags.armoireEnabled ? this.$t('tourRewardsArmoire') : this.$t('tourRewardsBrief'),
|
||||||
// title: this.$t('spells'),
|
placement: 'left',
|
||||||
// content: this.$t('spellsText')
|
// proceed: this.$t('tourRewardsProceed'),
|
||||||
// }, {
|
// gold: 4,
|
||||||
// orphan: true,
|
// experience: 29,
|
||||||
// title: this.$t('readMore'),
|
// final: true,
|
||||||
// content: this.$t('moreClass'),
|
},
|
||||||
// final: true
|
],
|
||||||
// }*/
|
],
|
||||||
// ]
|
classes: [
|
||||||
// ],
|
[
|
||||||
// stats: [[
|
{
|
||||||
// {
|
orphan: true,
|
||||||
// orphan: true,
|
intro: this.$t('classGearText'),
|
||||||
// content: this.$t('tourStatsPage'),
|
final: true,
|
||||||
// final: true,
|
state: 'options.inventory.equipment',
|
||||||
// proceed: this.$t('tourOkay'),
|
element: '.weapon',
|
||||||
// hideNavigation: true
|
title: this.$t('classGear'),
|
||||||
// }
|
hideNavigation: true,
|
||||||
// ]],
|
},
|
||||||
// tavern: [[
|
],
|
||||||
// {
|
],
|
||||||
// orphan: true,
|
stats: [[
|
||||||
// content: this.$t('tourTavernPage'),
|
{
|
||||||
// final: true,
|
orphan: true,
|
||||||
// proceed: this.$t('tourAwesome'),
|
intro: this.$t('tourStatsPage'),
|
||||||
// hideNavigation: true
|
final: true,
|
||||||
// }
|
proceed: this.$t('tourOkay'),
|
||||||
// ]],
|
hideNavigation: true,
|
||||||
// party: [[
|
},
|
||||||
// {
|
]],
|
||||||
// orphan: true,
|
tavern: [[
|
||||||
// content: this.$t('tourPartyPage'),
|
{
|
||||||
// final: true,
|
orphan: true,
|
||||||
// proceed: this.$t('tourSplendid'),
|
intro: this.$t('tourTavernPage'),
|
||||||
// hideNavigation: true
|
final: true,
|
||||||
// }
|
proceed: this.$t('tourAwesome'),
|
||||||
// ]],
|
hideNavigation: true,
|
||||||
// guilds: [[
|
},
|
||||||
// {
|
]],
|
||||||
// orphan: true,
|
party: [[
|
||||||
// content: this.$t('tourGuildsPage'),
|
{
|
||||||
// final: true,
|
orphan: true,
|
||||||
// proceed: this.$t('tourNifty'),
|
intro: this.$t('tourPartyPage'),
|
||||||
// hideNavigation: true
|
final: true,
|
||||||
// }
|
proceed: this.$t('tourSplendid'),
|
||||||
// ]],
|
hideNavigation: true,
|
||||||
// challenges: [[
|
},
|
||||||
// {
|
]],
|
||||||
// orphan: true,
|
guilds: [[
|
||||||
// content: this.$t('tourChallengesPage'),
|
{
|
||||||
// final: true,
|
// orphan: true,
|
||||||
// proceed: this.$t('tourOkay'),
|
intro: this.$t('tourGuildsPage'),
|
||||||
// hideNavigation: true
|
// final: true,
|
||||||
// }
|
// proceed: this.$t('tourNifty'),
|
||||||
// ]],
|
// hideNavigation: true,
|
||||||
// market: [[
|
},
|
||||||
// {
|
]],
|
||||||
// orphan: true,
|
challenges: [[
|
||||||
// content: this.$t('tourMarketPage'),
|
{
|
||||||
// final: true,
|
orphan: true,
|
||||||
// proceed: this.$t('tourAwesome'),
|
intro: this.$t('tourChallengesPage'),
|
||||||
// hideNavigation: true
|
final: true,
|
||||||
// }
|
proceed: this.$t('tourOkay'),
|
||||||
// ]],
|
hideNavigation: true,
|
||||||
// hall: [[
|
},
|
||||||
// {
|
]],
|
||||||
// orphan: true,
|
market: [[
|
||||||
// content: this.$t('tourHallPage'),
|
{
|
||||||
// final: true,
|
orphan: true,
|
||||||
// proceed: this.$t('tourSplendid'),
|
intro: this.$t('tourMarketPage'),
|
||||||
// hideNavigation: true
|
final: true,
|
||||||
// }
|
proceed: this.$t('tourAwesome'),
|
||||||
// ]],
|
hideNavigation: true,
|
||||||
// pets: [[
|
},
|
||||||
// {
|
]],
|
||||||
// orphan: true,
|
hall: [[
|
||||||
// content: this.$t('tourPetsPage'),
|
{
|
||||||
// final: true,
|
orphan: true,
|
||||||
// proceed: this.$t('tourNifty'),
|
intro: this.$t('tourHallPage'),
|
||||||
// hideNavigation: true
|
final: true,
|
||||||
// }
|
proceed: this.$t('tourSplendid'),
|
||||||
// ]],
|
hideNavigation: true,
|
||||||
// mounts: [[
|
},
|
||||||
// {
|
]],
|
||||||
// orphan: true,
|
pets: [[
|
||||||
// content: this.$t('tourMountsPage'),
|
{
|
||||||
// final: true,
|
orphan: true,
|
||||||
// proceed: this.$t('tourOkay'),
|
intro: this.$t('tourPetsPage'),
|
||||||
// hideNavigation: true
|
final: true,
|
||||||
// }
|
proceed: this.$t('tourNifty'),
|
||||||
// ]],
|
hideNavigation: true,
|
||||||
// equipment: [[
|
},
|
||||||
// {
|
]],
|
||||||
// orphan: true,
|
mounts: [[
|
||||||
// content: this.$t('tourEquipmentPage'),
|
{
|
||||||
// final: true,
|
orphan: true,
|
||||||
// proceed: this.$t('tourAwesome'),
|
intro: this.$t('tourMountsPage'),
|
||||||
// hideNavigation: true
|
final: true,
|
||||||
// }
|
proceed: this.$t('tourOkay'),
|
||||||
// ]]
|
hideNavigation: true,
|
||||||
// }
|
},
|
||||||
//
|
]],
|
||||||
// _.each(chapters, function(chapter, k){
|
equipment: [[
|
||||||
// _(chapter).flattenDeep().forEach(function(step, i) {
|
{
|
||||||
// step.content = '<div><div class='' + (env.worldDmg.guide ? 'npc_justin_broken' : 'npc_justin') + ' float-left'></div>' + step.content + '</div>';
|
orphan: true,
|
||||||
// $(step.element).popover('destroy'); // destroy existing hover popovers so we can add our own
|
intro: this.$t('tourEquipmentPage'),
|
||||||
// step.onShow = function(){
|
final: true,
|
||||||
// Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':false});
|
proceed: this.$t('tourAwesome'),
|
||||||
// if (step.state && !$state.is(step.state)) {
|
hideNavigation: true,
|
||||||
// $state.go(step.state);
|
},
|
||||||
// return $timeout(function(){});
|
]],
|
||||||
// }
|
};
|
||||||
// };
|
// let chapters = this.chapters;
|
||||||
// step.onHide = function(){
|
// each(chapters, (chapter, k) => {
|
||||||
// var ups = {};
|
// flattenDeep(chapter).forEach((step, i) => {
|
||||||
// var lastKnownStep = User.user.flags.tour[k];
|
// // @TODO: (env.worldDmg.guide ? 'npc_justin_broken' : 'npc_justin')
|
||||||
//
|
// step.content = `<div><div class='npc_justin float-left'></div>${step.content}</div>`;
|
||||||
// // Return early if user has already completed this tutorial
|
// // @TODO: $(step.element).popover('destroy'); // destroy existing hover popovers so we can add our own
|
||||||
// if (lastKnownStep === -2) {
|
//
|
||||||
// return;
|
// step.onShow = () => {
|
||||||
// }
|
// // @TODO: Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':false});
|
||||||
//
|
// // @TODO: Add Router if (!step.state || $state.is(step.state)) return;
|
||||||
// if (i > lastKnownStep) {
|
// // @TODO: Add Router $state.go(step.state);
|
||||||
// if (step.gold) ups['stats.gp'] = User.user.stats.gp + step.gold;
|
// // @TODO: Do we need this? return $timeout(() => {});
|
||||||
// if (step.experience) ups['stats.exp'] = User.user.stats.exp + step.experience;
|
// };
|
||||||
// ups['flags.tour.'+k] = i;
|
// });
|
||||||
// }
|
// });
|
||||||
//
|
|
||||||
// if (step.final) { // -2 indicates complete
|
// let tour = this.tour;
|
||||||
// if (k === 'intro') {
|
// each(chapters, (v, k) => {
|
||||||
// // Manually show bunny scroll reward
|
// tour[k] = new Tour({
|
||||||
// var rewardData = {
|
// name: k,
|
||||||
// reward: [Shared.content.quests.dustbunnies],
|
// backdrop: true,
|
||||||
// rewardKey: ['inventory_quest_scroll_dustbunnies'],
|
// template: (i, step) => {
|
||||||
// rewardText: Shared.content.quests.dustbunnies.text(),
|
// let showFinish = step.final || k === 'classes';
|
||||||
// message: this.$t('checkinEarned'),
|
// let showCounter = k === 'intro' && !step.final;
|
||||||
// nextRewardAt: 1,
|
// // TODO: we can probably create a component for all this
|
||||||
// };
|
//
|
||||||
// Notification.showLoginIncentive(User.user, rewardData, Social.loadWidgets);
|
// let counterSpan = '';
|
||||||
// }
|
// if (showCounter) counterSpan = `<span style="float:right;">${i + 1} of ${flattenDeep(chapters[k]).length}</span>`;
|
||||||
// //Mark tour complete
|
//
|
||||||
// ups['flags.tour.'+k] = -2;
|
// let prevButton = '';
|
||||||
// Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':true})
|
// if (!step.hideNavigation) prevButton = '<button class="btn btn-sm btn-default" data-role="prev">« Previous</button>';
|
||||||
// }
|
//
|
||||||
//
|
// let nextButton = '';
|
||||||
// User.set(ups);
|
// let stepProceedText = 'Next';
|
||||||
// // User.set() doesn't include a check for level changes, so manually check here.
|
// if (step.proceed) stepProceedText = step.proceed;
|
||||||
// if (step.experience) {
|
// if (!step.hideNavigation) nextButton = `<button class="btn btn-sm btn-primary" data-role="next">${stepProceedText} »</button>`;
|
||||||
// User.user.fns.updateStats(User.user.stats);
|
// let stepFinishText = 'Finish Tour';
|
||||||
// }
|
// if (step.proceed) stepFinishText = step.proceed;
|
||||||
// }
|
// if (showFinish) nextButton = `<button class="btn btn-sm btn-primary" data-role="end" style="float:none;">${stepFinishText}</button>`;
|
||||||
// });
|
//
|
||||||
// });
|
// return `<div class="popover" role="tooltip"> \
|
||||||
//
|
// <div class="arrow"></div> \
|
||||||
// var tour = {};
|
// <h3 class="popover-title"></h3> \
|
||||||
// _.each(chapters, function(v,k){
|
// <div class="popover-content"></div> \
|
||||||
// tour[k] = new Tour({
|
// <div class="popover-navigation"> \
|
||||||
// name: k,
|
// ${counterSpan} \
|
||||||
// backdrop: true,
|
// <div class="btn-group"> \
|
||||||
// template: function(i,step){
|
// ${prevButton} \
|
||||||
// var showFinish = step.final || k == 'classes';
|
// ${nextButton} \
|
||||||
// var showCounter = k=='intro' && !step.final;
|
// <button class="btn btn-sm btn-default" \
|
||||||
//
|
// data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> \
|
||||||
// return '<div class='popover' role='tooltip'>' +
|
// </div> \
|
||||||
// '<div class='arrow'></div>' +
|
// </div> \
|
||||||
// '<h3 class='popover-title'></h3>' +
|
// </div>`;
|
||||||
// '<div class='popover-content'></div>' +
|
// },
|
||||||
// '<div class='popover-navigation'> ' +
|
// storage: false,
|
||||||
// (showCounter ? '<span style='float:right;'>'+ (i+1 +' of '+ _.flattenDeep(chapters[k]).length) +'</span>' : '')+ // counter
|
// });
|
||||||
// '<div class='btn-group'>' +
|
// });
|
||||||
// (step.hideNavigation ? '' : '<button class='btn btn-sm btn-default' data-role='prev'>« Previous</button>') +
|
this.loaded = true;
|
||||||
// (showFinish ? ('<button class='btn btn-sm btn-primary' data-role='end' style='float:none;'>' + (step.proceed ? step.proceed : 'Finish Tour') + '</button>') :
|
},
|
||||||
// (step.hideNavigation ? '' : ('<button class='btn btn-sm btn-primary' data-role='next'>' + (step.proceed ? step.proceed : 'Next') + ' »</button>'))) +
|
routeChange () {
|
||||||
// '<button class='btn btn-sm btn-default' data-role='pause-resume' data-pause-text='Pause' data-resume-text='Resume'>Pause</button>' +
|
this.initTour();
|
||||||
// '</div>' +
|
switch (this.$route.name) {
|
||||||
// '</div>' +
|
// case 'options.profile.avatar': return goto('intro', 5);
|
||||||
// '</div>';
|
case 'stats': return this.goto('stats', 0);
|
||||||
// },
|
case 'tavern': return this.goto('tavern', 0);
|
||||||
// storage: false
|
case 'party': return this.goto('party', 0);
|
||||||
// });
|
case 'guildsDiscovery': return this.goto('guilds', 0);
|
||||||
// });
|
case 'challenges': return this.goto('challenges', 0);
|
||||||
//
|
case 'patrons': return this.goto('hall', 0);
|
||||||
// var goto = function(chapter, page, force) {
|
case 'items': return this.goto('market', 0);
|
||||||
// if (chapter == 'intro' && User.user.flags.welcomed != true) User.set({'flags.welcomed': true});
|
case 'stable': return this.goto('pets', 0);
|
||||||
// if (chapter == 'classes' && User.user.flags.tour.classes === -2) return;
|
// @TODO: same page now case 'stable': return this.goto('mounts', 0);
|
||||||
// if (page === -1) page = 0;
|
case 'equipment': return this.goto('equipment', 0);
|
||||||
// var curr = User.user.flags.tour[chapter];
|
}
|
||||||
// if (page != curr+1 && !force) return;
|
},
|
||||||
// var chap = tour[chapter], opts = chap._options;
|
hoyo (user) {
|
||||||
// opts.steps = [];
|
// @TODO: What is was the timeout for?
|
||||||
// _.times(page, function(p){
|
window.amplitude.setUserId(user._id);
|
||||||
// opts.steps = opts.steps.concat(chapters[chapter][p]);
|
window.ga('set', {userId: user._id});
|
||||||
// })
|
},
|
||||||
//
|
goto (chapter, page, force) {
|
||||||
// var end = opts.steps.length;
|
if (chapter === 'intro' && this.user.flags.welcomed !== true) {
|
||||||
// opts.steps = opts.steps.concat(chapters[chapter][page]);
|
// @TODO: Add dispatch User.set({'flags.welcomed': true});
|
||||||
// chap._removeState('end');
|
}
|
||||||
//
|
if (chapter === 'classes' && this.user.flags.tour.classes === -2) return;
|
||||||
// if (chap._inited) {
|
if (page === -1) page = 0;
|
||||||
// chap.goTo(end);
|
let curr = this.user.flags.tour[chapter];
|
||||||
// } else {
|
if (page !== curr + 1 && !force) return;
|
||||||
// chap.setCurrentStep(end);
|
let chap = this.tour[chapter];
|
||||||
// if (page > 0) {
|
if (!chap) return;
|
||||||
// chap.init();
|
let opts = chap._options;
|
||||||
// chap.goTo(page);
|
opts.steps = [];
|
||||||
// } else {
|
|
||||||
// chap.start();
|
page += 1;
|
||||||
// }
|
times(page, (p) => {
|
||||||
// }
|
opts.steps = opts.steps.concat(this.chapters[chapter][p]);
|
||||||
// }
|
});
|
||||||
//
|
|
||||||
// //Init and show the welcome tour (only after user is pulled from server & wrapped).
|
// let end = opts.steps.length;
|
||||||
// var watcher = $rootScope.$watch('User.user._wrapped', function(wrapped){
|
// opts.steps = opts.steps.concat(this.chapters[chapter][page]);
|
||||||
// if (!wrapped) return; // only run after user has been wrapped
|
// chap._removeState('end');
|
||||||
// watcher(); // deregister watcher
|
// @TODO: Do we always need to initialize here?
|
||||||
// if (window.env.IS_MOBILE) return; // Don't show tour immediately on mobile devices
|
let intro = Intro.introJs();
|
||||||
// if (User.user.flags.welcomed == false) {
|
intro.setOptions({steps: opts.steps});
|
||||||
// $rootScope.openModal('welcome', {size: 'lg', backdrop: 'static', keyboard: false});
|
intro.start();
|
||||||
// }
|
intro.oncomplete(() => {
|
||||||
//
|
this.markTourComplete(chapter);
|
||||||
// var alreadyShown = function(before, after) { return !(!before && after === true) };
|
});
|
||||||
// //$rootScope.$watch('user.flags.dropsEnabled', _.flow(alreadyShown, function(already) { //FIXME requires lodash@~3.2.0
|
|
||||||
// $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){
|
// if (chap._inited) {
|
||||||
// switch (toState.name) {
|
// chap.goTo(end);
|
||||||
// // case 'options.profile.avatar': return goto('intro', 5);
|
// } else {
|
||||||
// case 'options.profile.stats': return goto('stats', 0);
|
// chap.setCurrentStep(end);
|
||||||
// case 'options.social.tavern': return goto('tavern', 0);
|
// if (page > 0) {
|
||||||
// case 'options.social.party': return goto('party', 0);
|
// chap.init();
|
||||||
// case 'options.social.guilds.public': return goto('guilds', 0);
|
// chap.goTo(page);
|
||||||
// case 'options.social.challenges': return goto('challenges', 0);
|
// } else {
|
||||||
// case 'options.social.hall.heroes': return goto('hall', 0);
|
// chap.start();
|
||||||
// case 'options.inventory.drops': return goto('market', 0);
|
// }
|
||||||
// case 'options.inventory.pets': return goto('pets', 0);
|
// }
|
||||||
// case 'options.inventory.mounts': return goto('mounts', 0);
|
},
|
||||||
// case 'options.inventory.equipment': return goto('equipment', 0);
|
markTourComplete (chapter) {
|
||||||
// }
|
// @TODO: this is suppose to keep track of wher ethe left off. Do that later
|
||||||
// });
|
let ups = {};
|
||||||
// });
|
let lastKnownStep = this.user.flags.tour[chapter];
|
||||||
//
|
|
||||||
// export default {
|
// Return early if user has already completed this tutorial
|
||||||
// methods: {
|
if (lastKnownStep === -2) {
|
||||||
// hoyo (user) {
|
return;
|
||||||
// // @TODO: What is was the timeout for?
|
}
|
||||||
// window.amplitude.setUserId(user._id);
|
|
||||||
// window.ga('set', {userId: user._id});
|
// if (i > lastKnownStep) {
|
||||||
// },
|
// if (step.gold) ups['stats.gp'] = this.user.stats.gp + step.gold;
|
||||||
// },
|
// if (step.experience) ups['stats.exp'] = this.user.stats.exp + step.experience;
|
||||||
// };
|
// ups[`flags.tour.${k}`] = i;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// step.final
|
||||||
|
// 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
|
||||||
|
// @TODO: Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':true})
|
||||||
|
// }
|
||||||
|
|
||||||
|
this.$store.dispatch('user:set', ups);
|
||||||
|
// User.set() doesn't include a check for level changes, so manually check here.
|
||||||
|
// @TODO:
|
||||||
|
// if (step.experience) {
|
||||||
|
// this.user.fns.updateStats(this.user.stats);
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user