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

ajout de feedback sur les mises à jour de créations. see #20

This commit is contained in:
Maxime Moraine 2020-05-23 10:05:33 +02:00
parent a854071c7d
commit 183c7fcaa5
5 changed files with 33 additions and 0 deletions

View file

@ -32,6 +32,8 @@ export default new Vuex.Store({
isThemeDark: false,
isOpenAboutDialog: false,
isOpenSupportDialog: false,
isOpenSnackbar: false,
snackbarText: ''
},
getters: {
@ -43,6 +45,7 @@ export default new Vuex.Store({
isThemeDark: state => state.isThemeDark,
isOpenAboutDialog: state => state.isOpenAboutDialog,
isOpenSupportDialog: state => state.isOpenSupportDialog,
isOpenSnackbar: state => state.isOpenSnackbar,
},
actions: {
@ -70,6 +73,12 @@ export default new Vuex.Store({
isOpenSupportDialog: ({ commit }, payload) => {
commit('setIsOpenSupportDialog', payload)
},
isOpenSnackbar: ({ commit }, payload) => {
commit('setIsOpenSnackbar', payload)
},
snackbarText: ({ commit }, payload) => {
commit('setSnackbarText', payload)
},
},
mutations: {
@ -99,5 +108,16 @@ export default new Vuex.Store({
setIsOpenSupportDialog: (state, payload) => {
state.isOpenSupportDialog = payload
},
setIsOpenSnackbar: (state, payload) => {
state.isOpenSnackbar = payload
if (payload === true) {
setTimeout(function () {
state.isOpenSnackbar = false
}, 5000)
}
},
setSnackbarText: (state, payload) => {
state.snackbarText = payload
},
},
})

View file

@ -181,6 +181,8 @@ export default {
updateMagicItemInTreasureChest () {
if (this.isMagicItemInTreasureChest) {
this.$store.commit('myMagicItems/updateMagicItem', this.magicItem)
this.$store.commit('setSnackbarText', "L'objet a été mis à jour dans la bibliothèque")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -384,6 +384,8 @@ export default {
updateMonsterInBestiary () {
if (this.isMonsterInBestiary) {
this.$store.commit('myMonsters/updateMonster', this.monster)
this.$store.commit('setSnackbarText', "Le monstre a été mis à jour dans votre bestiaire")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -224,6 +224,8 @@ export default {
updateSpellInSpellBook () {
if (this.isSpellInSpellBook) {
this.$store.commit('mySpells/updateSpell', this.spell)
this.$store.commit('setSnackbarText', "Le sort a été mis à jour dans votre grimoire")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -39,6 +39,13 @@
</v-sheet>
</v-bottom-sheet>
<v-snackbar v-model="$store.state.isOpenSnackbar">
{{ $store.state.snackbarText }}
<v-btn color="red" text @click="$store.commit('setIsOpenSnackbar', true)">
Fermer
</v-btn>
</v-snackbar>
</v-app>
</template>