From f6b2dde479f55e59a6ac6d7762eff37ae65fd6c0 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 27 Sep 2017 16:19:00 +0200 Subject: [PATCH 1/5] 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 @@ diff --git a/rpg-docs/client/views/character/inventory/inventory.html b/rpg-docs/client/views/character/inventory/inventory.html index cf823d5f..c135c6ec 100644 --- a/rpg-docs/client/views/character/inventory/inventory.html +++ b/rpg-docs/client/views/character/inventory/inventory.html @@ -110,12 +110,12 @@
{{round totalWeight}} lbs
-
+
- Container carried + {{#simpleTooltip}} Container carried{{/simpleTooltip}}
@@ -136,21 +136,21 @@ class="addContainer" mini> - New container + {{#simpleTooltip class="always"}} Container {{/simpleTooltip}}
- Library item + {{#simpleTooltip class="always"}} Item from library {{/simpleTooltip}}
- New item + {{#simpleTooltip class="always"}} Item {{/simpleTooltip}}
{{/fabMenu}} {{/if}} diff --git a/rpg-docs/client/views/character/journal/journal.html b/rpg-docs/client/views/character/journal/journal.html index 5ae06ced..8632954c 100644 --- a/rpg-docs/client/views/character/journal/journal.html +++ b/rpg-docs/client/views/character/journal/journal.html @@ -83,9 +83,12 @@
{{#if canEditCharacter _id}} - +
+ + + {{#simpleTooltip}}Add Note{{/simpleTooltip}} +
{{/if}} diff --git a/rpg-docs/client/views/character/spells/spells.html b/rpg-docs/client/views/character/spells/spells.html index b5011f82..c992daa4 100644 --- a/rpg-docs/client/views/character/spells/spells.html +++ b/rpg-docs/client/views/character/spells/spells.html @@ -53,22 +53,22 @@ {{numPrepared}} / {{evaluate charId maxPrepared}} {{/if}} -
- - Done - +
+ {{#simpleTooltip}} + Done + {{/simpleTooltip}}
{{else}} -
- - Change prepared spells - +
+ {{#simpleTooltip}} + Change prepared spells + {{/simpleTooltip}}
{{/if}}
@@ -124,32 +124,31 @@ {{#if canEditCharacter _id}} {{#fabMenu}}
- - New spell list - - + {{#simpleTooltip class="always"}} + Spell list + {{/simpleTooltip}}
- - Spell library - + {{#simpleTooltip class="always"}} + Spell from library + {{/simpleTooltip}}
- - New spell - + {{#simpleTooltip class="always"}} + Spell + {{/simpleTooltip}}
{{/fabMenu}} {{/if}} diff --git a/rpg-docs/client/views/character/stats/attributeDialog/attributeDialog.js b/rpg-docs/client/views/character/stats/attributeDialog/attributeDialog.js index 1e2bf9a3..202df998 100644 --- a/rpg-docs/client/views/character/stats/attributeDialog/attributeDialog.js +++ b/rpg-docs/client/views/character/stats/attributeDialog/attributeDialog.js @@ -157,4 +157,10 @@ Template.attributeDialogView.helpers({ statValue: function(){ return evaluateEffect(this.charId, this); }, + showNewUserExperience: function(){ + console.log(this.statName); + if (this.statName === "speed"){ + return Session.get("newUserExperienceStep") >= 2; + } + }, }); diff --git a/rpg-docs/client/views/characterList/characterList.html b/rpg-docs/client/views/characterList/characterList.html index a5b00dd2..94962a5b 100644 --- a/rpg-docs/client/views/characterList/characterList.html +++ b/rpg-docs/client/views/characterList/characterList.html @@ -49,14 +49,14 @@ class="addParty" mini> - New Party + {{#simpleTooltip class="always"}} New Party {{/simpleTooltip}}
- New Character + {{#simpleTooltip class="always"}} New Character {{/simpleTooltip}}
{{/fabMenu}} diff --git a/rpg-docs/client/views/paperTemplates/inputSuffixes/inputSuffixes.html b/rpg-docs/client/views/paperTemplates/inputSuffixes/inputSuffixes.html index 9cd48f6b..08c15e04 100644 --- a/rpg-docs/client/views/paperTemplates/inputSuffixes/inputSuffixes.html +++ b/rpg-docs/client/views/paperTemplates/inputSuffixes/inputSuffixes.html @@ -25,7 +25,6 @@ {{/ simpleTooltip}}
- {{# simpleTooltip}} This field accepts formulae in {curly brackets} diff --git a/rpg-docs/client/views/paperTemplates/simpleTooltip/simpleTooltip.css b/rpg-docs/client/views/paperTemplates/simpleTooltip/simpleTooltip.css index 39bb2cc3..67822bb6 100644 --- a/rpg-docs/client/views/paperTemplates/simpleTooltip/simpleTooltip.css +++ b/rpg-docs/client/views/paperTemplates/simpleTooltip/simpleTooltip.css @@ -1,4 +1,18 @@ -.simple-tooltip:hover .tooltip { +.simple-tooltip { + pointer-events: none; +} + +.simple-tooltip:active { + pointer-events: none; +} + +/* Show the tooltip if a older sibling is hovered */ +*:hover ~ .simple-tooltip > .tooltip { + opacity: 0.9; +} + +/* Show the tooltip if parent is hovered */ +*:hover > .simple-tooltip > .tooltip { opacity: 0.9; } @@ -16,3 +30,7 @@ pointer-events: none; white-space: nowrap; } + +.tooltip.always { + opacity: 0.9; +} diff --git a/rpg-docs/client/views/paperTemplates/simpleTooltip/simpleTooltip.html b/rpg-docs/client/views/paperTemplates/simpleTooltip/simpleTooltip.html index 961f80f4..f364ba71 100644 --- a/rpg-docs/client/views/paperTemplates/simpleTooltip/simpleTooltip.html +++ b/rpg-docs/client/views/paperTemplates/simpleTooltip/simpleTooltip.html @@ -1,6 +1,6 @@