Skip to content

An open-source, self-hosted system for apps built with web technologies.

Add themed bundled wallpapers

zohayrslileh04216e43904f
diff --git a/assets/bundled/dark-wallpaper.png b/assets/bundled/dark-wallpaper.png
new file mode 100644
index 0000000..d847b30
Binary files /dev/null and b/assets/bundled/dark-wallpaper.png differ
diff --git a/assets/bundled/light-wallpaper.png b/assets/bundled/light-wallpaper.png
new file mode 100644
index 0000000..25c705c
Binary files /dev/null and b/assets/bundled/light-wallpaper.png differ
diff --git a/assets/bundled/wallpaper.jpg b/assets/bundled/wallpaper.jpg
deleted file mode 100644
index fe10736..0000000
Binary files a/assets/bundled/wallpaper.jpg and /dev/null differ
diff --git a/source/client/view/structure/desktop/wallpaper/wallpaper.tsx b/source/client/view/structure/desktop/wallpaper/wallpaper.tsx
index 875d9e7..c1f38ca 100644
--- a/source/client/view/structure/desktop/wallpaper/wallpaper.tsx
+++ b/source/client/view/structure/desktop/wallpaper/wallpaper.tsx
@@ -1,8 +1,10 @@
-import bundledWallpaper from "@/assets/bundled/wallpaper.jpg"
+import darkWallpaper from "@/assets/bundled/dark-wallpaper.png"
+import lightWallpaper from "@/assets/bundled/light-wallpaper.png"
import { ApplicationContext } from "../../../contexts"
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react"
import Loading from "../../../components/loading"
import { useReady } from "@libs/readiness/main"
+import { useTheme } from "@phreshos/react-ui"
type WallpaperSource = Readonly<{
key: string
@@ -12,22 +14,28 @@ type WallpaperSource = Readonly<{
/**
* Displays only a completely loaded wallpaper source.
*
- * A filename asks for a served image and `null` selects the bundled wallpaper.
- * The previous loaded source stays visible until its replacement is ready.
+ * A filename asks for a served image and `null` selects the effective Theme's
+ * bundled wallpaper. The previous loaded source stays visible until its
+ * replacement is ready.
*/
export function WallpaperBackground({ file, onReady }: WallpaperBackgroundProps) {
const application = ApplicationContext.useValue()
+ const theme = useTheme()
+
const desired = useMemo<WallpaperSource>(() => {
return file === null
- ? { key: "bundled", source: bundledWallpaper }
+ ? {
+ key: `bundled:${theme}`,
+ source: theme === "dark" ? darkWallpaper : lightWallpaper
+ }
: {
key: `file:${file}`,
source: `${application.doors.uploads}/${encodeURIComponent(file)}`
}
- }, [application.doors.uploads, file])
+ }, [application.doors.uploads, file, theme])
const [displayed, setDisplayed] = useState<WallpaperSource | null>(null)
const [previous, setPrevious] = useState<WallpaperSource | null>(null)