fix: dark mode
This commit is contained in:
parent
d8721a0785
commit
c366d571ef
2 changed files with 15 additions and 6 deletions
|
|
@ -89,10 +89,12 @@ async function marketConfig(path) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: async function () {
|
created: async function () {
|
||||||
|
console.log('### this.configData', this.configData)
|
||||||
console.log('### this.configUi', this.configUi)
|
console.log('### this.configUi', this.configUi)
|
||||||
if (this.configUi) {
|
if (this.configUi) {
|
||||||
this.configData = { ...this.configData, ...this.configUi }
|
this.configData = { ...this.configData, ...this.configUi, ui: { ...this.configData.ui, ...(this.configUi.ui || {}) } }
|
||||||
}
|
}
|
||||||
|
console.log('### this.configData', this.configData)
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -188,9 +188,7 @@ const market = async () => {
|
||||||
isValidAccountKey() {
|
isValidAccountKey() {
|
||||||
return isValidKey(this.accountDialog.data.key)
|
return isValidKey(this.accountDialog.data.key)
|
||||||
},
|
},
|
||||||
canEditConfig() {
|
|
||||||
return this.account && this.account.pubkey == this.config?.pubkey
|
|
||||||
},
|
|
||||||
|
|
||||||
allCartsItemCount() {
|
allCartsItemCount() {
|
||||||
return this.shoppingCarts.map(s => s.products).flat().reduce((t, p) => t + p.orderedQuantity, 0)
|
return this.shoppingCarts.map(s => s.products).flat().reduce((t, p) => t + p.orderedQuantity, 0)
|
||||||
|
|
@ -278,8 +276,10 @@ const market = async () => {
|
||||||
this.account = this.$q.localStorage.getItem('nostrmarket.account') || null
|
this.account = this.$q.localStorage.getItem('nostrmarket.account') || null
|
||||||
|
|
||||||
const uiConfig = this.$q.localStorage.getItem('nostrmarket.marketplace-config') || {}
|
const uiConfig = this.$q.localStorage.getItem('nostrmarket.marketplace-config') || {}
|
||||||
|
console.log('### uiConfig storage: ', uiConfig)
|
||||||
// trigger the `watch` logic
|
// trigger the `watch` logic
|
||||||
this.config = { ...this.config, opts: { ...this.config.opts, ...uiConfig } }
|
this.config = { ...this.config, opts: { ...this.config.opts, ...uiConfig } }
|
||||||
|
console.log('#### restoreFromStorage this.config', this.config)
|
||||||
this.applyUiConfigs(this.config)
|
this.applyUiConfigs(this.config)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -297,9 +297,16 @@ const market = async () => {
|
||||||
applyUiConfigs(config = {}) {
|
applyUiConfigs(config = {}) {
|
||||||
if (config.opts?.ui?.theme) {
|
if (config.opts?.ui?.theme) {
|
||||||
document.body.setAttribute('data-theme', this.config.opts.ui.theme)
|
document.body.setAttribute('data-theme', this.config.opts.ui.theme)
|
||||||
|
this.$q.localStorage.set('lnbits.theme', this.config.opts.ui.theme)
|
||||||
}
|
}
|
||||||
if (config.opts?.ui?.darkMode) {
|
const newDarkMode = config.opts?.ui?.darkMode
|
||||||
// tood
|
if (newDarkMode !== undefined) {
|
||||||
|
const oldDarkMode = this.$q.localStorage.getItem('lnbits.darkMode')
|
||||||
|
if (newDarkMode !== oldDarkMode) {
|
||||||
|
this.$q.dark.toggle()
|
||||||
|
this.$q.localStorage.set('lnbits.darkMode', newDarkMode)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue