final push for themes

This commit is contained in:
Tiago vasconcelos 2021-07-01 12:34:50 +01:00
parent 2cd6877645
commit 277460edb7
4 changed files with 20 additions and 14 deletions

View File

@ -15,8 +15,8 @@ LNBITS_SERVICE_FEE="0.0"
# Change theme
LNBITS_SITE_TITLE=LNbits
# Choose from mint, flamingo, quasar, autumn, monochrome
LNBITS_THEME_OPTIONS="mint, flamingo, quasar, autumn, monochrome, salvador"
# Choose from mint, flamingo, salvador, autumn, monochrome, classic
LNBITS_THEME_OPTIONS="mint, flamingo, classic, autumn, monochrome, salvador"
# Choose from LNPayWallet, OpenNodeWallet, LntxbotWallet, LndWallet (gRPC),
# LndRestWallet, CLightningWallet, LNbitsWallet, SparkWallet

View File

@ -31,7 +31,7 @@ LNBITS_DISABLED_EXTENSIONS: List[str] = env.list(
)
LNBITS_SITE_TITLE = env.str("LNBITS_SITE_TITLE", default="LNbits")
LNBITS_THEME_OPTIONS: List[str] = env.list("LNBITS_THEME_OPTIONS", default="classic,green,orange", subcast=str)
LNBITS_THEME_OPTIONS: List[str] = env.list("LNBITS_THEME_OPTIONS", default="classic, flamingo, mint, salvador, monochrome, autumn", subcast=str)
WALLET = wallet_class()
DEFAULT_WALLET_NAME = env.str("LNBITS_DEFAULT_WALLET_NAME", default="LNbits wallet")

View File

@ -334,18 +334,24 @@ window.windowMixin = {
},
created: function () {
this.$q.dark.set(this.$q.localStorage.getItem('lnbits.darkMode'))
this.g.allowedThemes = window.allowedThemes
let theme = this.$q.localStorage.getItem('lnbits.theme')
this.g.allowedThemes = window.allowedThemes ?? ['classic']
// failsafe if admin changes themes halfway
if (theme && !this.g.allowedThemes.includes(theme)) {
if (
this.$q.localStorage.getItem('lnbits.theme') &&
!this.g.allowedThemes.includes(
this.$q.localStorage.getItem('lnbits.theme')
)
) {
console.log('allowedThemes changed by Admin', this.g.allowedThemes[0])
this.changeColor(this.g.allowedThemes[0] || 'classic')
this.changeColor(this.g.allowedThemes[0])
}
if (theme) {
document.body.setAttribute('data-theme', theme)
if (this.$q.localStorage.getItem('lnbits.theme')) {
document.body.setAttribute(
'data-theme',
this.$q.localStorage.getItem('lnbits.theme')
)
}
if (window.user) {

View File

@ -39,7 +39,7 @@
<strong>LN</strong>bits {% endif %} {% endblock %}
</q-toolbar-title>
{% block beta %}
<q-badge color="yellow" text-color="black">
<q-badge color="yellow" text-color="black" class="q-mr-md">
<span
><span v-show="$q.screen.gt.sm"
>USE WITH CAUTION - LNbits wallet is still in </span
@ -86,7 +86,7 @@
><q-tooltip>autumn</q-tooltip>
</q-btn>
<q-btn
v-if="g.allowedThemes.includes('flamingo')"
v-if="g.allowedThemes.includes('monochrome')"
dense
flat
@click="changeColor('monochrome')"
@ -96,7 +96,7 @@
><q-tooltip>monochrome</q-tooltip>
</q-btn>
<q-btn
v-if="g.allowedThemes.includes('monochrome')"
v-if="g.allowedThemes.includes('salvador')"
dense
flat
@click="changeColor('salvador')"
@ -106,7 +106,7 @@
><q-tooltip>elSalvador</q-tooltip>
</q-btn>
<q-btn
v-if="g.allowedThemes.includes('quasar')"
v-if="g.allowedThemes.includes('flamingo')"
dense
flat
@click="changeColor('flamingo')"