Merge remote-tracking branch 'origin/develop' into admin-tabs-2

This commit is contained in:
Henry Jameson 2025-12-01 18:52:04 +02:00
commit 388ecd9a5e
3 changed files with 165 additions and 60 deletions

View file

@ -236,6 +236,10 @@ const AppearanceTab = {
noIntersectionObserver () { noIntersectionObserver () {
return !window.IntersectionObserver return !window.IntersectionObserver
}, },
instanceWallpaper () {
console.log(this.$store.state.instance.background)
this.$store.state.instance.background
},
instanceWallpaperUsed () { instanceWallpaperUsed () {
return this.$store.state.instance.background && return this.$store.state.instance.background &&
!this.$store.state.users.currentUser.background_image !this.$store.state.users.currentUser.background_image
@ -411,6 +415,9 @@ const AppearanceTab = {
this.submitBackground('') this.submitBackground('')
} }
}, },
resetUploadedBackground () {
this.backgroundPreview = null
},
submitBackground (background) { submitBackground (background) {
if (!this.backgroundPreview && background !== '') { return } if (!this.backgroundPreview && background !== '') { return }

View file

@ -18,7 +18,31 @@
height: auto; height: auto;
} }
.banner-background {
display: flex;
gap: 1em;
flex-wrap: wrap;
h4 {
margin: 0;
}
}
.banner-background-input {
flex: 1;
display: flex;
flex-direction: column;
gap: 0.5em;
.custom-bg-control {
display: grid;
gap: 0.5em;
grid-template-columns: 1fr 1fr;
}
}
.banner-background-preview { .banner-background-preview {
display: flex;
max-width: 100%; max-width: 100%;
width: 300px; width: 300px;
position: relative; position: relative;
@ -26,33 +50,86 @@
img { img {
width: 100%; width: 100%;
} }
}
.reset-button { .fun-monitor {
position: absolute; position: relative;
top: 0.2em; pointer-events: none;
right: 0.2em; display: flex;
border-radius: var(--roundness); flex-direction: column;
background-color: rgb(0 0 0 / 60%); align-items: center;
opacity: 0.7;
width: 1.5em;
height: 1.5em;
text-align: center;
line-height: 1.5em;
font-size: 1.5em;
cursor: pointer;
&:hover { * {
opacity: 1; line-height: 1;
} }
svg { &-display-bezel,
color: white; &-display-screen {
aspect-ratio: 16 / 9;
width: 16em;
}
img {
object-fit: cover;
}
.wallpaper {
position: absolute;
inset: 0;
background-color: var(--wallpaper);
}
&-display-uploading {
position: absolute;
inset: 0;
z-index: 1;
display: flex;
place-items: center;
place-content: center;
background-color: rgb(0 0 0 / 60%);
font-size: 4em;
}
&-display-screen {
padding: 0;
overflow: hidden;
position: relative;
&-overlay {
background: transparent;
position: absolute;
inset: 0;
z-index: 2;
}
&-image {
aspect-ratio: 16 / 9
}
}
&-display-bezel {
padding: 1em;
margin: 0;
order: 1;
z-index: 3;
}
&-neck {
width: 5em;
height: 3em;
margin-top: -1em;
margin-bottom: -0.5em;
order: 2
}
&-stand {
width: 8em;
height: 1em;
order: 3;
z-index: 1
}
} }
} }
.palettes-container { .palettes-container {
height: 15em; height: 15em;
overflow: hidden auto; overflow: hidden auto;

View file

@ -154,46 +154,67 @@
</div> </div>
</div> </div>
<h3>{{ $t('settings.background') }}</h3> <h3>{{ $t('settings.background') }}</h3>
<div class="banner-background-preview"> <div class="banner-background">
<img :src="user.background_image"> <div class="banner-background-preview">
<button <div class="fun-monitor">
v-if="!isDefaultBackground" <div class="fun-monitor-stand button-default" />
class="button-unstyled reset-button" <div class="fun-monitor-neck button-default" />
:title="$t('settings.reset_profile_background')" <div class="fun-monitor-display-bezel button-default">
@click="resetBackground" <div class="fun-monitor-display-screen input">
> <img
<FAIcon v-if="backgroundPreview || user.background_image || instanceWallpaper"
icon="times" class="fun-monitor-display-screen-image"
type="button" :src="backgroundPreview || user.background_image || instanceWallpaper"
/> />
</button> <div v-else class="wallpaper" />
<div class="fun-monitor-display-screen-overlay input" />
<div
v-if="backgroundUploading"
class="fun-monitor-display-uploading"
>
<FAIcon
class="fun-monitor-display-screen-uploading"
spin
icon="circle-notch"
/>
</div>
</div>
</div>
</div>
</div>
<div class="banner-background-input">
<h4>{{ $t('settings.set_new_background') }}</h4>
<input
type="file"
class="input"
@change="uploadFile('background', $event)"
>
<div class="custom-bg-control">
<button
:disabled="!backgroundPreview"
class="btn button-default"
@click="submitBackground(background)"
>
{{ $t('settings.save') }}
</button>
<button
:disabled="!backgroundPreview"
class="btn button-default"
@click="resetUploadedBackground"
>
{{ $t('settings.reset') }}
</button>
</div>
<button
v-if="!isDefaultBackground"
class="btn button-default reset-button"
:title="$t('settings.reset_profile_background')"
@click="resetBackground"
>
{{ $t('settings.reset_profile_background') }}
</button>
</div>
</div> </div>
<p>{{ $t('settings.set_new_background') }}</p>
<img
v-if="backgroundPreview"
class="banner-background-preview"
:src="backgroundPreview"
>
<div>
<input
type="file"
class="input"
@change="uploadFile('background', $event)"
>
</div>
<FAIcon
v-if="backgroundUploading"
class="uploading"
spin
icon="circle-notch"
/>
<button
v-else-if="backgroundPreview"
class="btn button-default"
@click="submitBackground(background)"
>
{{ $t('settings.save') }}
</button>
<h3>{{ $t('settings.visual_tweaks') }}</h3> <h3>{{ $t('settings.visual_tweaks') }}</h3>
<div class="alert neutral theme-notice"> <div class="alert neutral theme-notice">
{{ $t("settings.style.visual_tweaks_section_note") }} {{ $t("settings.style.visual_tweaks_section_note") }}