From f6b2dde479f55e59a6ac6d7762eff37ae65fd6c0 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 27 Sep 2017 16:19:00 +0200 Subject: [PATCH] Added basic onboarding steps --- rpg-docs/Model/Character/Characters.js | 5 + rpg-docs/client/style/bounce.css | 17 + .../views/character/characterSheet.html | 7 +- .../client/views/character/characterSheet.js | 26 +- .../features/featureDialog/featureDialog.html | 13 +- .../features/featureDialog/featureDialog.js | 3 + .../views/character/features/features.html | 2 +- .../views/character/features/features.js | 4 + .../views/character/journal/journal.html | 2 +- .../client/views/character/journal/journal.js | 3 + .../newUserStepper/newUserStepper.css | 12 + .../newUserStepper/newUserStepper.html | 26 + .../newUserStepper/newUserStepper.js | 41 + .../views/paperTemplates/infoBox/infoBox.css | 15 + .../views/paperTemplates/infoBox/infoBox.html | 10 + rpg-docs/config.vulcanize | 1 + rpg-docs/lib/constants/useraccountsConfig.js | 18 +- .../fade-in-slide-from-left-animation.html | 45 ++ .../fade-in-slide-from-right-animation.html | 45 ++ .../fade-out-slide-left-animation.html | 45 ++ .../fade-out-slide-right-animation.html | 45 ++ .../paper-stepper/bower.json | 48 ++ .../custom_components/paper-stepper/hero.svg | 27 + .../paper-stepper/paper-step.html | 424 ++++++++++ .../paper-stepper/paper-stepper.html | 735 ++++++++++++++++++ .../paper-stepper/step-horizontal-label.html | 124 +++ .../paper-stepper/step-label-behavior.html | 58 ++ .../step-label-shared-styles.html | 74 ++ .../paper-stepper/step-vertical.html | 177 +++++ 29 files changed, 2036 insertions(+), 16 deletions(-) create mode 100644 rpg-docs/client/style/bounce.css create mode 100644 rpg-docs/client/views/character/newUserStepper/newUserStepper.css create mode 100644 rpg-docs/client/views/character/newUserStepper/newUserStepper.html create mode 100644 rpg-docs/client/views/character/newUserStepper/newUserStepper.js create mode 100644 rpg-docs/client/views/paperTemplates/infoBox/infoBox.css create mode 100644 rpg-docs/client/views/paperTemplates/infoBox/infoBox.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/animations/fade-in-slide-from-left-animation.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/animations/fade-in-slide-from-right-animation.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/animations/fade-out-slide-left-animation.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/animations/fade-out-slide-right-animation.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/bower.json create mode 100644 rpg-docs/public/custom_components/paper-stepper/hero.svg create mode 100644 rpg-docs/public/custom_components/paper-stepper/paper-step.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/paper-stepper.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/step-horizontal-label.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/step-label-behavior.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/step-label-shared-styles.html create mode 100644 rpg-docs/public/custom_components/paper-stepper/step-vertical.html diff --git a/rpg-docs/Model/Character/Characters.js b/rpg-docs/Model/Character/Characters.js index 740d7cea..50b7156b 100644 --- a/rpg-docs/Model/Character/Characters.js +++ b/rpg-docs/Model/Character/Characters.js @@ -191,6 +191,7 @@ Schemas.Character = new SimpleSchema({ "settings.exportFeatures": {type: Boolean, defaultValue: true}, "settings.exportAttacks": {type: Boolean, defaultValue: true}, "settings.exportDescription": {type: Boolean, defaultValue: true}, + "settings.newUserExperience": {type: Boolean, optional: true}, }); Characters.attachSchema(Schemas.Character); @@ -554,6 +555,10 @@ if (Meteor.isServer){ }); Characters.before.insert(function(userId, doc) { doc.urlName = getSlug(doc.name, {maintainCase: true}) || "-"; + // The first character a user creates should have the new user experience + if (!Characters.find({owner: userId}).count()){ + doc.settings.newUserExperience = true; + } }); } diff --git a/rpg-docs/client/style/bounce.css b/rpg-docs/client/style/bounce.css new file mode 100644 index 00000000..481754d5 --- /dev/null +++ b/rpg-docs/client/style/bounce.css @@ -0,0 +1,17 @@ +@keyframes bounce { + from { + transform: translate(0px,0px); + } + to { + transform: translate(0px,-16px); + } +} + +.bounce{ + animation-name: bounce; + animation-duration: 0.3s; + animation-direction: alternate; + animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94); + animation-delay: 0s; + animation-iteration-count: infinite; +} diff --git a/rpg-docs/client/views/character/characterSheet.html b/rpg-docs/client/views/character/characterSheet.html index 9fd7a65f..ca18dbfd 100644 --- a/rpg-docs/client/views/character/characterSheet.html +++ b/rpg-docs/client/views/character/characterSheet.html @@ -44,17 +44,18 @@
- Stats - Features + Stats + Features Inventory {{#unless hideSpellcasting}} Spells {{/unless}} Persona - Journal + Journal
+ {{#if session "showNewUserExperience"}}{{> newUserStepper}}{{/if}}
diff --git a/rpg-docs/client/views/character/characterSheet.js b/rpg-docs/client/views/character/characterSheet.js index 528cf42d..bd14795a 100644 --- a/rpg-docs/client/views/character/characterSheet.js +++ b/rpg-docs/client/views/character/characterSheet.js @@ -29,7 +29,17 @@ Template.characterSheet.onRendered(function() { tabFabMenus = _.times(6, (n) => tabPages[n].find(".mini-holder") ); - }) + }); + + // New user experience starts on the features tab + var settings = Characters.findOne(this.data._id, { + fields: {settings: 1} + }).settings; + if (settings && settings.newUserExperience){ + Session.set(this.data._id + ".selectedTab", "1"); + Session.set("showNewUserExperience", true); + Session.set("newUserExperienceStep", 0); + } //watch this character and make sure their encumbrance is updated //trackEncumbranceConditions(this.data._id, this); @@ -172,6 +182,20 @@ Template.characterSheet.helpers({ var char = Characters.findOne(this._id); return char && char.settings.hideSpellcasting; }, + newUserExperience: function(){ + var char = Characters.findOne(this._id); + return char && char.settings.newUserExperience; + }, + shouldBounce: function(tab){ + console.log(this._id); + const selected = Session.get(this._id + ".selectedTab") + const step = Session.get("newUserExperienceStep"); + console.log({selected, step, tab}); + if (selected == tab) return false; + return (tab === 1 && step === 0) || + (tab === 5 && step === 1) || + (tab === 0 && step === 2); + }, }); Template.characterSheet.events({ diff --git a/rpg-docs/client/views/character/features/featureDialog/featureDialog.html b/rpg-docs/client/views/character/features/featureDialog/featureDialog.html index c73a988c..187e2216 100644 --- a/rpg-docs/client/views/character/features/featureDialog/featureDialog.html +++ b/rpg-docs/client/views/character/features/featureDialog/featureDialog.html @@ -42,9 +42,20 @@