1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-30 13:14:20 +00:00

réduction de la taille des emplacements de sorts dans le grimoire personnel + options d'impressions

This commit is contained in:
Maxime Moraine 2020-05-04 12:01:58 +02:00
parent e6c38d156a
commit 44b8729230
3 changed files with 25 additions and 8 deletions

View file

@ -33,9 +33,15 @@ export default {
// Récupération des données utilisateurs depuis le navigateur
if(localStorage.getItem('mySpells') && localStorage.getItem('mySpells') !== undefined) {
let localStorageData = JSON.parse(localStorage.getItem('mySpells'))
state.spells = localStorageData.spells
state.spellSlots = localStorageData.spellSlots
state.notPrintedSpells = localStorageData.notPrintedSpells
if (localStorageData.spells) {
state.spells = localStorageData.spells
}
if (localStorageData.spellSlots) {
state.spellSlots = localStorageData.spellSlots
}
if (localStorageData.notPrintedSpells) {
state.notPrintedSpells = localStorageData.notPrintedSpells
}
}
},
setSpells: (state, payload) => {
@ -65,6 +71,9 @@ export default {
setSpellSlots: (state, payload) => {
state.spellSlots = payload
},
setNotPrintedSpells: (state, payload) => {
state.notPrintedSpells = payload
},
addNotPrintedSpell: (state, payload) => {
let spellIndex = state.notPrintedSpells.findIndex(spell => spell.key == payload.key)
if (!spellIndex >= 0) {

View file

@ -40,13 +40,13 @@
</div>
<div class="mx-md-12">
<div v-if="group > 0" style="width: 125px;">
<v-text-field dark label="Emplacements" type="number" min="0" v-model="spellSlots[group]" @input="onInputSpellSlots"></v-text-field>
<v-text-field dark hide-details outlined dense label="Emplacements" type="number" min="0" v-model="spellSlots[group]" @input="onInputSpellSlots"></v-text-field>
</div>
</div>
<div class="ml-md-12">
<div class="d-flex" v-if="spellSlots[group] > 0">
<div v-for="(slot, idx) in Number(spellSlots[group])" :key="idx">
<v-checkbox dark></v-checkbox>
<v-checkbox dark hide-details class="spell-slot"></v-checkbox>
</div>
</div>
</div>
@ -197,9 +197,11 @@ export default {
}
},
isHiddenPrint (spell) {
let idx = this.$store.state.mySpells.notPrintedSpells.findIndex(item => item.key == spell.key)
if (idx >= 0) {
return true
if (this.$store.state.mySpells.notPrintedSpells) {
let idx = this.$store.state.mySpells.notPrintedSpells.findIndex(item => item.key == spell.key)
if (idx >= 0) {
return true
}
}
return false
}
@ -216,4 +218,7 @@ export default {
.cursor-pointer {
cursor: pointer;
}
.spell-slot {
margin: 0;
}
</style>

View file

@ -70,6 +70,9 @@ export default {
if (result.spellSlots) {
self.$store.commit('mySpells/setSpellSlots', result.spellSlots)
}
if (result.notPrintedSpells) {
self.$store.commit('mySpells/setNotPrintedSpells', result.notPrintedSpells)
}
}
}