[UI] Keep track of the number of stack modals.

This commit is contained in:
Fabio Manganiello 2024-09-22 01:40:52 +02:00
parent 6dd1d481d5
commit 0d0665ca7c
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -56,6 +56,7 @@ export default {
pwaInstallEvent: null, pwaInstallEvent: null,
initialized: false, initialized: false,
initError: null, initError: null,
stackedModals: 0,
} }
}, },
@ -83,7 +84,7 @@ export default {
methods: { methods: {
onNotification(notification) { onNotification(notification) {
this.$refs.notifications.create(notification) this.$refs.notifications?.create(notification)
}, },
async initConfig() { async initConfig() {
@ -100,7 +101,15 @@ export default {
this.pwaInstallEvent.prompt() this.pwaInstallEvent.prompt()
this.$refs.pwaDialog.close() this.$refs.pwaDialog.close()
} },
onModalClose() {
this.stackedModals = Math.max(0, this.stackedModals - 1)
},
onModalOpen() {
this.stackedModals++
},
}, },
async created() { async created() {
@ -136,6 +145,8 @@ export default {
bus.onNotification(this.onNotification) bus.onNotification(this.onNotification)
bus.on('connect', () => this.connected = true) bus.on('connect', () => this.connected = true)
bus.on('disconnect', () => this.connected = false) bus.on('disconnect', () => this.connected = false)
bus.on('modal-open', this.onModalOpen)
bus.on('modal-close', this.onModalClose)
}, },
} }
</script> </script>