refactor: move walletTypes from mixin into lnbits-new-user-wallet (#3519)

This commit is contained in:
dni ⚡ 2025-11-13 13:29:43 +01:00 committed by GitHub
parent 00eaec8290
commit f1fc4710ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 20 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -4,6 +4,7 @@ window.app.component('lnbits-new-user-wallet', {
mixins: [window.windowMixin], mixins: [window.windowMixin],
data() { data() {
return { return {
walletTypes: [{label: 'Lightning Wallet', value: 'lightning'}],
newWallet: {walletType: 'lightning', name: '', sharedWalletId: ''} newWallet: {walletType: 'lightning', name: '', sharedWalletId: ''}
} }
}, },
@ -70,5 +71,13 @@ window.app.component('lnbits-new-user-wallet', {
LNbits.utils.notifyApiError(e) LNbits.utils.notifyApiError(e)
} }
} }
},
created() {
if (this.g.user?.extra?.wallet_invite_requests?.length) {
this.walletTypes.push({
label: `Lightning Wallet (Share Invite: ${this.g.user.extra.wallet_invite_requests.length})`,
value: 'lightning-shared'
})
}
} }
}) })

View file

@ -50,3 +50,13 @@ const websocketPrefix =
const websocketUrl = `${websocketPrefix}${window.location.host}/api/v1/ws` const websocketUrl = `${websocketPrefix}${window.location.host}/api/v1/ws`
const _access_cookies_for_safari_refresh_do_not_delete = document.cookie const _access_cookies_for_safari_refresh_do_not_delete = document.cookie
addEventListener('offline', event => {
console.log('offline', event)
this.g.offline = true
})
addEventListener('online', event => {
console.log('back online', event)
this.g.offline = false
})

View file

@ -7,7 +7,6 @@ window.windowMixin = {
g: window.g, g: window.g,
toggleSubs: true, toggleSubs: true,
addWalletDialog: {show: false, walletType: 'lightning'}, addWalletDialog: {show: false, walletType: 'lightning'},
walletTypes: [{label: 'Lightning Wallet', value: 'lightning'}],
isSatsDenomination: WINDOW_SETTINGS['LNBITS_DENOMINATION'] == 'sats', isSatsDenomination: WINDOW_SETTINGS['LNBITS_DENOMINATION'] == 'sats',
allowedThemes: WINDOW_SETTINGS['LNBITS_THEME_OPTIONS'], allowedThemes: WINDOW_SETTINGS['LNBITS_THEME_OPTIONS'],
walletEventListeners: [], walletEventListeners: [],
@ -125,26 +124,9 @@ window.windowMixin = {
} }
}, },
async created() { async created() {
addEventListener('offline', event => {
console.log('offline', event)
this.g.offline = true
})
addEventListener('online', event => {
console.log('back online', event)
this.g.offline = false
})
if (window.user) { if (window.user) {
this.g.user = Vue.reactive(window.LNbits.map.user(window.user)) this.g.user = Vue.reactive(window.LNbits.map.user(window.user))
} }
if (this.g.user?.extra?.wallet_invite_requests?.length) {
this.walletTypes.push({
label: `Lightning Wallet (Share Invite: ${this.g.user.extra.wallet_invite_requests.length})`,
value: 'lightning-shared'
})
}
if (window.wallet) { if (window.wallet) {
this.g.wallet = Vue.reactive(window.LNbits.map.wallet(window.wallet)) this.g.wallet = Vue.reactive(window.LNbits.map.wallet(window.wallet))
} }