add offline indicator
This commit is contained in:
parent
d88ffeb237
commit
b298e12cd3
2 changed files with 15 additions and 1 deletions
|
|
@ -315,6 +315,7 @@ window.windowMixin = {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
g: {
|
g: {
|
||||||
|
offline: !navigator.onLine,
|
||||||
visibleDrawer: false,
|
visibleDrawer: false,
|
||||||
extensions: [],
|
extensions: [],
|
||||||
user: null,
|
user: null,
|
||||||
|
|
@ -354,6 +355,14 @@ window.windowMixin = {
|
||||||
}
|
}
|
||||||
this.g.allowedThemes = window.allowedThemes ?? ['bitcoin']
|
this.g.allowedThemes = window.allowedThemes ?? ['bitcoin']
|
||||||
|
|
||||||
|
addEventListener('offline', event => {
|
||||||
|
this.g.offline = true
|
||||||
|
})
|
||||||
|
|
||||||
|
addEventListener('online', event => {
|
||||||
|
this.g.offline = false
|
||||||
|
})
|
||||||
|
|
||||||
// failsafe if admin changes themes halfway
|
// failsafe if admin changes themes halfway
|
||||||
if (!this.$q.localStorage.getItem('lnbits.theme')){
|
if (!this.$q.localStorage.getItem('lnbits.theme')){
|
||||||
this.changeColor(this.g.allowedThemes[0])
|
this.changeColor(this.g.allowedThemes[0])
|
||||||
|
|
@ -432,4 +441,4 @@ window.decryptLnurlPayAES = function (success_action, preimage) {
|
||||||
let decoder = new TextDecoder('utf-8')
|
let decoder = new TextDecoder('utf-8')
|
||||||
return decoder.decode(valueb)
|
return decoder.decode(valueb)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -51,6 +51,11 @@
|
||||||
>
|
>
|
||||||
</q-badge>
|
</q-badge>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
<q-badge v-if="g.offline" color="red" text-color="white" class="q-mr-md">
|
||||||
|
<span>
|
||||||
|
OFFLINE
|
||||||
|
</span>
|
||||||
|
</q-badge>
|
||||||
<q-btn-dropdown
|
<q-btn-dropdown
|
||||||
v-if="g.allowedThemes && g.allowedThemes.length > 1"
|
v-if="g.allowedThemes && g.allowedThemes.length > 1"
|
||||||
dense
|
dense
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue