chore: refactor windowMixin, init-app.js, lnbits-theme (#3569)

This commit is contained in:
dni ⚡
2025-11-25 14:31:17 +01:00
committed by GitHub
parent 0910687328
commit 7a796c6510
8 changed files with 30 additions and 36 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -1,6 +1,12 @@
window.app.component('lnbits-theme', { window.app.component('lnbits-theme', {
mixins: [window.windowMixin], mixins: [window.windowMixin],
watch: { watch: {
'g.walletFlip'(val) {
this.$q.localStorage.setItem('lnbits.walletFlip', val)
if (val === true && this.$q.screen.lt.md) {
this.g.visibleDrawer = false
}
},
'g.disclaimerShown'(val) { 'g.disclaimerShown'(val) {
this.$q.localStorage.setItem('lnbits.disclaimerShown', val) this.$q.localStorage.setItem('lnbits.disclaimerShown', val)
}, },
+15 -15
View File
@@ -1,3 +1,11 @@
const quasarConfig = {
config: {
loading: {
spinner: Quasar.QSpinnerBars
}
}
}
const routes = [ const routes = [
{ {
path: '/node', path: '/node',
@@ -71,6 +79,12 @@ window.router = VueRouter.createRouter({
routes routes
}) })
window.i18n = new VueI18n.createI18n({
locale: window.g.locale,
fallbackLocale: 'en',
messages: window.localisation
})
window.app.mixin({ window.app.mixin({
computed: { computed: {
isVueRoute() { isVueRoute() {
@@ -83,22 +97,8 @@ window.app.mixin({
}) })
window.app.use(VueQrcodeReader) window.app.use(VueQrcodeReader)
window.app.use(Quasar, { window.app.use(Quasar, quasarConfig)
config: {
loading: {
spinner: Quasar.QSpinnerBars
}
}
})
window.i18n = new VueI18n.createI18n({
locale: window.g.locale,
fallbackLocale: 'en',
messages: window.localisation
})
window.app.use(window.i18n) window.app.use(window.i18n)
window.app.provide('g', g)
window.app.use(window.router) window.app.use(window.router)
window.app.mount('#vue') window.app.mount('#vue')
-15
View File
@@ -2,10 +2,7 @@ window.windowMixin = {
i18n: window.i18n, i18n: window.i18n,
data() { data() {
return { return {
api: window._lnbitsApi,
utils: window._lnbitsUtils,
g: window.g, g: window.g,
currencies: window.currencies,
...WINDOW_SETTINGS ...WINDOW_SETTINGS
} }
}, },
@@ -14,18 +11,6 @@ window.windowMixin = {
this.g.newWalletType = walletType this.g.newWalletType = walletType
this.g.showNewWalletDialog = true this.g.showNewWalletDialog = true
}, },
flipWallets(smallScreen) {
this.g.walletFlip = !this.g.walletFlip
if (this.g.walletFlip && smallScreen) {
this.g.visibleDrawer = false
}
this.$q.localStorage.set('lnbits.walletFlip', this.g.walletFlip)
},
goToWallets() {
this.$router.push({
path: '/wallets'
})
},
paymentEvents() { paymentEvents() {
this.g.walletEventListeners = this.g.walletEventListeners || [] this.g.walletEventListeners = this.g.walletEventListeners || []
this.g.user.wallets.forEach(wallet => { this.g.user.wallets.forEach(wallet => {
@@ -8,7 +8,10 @@
> >
<q-scroll-area style="height: 100%"> <q-scroll-area style="height: 100%">
<q-item> <q-item>
<q-item-section class="cursor-pointer" @click="goToWallets()"> <q-item-section
class="cursor-pointer"
@click="$router.push('/wallets')"
>
<q-item-label <q-item-label
:style="$q.dark.isActive ? 'color:rgba(255, 255, 255, 0.64)' : ''" :style="$q.dark.isActive ? 'color:rgba(255, 255, 255, 0.64)' : ''"
class="q-item__label q-item__label--header q-pa-none" class="q-item__label q-item__label--header q-pa-none"
@@ -22,7 +25,7 @@
:icon="g.walletFlip ? 'view_list' : 'view_column'" :icon="g.walletFlip ? 'view_list' : 'view_column'"
color="grey" color="grey"
class="" class=""
@click="flipWallets($q.screen.lt.md)" @click="g.walletFlip = !g.walletFlip"
> >
<q-tooltip <q-tooltip
><span ><span
@@ -97,7 +97,7 @@
round round
color="primary" color="primary"
icon="more_horiz" icon="more_horiz"
@click="goToWallets()" @click="$router.push('/wallets')"
> >
<q-tooltip <q-tooltip
><span ><span
@@ -54,7 +54,7 @@
<q-item <q-item
v-if="g.user.hiddenWalletsCount > 0" v-if="g.user.hiddenWalletsCount > 0"
clickable clickable
@click="goToWallets()" @click="$router.push('/wallets')"
> >
<q-item-section side> <q-item-section side>
<q-icon name="more_horiz" color="grey-5" size="md"></q-icon> <q-icon name="more_horiz" color="grey-5" size="md"></q-icon>