feat: allow clearing background image (#1290)

Co-authored-by: Kyle Mendell <kmendell@ofkm.us>
Co-authored-by: Kyle Mendell <ksm@ofkm.us>
This commit is contained in:
taoso
2026-03-09 03:45:04 +08:00
committed by GitHub
parent f90f21b620
commit 192f71a13c
5 changed files with 74 additions and 20 deletions

View File

@@ -44,7 +44,7 @@
logoDark: File | undefined,
logoEmail: File | undefined,
defaultProfilePicture: File | null | undefined,
backgroundImage: File | undefined,
backgroundImage: File | null | undefined,
favicon: File | undefined
) {
const faviconPromise = favicon ? appConfigService.updateFavicon(favicon) : Promise.resolve();
@@ -68,9 +68,12 @@
? appConfigService.updateDefaultProfilePicture(defaultProfilePicture)
: Promise.resolve();
const backgroundImagePromise = backgroundImage
? appConfigService.updateBackgroundImage(backgroundImage)
: Promise.resolve();
const backgroundImagePromise =
backgroundImage === null
? appConfigService.deleteBackgroundImage()
: backgroundImage
? appConfigService.updateBackgroundImage(backgroundImage)
: Promise.resolve();
await Promise.all([
lightLogoPromise,

View File

@@ -17,7 +17,7 @@
logoDark: File | undefined,
logoEmail: File | undefined,
defaultProfilePicture: File | null | undefined,
backgroundImage: File | undefined,
backgroundImage: File | null | undefined,
favicon: File | undefined
) => void;
} = $props();
@@ -26,10 +26,11 @@
let logoDark = $state<File | undefined>();
let logoEmail = $state<File | undefined>();
let defaultProfilePicture = $state<File | null | undefined>();
let backgroundImage = $state<File | undefined>();
let backgroundImage = $state<File | null | undefined>();
let favicon = $state<File | undefined>();
let defaultProfilePictureSet = $state(true);
let backgroundImageSet = $state(true);
</script>
<div class="flex flex-col gap-8">
@@ -77,10 +78,12 @@
/>
<ApplicationImage
id="background-image"
imageClass="h-[350px] max-w-[500px]"
imageClass="max-h-[350px] max-w-[500px]"
label={m.background_image()}
isResetable
bind:image={backgroundImage}
imageURL={cachedBackgroundImage.getUrl()}
isImageSet={backgroundImageSet}
/>
</div>
<div class="flex justify-end">