feature: Optional bg image and neon borders (#2897)

* init

* working
This commit is contained in:
Arc
2025-01-18 19:27:50 +00:00
committed by GitHub
parent c7ebe09463
commit 8a759c8fc1
5 changed files with 73 additions and 3 deletions

View File

@@ -424,6 +424,22 @@
</q-btn> </q-btn>
</div> </div>
</div> </div>
<div class="row q-mb-md">
<div class="col-4">
<span v-text="$t('background_image')"></span>
</div>
<div class="col-8">
<q-input
v-model="backgroundImage"
:label="$t('background_image')"
@update:model-value="backgroundImageFunc"
>
<q-tooltip
><span v-text="$t('background_image')"></span
></q-tooltip>
</q-input>
</div>
</div>
<div class="row q-mb-md"> <div class="row q-mb-md">
<div class="col-4"> <div class="col-4">
<span v-text="$t('gradient_background')"></span> <span v-text="$t('gradient_background')"></span>

File diff suppressed because one or more lines are too long

View File

@@ -255,6 +255,7 @@ window.localisation.en = {
invalid_username: 'Invalid Username', invalid_username: 'Invalid Username',
auth_provider: 'Auth Provider', auth_provider: 'Auth Provider',
my_account: 'My Account', my_account: 'My Account',
background_image: 'Background Image',
back: 'Back', back: 'Back',
logout: 'Logout', logout: 'Logout',
look_and_feel: 'Look and Feel', look_and_feel: 'Look and Feel',

View File

@@ -12,7 +12,12 @@ window.AccountPageLogic = {
'confettiStars', 'confettiStars',
'confettiTop' 'confettiTop'
], ],
borderOptions: ['retro-border', 'hard-border', 'no-border'], borderOptions: [
'retro-border',
'hard-border',
'neon-border',
'no-border'
],
tab: 'user', tab: 'user',
credentialsData: { credentialsData: {
show: false, show: false,
@@ -96,6 +101,8 @@ window.AccountPageLogic = {
toggleGradient() { toggleGradient() {
this.gradientChoice = !this.gradientChoice this.gradientChoice = !this.gradientChoice
this.applyGradient() this.applyGradient()
this.$q.localStorage.set('lnbits.backgroundImage', '')
this.applyBorder()
if (!this.gradientChoice) { if (!this.gradientChoice) {
window.location.reload() window.location.reload()
} }
@@ -103,13 +110,21 @@ window.AccountPageLogic = {
reactionChoiceFunc() { reactionChoiceFunc() {
this.$q.localStorage.set('lnbits.reactions', this.reactionChoice) this.$q.localStorage.set('lnbits.reactions', this.reactionChoice)
}, },
backgroundImageFunc() {
this.$q.localStorage.set('lnbits.backgroundImage', this.backgroundImage)
this.applyBackgroundImage()
},
changeColor(newValue) { changeColor(newValue) {
document.body.setAttribute('data-theme', newValue) document.body.setAttribute('data-theme', newValue)
this.$q.localStorage.set('lnbits.theme', newValue) this.$q.localStorage.set('lnbits.theme', newValue)
this.setColors() this.setColors()
this.applyBorder()
if (this.$q.localStorage.getItem('lnbits.gradientBg')) { if (this.$q.localStorage.getItem('lnbits.gradientBg')) {
this.applyGradient() this.applyGradient()
} }
if (this.$q.localStorage.getItem('lnbits.backgroundImage')) {
this.applyBackgroundImage()
}
}, },
async updateAccount() { async updateAccount() {
try { try {

View File

@@ -466,7 +466,8 @@ window.windowMixin = {
gradientChoice: gradientChoice:
this.$q.localStorage.getItem('lnbits.gradientBg') || false, this.$q.localStorage.getItem('lnbits.gradientBg') || false,
isUserAuthorized: false, isUserAuthorized: false,
eventListeners: [] eventListeners: [],
backgroundImage: ''
} }
}, },
@@ -566,6 +567,39 @@ window.windowMixin = {
this.toggleDarkMode() this.toggleDarkMode()
} }
}, },
applyBackgroundImage() {
if (this.backgroundImage) {
this.$q.localStorage.set('lnbits.backgroundImage', this.backgroundImage)
this.gradientChoice = true
this.applyGradient()
}
let bgImage = this.$q.localStorage.getItem('lnbits.backgroundImage')
if (bgImage) {
this.backgroundImage = bgImage
const style = document.createElement('style')
style.innerHTML = `
body[data-theme="${this.$q.localStorage.getItem('lnbits.theme')}"]::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url(${bgImage});
background-size: cover;
filter: blur(8px);
z-index: -1;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
body[data-theme="${this.$q.localStorage.getItem('lnbits.theme')}"] .q-page-container {
backdrop-filter: none; /* Ensure the page content is not affected */
}`
document.head.appendChild(style)
}
},
applyBorder() { applyBorder() {
if (this.borderChoice) { if (this.borderChoice) {
this.$q.localStorage.setItem('lnbits.border', this.borderChoice) this.$q.localStorage.setItem('lnbits.border', this.borderChoice)
@@ -580,6 +614,9 @@ window.windowMixin = {
if (borderStyle == 'hard-border') { if (borderStyle == 'hard-border') {
borderStyleCSS = `box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 0 0 1px #ffffff47; border: none;` borderStyleCSS = `box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 0 0 1px #ffffff47; border: none;`
} }
if (borderStyle == 'neon-border') {
borderStyleCSS = `border: 2px solid ${this.$q.localStorage.getItem('lnbits.primaryColor')}; box-shadow: none;`
}
if (borderStyle == 'no-border') { if (borderStyle == 'no-border') {
borderStyleCSS = `box-shadow: none; border: none;` borderStyleCSS = `box-shadow: none; border: none;`
} }
@@ -771,6 +808,7 @@ window.windowMixin = {
) )
} }
this.applyGradient() this.applyGradient()
this.applyBackgroundImage()
this.applyBorder() this.applyBorder()
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))