1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-30 13:14:20 +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, isThemeDark: false,
isOpenAboutDialog: false, isOpenAboutDialog: false,
isOpenSupportDialog: false, isOpenSupportDialog: false,
isOpenSnackbar: false,
snackbarText: ''
}, },
getters: { getters: {
@ -43,6 +45,7 @@ export default new Vuex.Store({
isThemeDark: state => state.isThemeDark, isThemeDark: state => state.isThemeDark,
isOpenAboutDialog: state => state.isOpenAboutDialog, isOpenAboutDialog: state => state.isOpenAboutDialog,
isOpenSupportDialog: state => state.isOpenSupportDialog, isOpenSupportDialog: state => state.isOpenSupportDialog,
isOpenSnackbar: state => state.isOpenSnackbar,
}, },
actions: { actions: {
@ -70,6 +73,12 @@ export default new Vuex.Store({
isOpenSupportDialog: ({ commit }, payload) => { isOpenSupportDialog: ({ commit }, payload) => {
commit('setIsOpenSupportDialog', payload) commit('setIsOpenSupportDialog', payload)
}, },
isOpenSnackbar: ({ commit }, payload) => {
commit('setIsOpenSnackbar', payload)
},
snackbarText: ({ commit }, payload) => {
commit('setSnackbarText', payload)
},
}, },
mutations: { mutations: {
@ -99,5 +108,16 @@ export default new Vuex.Store({
setIsOpenSupportDialog: (state, payload) => { setIsOpenSupportDialog: (state, payload) => {
state.isOpenSupportDialog = 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 () { updateMagicItemInTreasureChest () {
if (this.isMagicItemInTreasureChest) { if (this.isMagicItemInTreasureChest) {
this.$store.commit('myMagicItems/updateMagicItem', this.magicItem) 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 () { updateMonsterInBestiary () {
if (this.isMonsterInBestiary) { if (this.isMonsterInBestiary) {
this.$store.commit('myMonsters/updateMonster', this.monster) 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 () { updateSpellInSpellBook () {
if (this.isSpellInSpellBook) { if (this.isSpellInSpellBook) {
this.$store.commit('mySpells/updateSpell', this.spell) 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-sheet>
</v-bottom-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> </v-app>
</template> </template>