Merge branch 'version-2-dev' into version-2

This commit is contained in:
Stefan Zermatten
2022-11-29 14:53:01 +02:00
5 changed files with 40 additions and 27 deletions

View File

@@ -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({

View File

@@ -195,7 +195,7 @@ export default {
} else {
this.$store.commit(
'setTabForCharacterSheet',
{id: creatureId, tab: 5}
{id: creatureId, tab: 'build'}
);
this.$emit('pop', creatureId);
defer(() => {

View File

@@ -47,9 +47,6 @@
<v-tab-item>
<stats-tab :creature-id="creatureId" />
</v-tab-item>
<v-tab-item>
<features-tab :creature-id="creatureId" />
</v-tab-item>
<v-tab-item>
<actions-tab :creature-id="creatureId" />
</v-tab-item>
@@ -59,6 +56,9 @@
<v-tab-item>
<inventory-tab :creature-id="creatureId" />
</v-tab-item>
<v-tab-item>
<features-tab :creature-id="creatureId" />
</v-tab-item>
<v-tab-item>
<character-tab :creature-id="creatureId" />
</v-tab-item>
@@ -96,10 +96,6 @@
<span>Stats</span>
<v-icon>mdi-chart-box</v-icon>
</v-btn>
<v-btn>
<span>Features</span>
<v-icon>mdi-text</v-icon>
</v-btn>
<v-btn>
<span>Actions</span>
<v-icon>mdi-lightning-bolt</v-icon>
@@ -112,6 +108,10 @@
<span>Inventory</span>
<v-icon>mdi-cube</v-icon>
</v-btn>
<v-btn>
<span>Features</span>
<v-icon>mdi-text</v-icon>
</v-btn>
<v-btn>
<span>Journal</span>
<v-icon>mdi-book-open-variant</v-icon>

View File

@@ -101,9 +101,6 @@
<v-tab>
Stats
</v-tab>
<v-tab>
Features
</v-tab>
<v-tab>
Actions
</v-tab>
@@ -113,6 +110,9 @@
<v-tab>
Inventory
</v-tab>
<v-tab>
Features
</v-tab>
<v-tab>
Journal
</v-tab>

View File

@@ -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) {