diff --git a/app/imports/client/ui/creature/CreatureForm.vue b/app/imports/client/ui/creature/CreatureForm.vue index d0752e73..65d1b6e6 100644 --- a/app/imports/client/ui/creature/CreatureForm.vue +++ b/app/imports/client/ui/creature/CreatureForm.vue @@ -218,30 +218,30 @@ export default { }, methods: { changeShowTreeTab(value) { + let currentTab = this.$store.getters.tabNameById(this.model._id); + if (!value && currentTab === 'tree') { + this.$store.commit( + 'setTabForCharacterSheet', + { id: this.model._id, tab: 'build' } + ); + } this.$emit('change', { path: ['settings', 'showTreeTab'], value: !!value }); - let currentTab = this.$store.getters.tabById(this.model._id); - if (!value && currentTab === 5) { - this.$store.commit( - 'setTabForCharacterSheet', - { id: this.model._id, tab: 4 } - ); - } }, changeHideSpellsTab(value) { + let currentTab = this.$store.getters.tabNameById(this.model._id); + if (!value && currentTab === 'spells') { + this.$store.commit( + 'setTabForCharacterSheet', + { id: this.model._id, tab: 'actions' } + ); + } this.$emit('change', { path: ['settings', 'hideSpellsTab'], value: !value }); - let currentTab = this.$store.getters.tabById(this.model._id); - if (!value && currentTab === 3) { - this.$store.commit( - 'setTabForCharacterSheet', - { id: this.model._id, tab: 4 } - ); - } }, allUserLibrariesChange(value, ack) { toggleAllUserLibraries.call({ diff --git a/app/imports/client/ui/creature/character/CharacterCreationDialog.vue b/app/imports/client/ui/creature/character/CharacterCreationDialog.vue index 001f8a64..e18cfc38 100644 --- a/app/imports/client/ui/creature/character/CharacterCreationDialog.vue +++ b/app/imports/client/ui/creature/character/CharacterCreationDialog.vue @@ -195,7 +195,7 @@ export default { } else { this.$store.commit( 'setTabForCharacterSheet', - {id: creatureId, tab: 5} + {id: creatureId, tab: 'build'} ); this.$emit('pop', creatureId); defer(() => { diff --git a/app/imports/client/ui/creature/character/CharacterSheet.vue b/app/imports/client/ui/creature/character/CharacterSheet.vue index 7596c629..dcc6329b 100644 --- a/app/imports/client/ui/creature/character/CharacterSheet.vue +++ b/app/imports/client/ui/creature/character/CharacterSheet.vue @@ -47,9 +47,6 @@ - - - @@ -59,6 +56,9 @@ + + + @@ -96,10 +96,6 @@ Stats mdi-chart-box - - Features - mdi-text - Actions mdi-lightning-bolt @@ -112,6 +108,10 @@ Inventory mdi-cube + + Features + mdi-text + Journal mdi-book-open-variant diff --git a/app/imports/client/ui/creature/character/CharacterSheetToolbar.vue b/app/imports/client/ui/creature/character/CharacterSheetToolbar.vue index 750819ef..be85d916 100644 --- a/app/imports/client/ui/creature/character/CharacterSheetToolbar.vue +++ b/app/imports/client/ui/creature/character/CharacterSheetToolbar.vue @@ -101,9 +101,6 @@ Stats - - Features - Actions @@ -113,6 +110,9 @@ Inventory + + Features + Journal diff --git a/app/imports/client/ui/vuexStore.js b/app/imports/client/ui/vuexStore.js index feaf1544..d4578aa0 100644 --- a/app/imports/client/ui/vuexStore.js +++ b/app/imports/client/ui/vuexStore.js @@ -2,8 +2,8 @@ import Vue from 'vue'; import Vuex from 'vuex'; import dialogStackStore from '/imports/client/ui/dialogStack/dialogStackStore.js'; import Creatures from '/imports/api/creature/creatures/Creatures.js'; -const tabs = ['stats', 'features', 'actions', 'spells', 'inventory', 'journal', 'build', 'tree']; -const tabsWithoutSpells = ['stats', 'features', 'actions', 'inventory', 'journal', 'build', 'tree']; +const tabs = ['stats', 'actions', 'spells', 'inventory', 'features', 'journal', 'build', 'tree']; +const tabsWithoutSpells = ['stats', 'actions', 'inventory', 'features', 'journal', 'build', 'tree']; Vue.use(Vuex); const store = new Vuex.Store({ @@ -50,6 +50,19 @@ const store = new Vuex.Store({ document.title = value; }, setTabForCharacterSheet(state, { tab, id }) { + // Convert tab names to tab numbers + if (typeof tab === 'string') { + const creature = Creatures.findOne(id); + if (creature?.settings?.hideSpellsTab) { + tab = tabsWithoutSpells.indexOf(tab); + } else { + tab = tabs.indexOf(tab); + } + if (!(tab > -1)) { + throw 'Could not find requested tab'; + } + console.log('resolved: ', tab); + } Vue.set(state.characterSheetTabs, id, tab); }, setShowDetailsDialog(state, value) {