Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(wallpaper): two plain grounds, black and white, shipped inside the app

Harald7d19369fbe83
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94913ae594..627534ad1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -114,6 +114,14 @@ versioning per [SemVer](https://semver.org/).
- The UI's skill-creator dialog and `jarvis skills draft` see the same live
tool inventory now, so their drafts name real connectors too; `draft` gained
`--trigger`, `--schedule`, `--language`.
+- **Two plain wallpapers: black and white.** The Wallpaper section now opens
+ with four pictures that ship inside the app — the night original, its
+ daylight twin, pure black and pure white — under two chips, "Original" and
+ "Plain". Black is a dark wallpaper, white a light one, so adopting either
+ switches the mode along with the ground like every other tile; "Default"
+ still returns to the original of the mode you are in. The plain grounds are
+ drawn, not downloaded — no file, no request, present on a machine with no
+ library, no uploads and no backend.
### Fixed
diff --git a/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.test.tsx b/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.test.tsx
index 29ddca0ae2..f08c8bef34 100644
--- a/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.test.tsx
+++ b/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.test.tsx
@@ -94,6 +94,20 @@ describe("useDesktopWallpaper", () => {
);
});
+ it("paints a plain ground straight from the bundle, no request to the API", async () => {
+ act(() => useWallpaperStore.getState().select("plain-white", "light"));
+
+ render(<Probe />);
+ // A drawn colour: the URL is the image, so nothing is fetched from /api/.
+ expect(pending[0]?.src.startsWith("data:image/svg+xml,")).toBe(true);
+ act(() => pending[0]?.onload?.(new Event("load") as never));
+
+ await waitFor(() =>
+ expect(screen.getByTestId("url").textContent?.startsWith("data:image/svg+xml,")).toBe(true),
+ );
+ expect(screen.getByTestId("url").textContent).toContain(encodeURIComponent("#ffffff"));
+ });
+
it("falls back to the mode's bundled wallpaper when the library is missing", async () => {
useWallpaperStore.setState({
selections: { light: "03-anime-neon-01", dark: null },
diff --git a/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.ts b/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.ts
index bfec4e6d0b..47e05a41ef 100644
--- a/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.ts
@@ -1,32 +1,14 @@
import { useEffect, useState } from "react";
-import jarvisDesktopWallpaperLight from "@/assets/jarvis-desktop-wallpaper-light.webp";
-import jarvisDesktopWallpaper from "@/assets/jarvis-desktop-wallpaper.webp";
-import { useThemeValue, type Theme } from "@/hooks/useTheme";
+import { useThemeValue } from "@/hooks/useTheme";
+import { DEFAULT_WALLPAPER_URLS, defaultWallpaperUrl } from "@/lib/bundledWallpapers";
import { useWallpaperStore, wallpaperFullUrl } from "@/store/wallpaper";
-/**
- * The artwork that ships inside the bundle — one picture per mode, each the
- * default and the fallback of its own mode.
- *
- * Two, not one, because a wallpaper belongs to exactly one mode (see
- * store/wallpaper.ts): the moonlit woodblock ocean is a night scene, and for
- * as long as it stood in for BOTH modes, light chrome landed on it whenever the
- * light slot was empty — a fresh profile, a cleared store, a manual switch to
- * light before any light picture was chosen — and nothing on that screen could
- * be read (maintainer report 2026-08-18). The daylight courtyard is the same
- * character in the light mode's own register, so a mode without a pick of its
- * own now shows a picture authored for it, never the other mode's.
- */
-export const DEFAULT_WALLPAPER_URLS: Readonly<Record<Theme, string>> = {
- dark: jarvisDesktopWallpaper,
- light: jarvisDesktopWallpaperLight,
-};
-
-/** The bundled artwork of one mode. */
-export function defaultWallpaperUrl(theme: Theme): string {
- return DEFAULT_WALLPAPER_URLS[theme];
-}
+// The bundled artwork itself — one picture per mode, each the default and the
+// fallback of its own mode — is defined once in lib/bundledWallpapers, next to
+// the other pictures that ship inside the app. Re-exported here because this
+// hook is where the shell has always asked for it.
+export { DEFAULT_WALLPAPER_URLS, defaultWallpaperUrl };
/** The dark original — the picture the app was born with. */
export const DEFAULT_WALLPAPER_URL = DEFAULT_WALLPAPER_URLS.dark;
diff --git a/jarvis/ui/web/frontend/src/hooks/useWallpaperCatalog.ts b/jarvis/ui/web/frontend/src/hooks/useWallpaperCatalog.ts
index 4f9a80b9c3..29d7d0672e 100644
--- a/jarvis/ui/web/frontend/src/hooks/useWallpaperCatalog.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useWallpaperCatalog.ts
@@ -1,6 +1,10 @@
import { useQuery } from "@tanstack/react-query";
-import { defaultWallpaperUrl } from "@/hooks/useDesktopWallpaper";
+import {
+ BUNDLED_WALLPAPERS,
+ ORIGINAL_WALLPAPER_STYLE,
+ PLAIN_WALLPAPER_STYLE,
+} from "@/lib/bundledWallpapers";
import { wallpaperFullUrl, wallpaperThumbUrl } from "@/store/wallpaper";
/** One wallpaper as the browse grid knows it — metadata only, no pixels. */
@@ -13,9 +17,16 @@ export interface WallpaperEntry {
styleLabel: string;
theme: "light" | "dark";
/**
- * True for the two wallpapers that ship inside the app rather than in the
- * generated library — one per mode. They are pinned to the front of the
- * grid and their pixels come from the bundle, not from `/api/wallpapers`.
+ * True for a wallpaper that ships inside the app rather than in the
+ * generated library: the two originals and the plain black/white grounds.
+ * They are pinned to the front of the grid and their pixels come from the
+ * bundle, not from `/api/wallpapers` (see lib/bundledWallpapers).
+ */
+ isBundled?: boolean;
+ /**
+ * True for the one bundled wallpaper each mode falls back to — the original
+ * of that mode. Adopting it clears the stored choice instead of storing an
+ * id, so the tile and the "Default" button can never disagree.
*/
isDefault?: boolean;
/**
@@ -47,67 +58,73 @@ export interface WallpaperCatalog {
items: WallpaperEntry[];
}
-/** The filter slug and chip label the bundled originals live under. */
-export const DEFAULT_WALLPAPER_STYLE = "original";
-
/**
- * The wallpapers the app ships with — one per mode, each the picture its mode
- * falls back to.
+ * The wallpapers the app ships with, as the grid knows them.
*
* They are assembled here instead of being copied into the generated library
* so that they are present unconditionally: the library is optional content
* under a git-ignored directory, these pictures are part of the program. Their
- * pixels come from the same bundled assets the shell already paints, so
- * putting them in the grid costs no download at all.
+ * pixels come from the bundle (the same assets the shell already paints, or a
+ * drawn solid colour), so putting them in the grid costs no download at all.
*
- * Two of them because a wallpaper belongs to one mode (see
- * useDesktopWallpaper.DEFAULT_WALLPAPER_URLS): the night scene the app was
- * born with, and its daylight twin for light mode. Each carries the mode it
- * was authored for, so adopting one switches the interface into that mode like
- * any other tile — and "back to the default" in light mode lands on the
- * daylight picture, never on the moonlit one.
+ * Which pictures, and why, is the business of lib/bundledWallpapers — the two
+ * originals (one per mode, each its mode's default) and the plain black and
+ * white grounds. Every one carries the mode it was authored for, so adopting
+ * it switches the interface into that mode like any other tile.
+ */
+export const BUNDLED_WALLPAPER_ENTRIES: readonly WallpaperEntry[] = BUNDLED_WALLPAPERS.map(
+ ({ id, title, style, styleLabel, theme, isDefault }) => ({
+ id,
+ title,
+ style,
+ styleLabel,
+ theme,
+ isBundled: true,
+ ...(isDefault ? { isDefault: true } : {}),
+ }),
+);
+
+/**
+ * The style chips for the bundled wallpapers, in the order they lead the chip
+ * row: the originals, then the plain grounds. Counts come from the entries so
+ * a chip can never promise a tile the grid does not have.
*/
-export const DEFAULT_WALLPAPER_ENTRIES: readonly WallpaperEntry[] = [
- {
- id: "original",
- title: "The Original",
- style: DEFAULT_WALLPAPER_STYLE,
- styleLabel: "Original",
- theme: "dark",
- isDefault: true,
- },
- {
- id: "original-light",
- title: "The Original, by day",
- style: DEFAULT_WALLPAPER_STYLE,
- styleLabel: "Original",
- theme: "light",
- isDefault: true,
- },
-];
+export const BUNDLED_WALLPAPER_STYLES: readonly WallpaperStyle[] = [
+ { slug: ORIGINAL_WALLPAPER_STYLE, label: "Original" },
+ { slug: PLAIN_WALLPAPER_STYLE, label: "Plain" },
+].map(({ slug, label }) => ({
+ slug,
+ label,
+ count: BUNDLED_WALLPAPER_ENTRIES.filter((entry) => entry.style === slug).length,
+}));
-/** The dark original — the first wallpaper ever made for the app. */
-export const DEFAULT_WALLPAPER_ENTRY: WallpaperEntry = DEFAULT_WALLPAPER_ENTRIES[0];
+/** True for a chip that stands for bundled wallpapers rather than library ones. */
+export function isBundledStyle(slug: string): boolean {
+ return BUNDLED_WALLPAPER_STYLES.some((chip) => chip.slug === slug);
+}
-/** Where a grid tile's thumbnail comes from. */
+/**
+ * Where a grid tile's thumbnail comes from.
+ *
+ * The URL helpers already answer with the bundled picture for a bundled id, so
+ * a tile needs no special case here — the id is the whole story.
+ */
export function thumbUrlFor(item: WallpaperEntry): string {
- return item.isDefault ? defaultWallpaperUrl(item.theme) : wallpaperThumbUrl(item.id);
+ return wallpaperThumbUrl(item.id);
}
/** Where a preview's full-size image comes from. */
export function fullUrlFor(item: WallpaperEntry): string {
- return item.isDefault ? defaultWallpaperUrl(item.theme) : wallpaperFullUrl(item.id);
+ return wallpaperFullUrl(item.id);
}
/** The catalog as it looks before (or without) the generated library. */
const BUNDLED_ONLY: WallpaperCatalog = {
available: true,
libraryAvailable: false,
- count: DEFAULT_WALLPAPER_ENTRIES.length,
- styles: [
- { slug: DEFAULT_WALLPAPER_STYLE, label: "Original", count: DEFAULT_WALLPAPER_ENTRIES.length },
- ],
- items: [...DEFAULT_WALLPAPER_ENTRIES],
+ count: BUNDLED_WALLPAPER_ENTRIES.length,
+ styles: [...BUNDLED_WALLPAPER_STYLES],
+ items: [...BUNDLED_WALLPAPER_ENTRIES],
};
/**
@@ -118,7 +135,7 @@ const BUNDLED_ONLY: WallpaperCatalog = {
* fetched once per session and kept — refetching it on every visit to the
* section would buy nothing.
*
- * The bundled originals are prepended to whatever the server returns, so the
+ * The bundled wallpapers are prepended to whatever the server returns, so the
* section has something to show even when the request fails or the library was
* never generated on this machine.
*/
@@ -129,7 +146,7 @@ export function useWallpaperCatalog() {
retry: 1,
queryFn: async () => {
// A failure here is not an error state for the section: the bundled
- // original is still a wallpaper, and showing it beats showing a stack
+ // pictures are still wallpapers, and showing them beats showing a stack
// trace because a backend was mid-restart.
const data = await fetch("/api/wallpapers")
.then((response) =>
@@ -147,9 +164,9 @@ export function useWallpaperCatalog() {
libraryAvailable: Boolean(data.available),
count:
(typeof data.count === "number" ? data.count : data.items.length) +
- DEFAULT_WALLPAPER_ENTRIES.length,
- styles: [BUNDLED_ONLY.styles[0], ...styles],
- items: [...DEFAULT_WALLPAPER_ENTRIES, ...data.items],
+ BUNDLED_WALLPAPER_ENTRIES.length,
+ styles: [...BUNDLED_WALLPAPER_STYLES, ...styles],
+ items: [...BUNDLED_WALLPAPER_ENTRIES, ...data.items],
};
},
});
diff --git a/jarvis/ui/web/frontend/src/lib/bundledWallpapers.ts b/jarvis/ui/web/frontend/src/lib/bundledWallpapers.ts
new file mode 100644
index 0000000000..6b2495167a
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/bundledWallpapers.ts
@@ -0,0 +1,143 @@
+import jarvisDesktopWallpaperLight from "@/assets/jarvis-desktop-wallpaper-light.webp";
+import jarvisDesktopWallpaper from "@/assets/jarvis-desktop-wallpaper.webp";
+import type { Theme } from "@/hooks/useTheme";
+
+/**
+ * The wallpapers that ship INSIDE the app — the one place that knows them.
+ *
+ * Everything else in the wallpaper section comes from somewhere optional: the
+ * generated library is a git-ignored download, the uploads live in the data
+ * directory, the marketplace needs a network. These few are part of the
+ * program, so a fresh checkout, a headless container, and a machine that never
+ * downloaded anything all have them — and every consumer that holds only an id
+ * (the shell painting the ground, a pick restored from storage, a grid tile)
+ * resolves it here first, before asking `/api/wallpapers`.
+ *
+ * Two kinds live in this list:
+ *
+ * - The two ORIGINALS, one per mode. Each is the default and the fallback of
+ * its mode: an empty selection means "this one" (see store/wallpaper.ts and
+ * useDesktopWallpaper), and adopting it is the same act as clearing the
+ * choice.
+ * - The PLAIN grounds — pure black for dark, pure white for light. Ordinary
+ * wallpapers in every respect (stored by id, starred, filtered), just with
+ * no pixels to fetch: a solid colour is drawn, not downloaded, so each is a
+ * tiny SVG data URI instead of an asset file.
+ *
+ * Every entry is authored for exactly one mode, like every other wallpaper —
+ * adopting one switches the interface into that mode.
+ */
+export interface BundledWallpaper {
+ id: string;
+ title: string;
+ /** Filter slug shared with the catalog's style chips. */
+ style: string;
+ styleLabel: string;
+ theme: Theme;
+ /** Where the pixels come from — an asset URL or a data URI, never `/api/`. */
+ url: string;
+ /** True for the one wallpaper a mode falls back to. Exactly one per mode. */
+ isDefault: boolean;
+}
+
+/** The filter slug and chip label the two originals live under. */
+export const ORIGINAL_WALLPAPER_STYLE = "original";
+
+/** The filter slug and chip label the plain black/white grounds live under. */
+export const PLAIN_WALLPAPER_STYLE = "plain";
+
+/**
+ * A full-frame solid colour as an image URL.
+ *
+ * An SVG data URI rather than a PNG in `assets/`: it IS the colour, byte for
+ * byte readable, and it scales without a thumbnail. Kept free of parentheses
+ * and quotes on purpose — the shell puts it into an unquoted CSS `url(...)`.
+ */
+export function solidColorWallpaperUrl(hex: string): string {
+ const svg =
+ `<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080">` +
+ `<rect width="100%" height="100%" fill="${hex}"/></svg>`;
+ return `data:image/svg+xml,${encodeURIComponent(svg)}`;
+}
+
+/** In the order they appear in the grid: night, day, black, white. */
+export const BUNDLED_WALLPAPERS: readonly BundledWallpaper[] = [
+ {
+ id: "original",
+ title: "The Original",
+ style: ORIGINAL_WALLPAPER_STYLE,
+ styleLabel: "Original",
+ theme: "dark",
+ url: jarvisDesktopWallpaper,
+ isDefault: true,
+ },
+ {
+ id: "original-light",
+ title: "The Original, by day",
+ style: ORIGINAL_WALLPAPER_STYLE,
+ styleLabel: "Original",
+ theme: "light",
+ url: jarvisDesktopWallpaperLight,
+ isDefault: true,
+ },
+ {
+ id: "plain-black",
+ title: "Black",
+ style: PLAIN_WALLPAPER_STYLE,
+ styleLabel: "Plain",
+ theme: "dark",
+ url: solidColorWallpaperUrl("#000000"),
+ isDefault: false,
+ },
+ {
+ id: "plain-white",
+ title: "White",
+ style: PLAIN_WALLPAPER_STYLE,
+ styleLabel: "Plain",
+ theme: "light",
+ url: solidColorWallpaperUrl("#ffffff"),
+ isDefault: false,
+ },
+];
+
+const BY_ID: ReadonlyMap<string, BundledWallpaper> = new Map(
+ BUNDLED_WALLPAPERS.map((entry) => [entry.id, entry]),
+);
+
+/** True for an id whose pixels ship with the app. */
+export function isBundledId(id: string): boolean {
+ return BY_ID.has(id);
+}
+
+/** The bundled picture behind an id, or null for one served from the API. */
+export function bundledWallpaperUrl(id: string): string | null {
+ return BY_ID.get(id)?.url ?? null;
+}
+
+/**
+ * The picture each mode falls back to — the original authored for it.
+ *
+ * Two, not one, because a wallpaper belongs to exactly one mode: the moonlit
+ * woodblock ocean is a night scene, and for as long as it stood in for BOTH
+ * modes, light chrome landed on it whenever the light slot was empty — a
+ * fresh profile, a cleared store, a manual switch to light before any light
+ * picture was chosen — and nothing on that screen could be read (maintainer
+ * report 2026-08-18). The daylight courtyard is the same character in the
+ * light mode's own register, so a mode without a pick of its own shows a
+ * picture authored for it, never the other mode's.
+ */
+export const DEFAULT_WALLPAPER_URLS: Readonly<Record<Theme, string>> = {
+ dark: defaultOf("dark"),
+ light: defaultOf("light"),
+};
+
+function defaultOf(theme: Theme): string {
+ const entry = BUNDLED_WALLPAPERS.find((item) => item.isDefault && item.theme === theme);
+ if (!entry) throw new Error(`No bundled default wallpaper for ${theme} mode`);
+ return entry.url;
+}
+
+/** The bundled artwork of one mode. */
+export function defaultWallpaperUrl(theme: Theme): string {
+ return DEFAULT_WALLPAPER_URLS[theme];
+}
diff --git a/jarvis/ui/web/frontend/src/store/wallpaper.test.ts b/jarvis/ui/web/frontend/src/store/wallpaper.test.ts
index fa89b96303..e783303b55 100644
--- a/jarvis/ui/web/frontend/src/store/wallpaper.test.ts
+++ b/jarvis/ui/web/frontend/src/store/wallpaper.test.ts
@@ -1,6 +1,50 @@
import { beforeEach, describe, expect, it } from "vitest";
-import { useWallpaperStore } from "@/store/wallpaper";
+import { DEFAULT_WALLPAPER_URLS } from "@/lib/bundledWallpapers";
+import {
+ useWallpaperStore,
+ wallpaperFullUrl,
+ wallpaperThumbUrl,
+} from "@/store/wallpaper";
+
+/**
+ * Three id families, three sources — and the id alone tells them apart, so
+ * whoever holds only an id (the shell, a restored pick) lands on the right
+ * picture without a flag beside it.
+ */
+describe("wallpaper URLs by id", () => {
+ it("serves a library id from the catalog endpoint", () => {
+ expect(wallpaperFullUrl("03-anime-neon-01")).toBe("/api/wallpapers/03-anime-neon-01/full");
+ expect(wallpaperThumbUrl("03-anime-neon-01")).toBe("/api/wallpapers/03-anime-neon-01/thumb");
+ });
+
+ it("serves an upload id from the uploads endpoint", () => {
+ expect(wallpaperFullUrl("u0123456789abcdef")).toBe(
+ "/api/wallpapers/uploads/u0123456789abcdef/full",
+ );
+ });
+
+ it("answers a bundled id from the bundle, never from the API", () => {
+ expect(wallpaperFullUrl("original")).toBe(DEFAULT_WALLPAPER_URLS.dark);
+ expect(wallpaperFullUrl("original-light")).toBe(DEFAULT_WALLPAPER_URLS.light);
+ expect(wallpaperThumbUrl("original")).toBe(DEFAULT_WALLPAPER_URLS.dark);
+ });
+
+ it("draws the plain grounds as data URIs — pure black, pure white", () => {
+ const black = wallpaperFullUrl("plain-black");
+ const white = wallpaperFullUrl("plain-white");
+ expect(black.startsWith("data:image/svg+xml,")).toBe(true);
+ expect(white.startsWith("data:image/svg+xml,")).toBe(true);
+ expect(decodeURIComponent(black)).toContain('fill="#000000"');
+ expect(decodeURIComponent(white)).toContain('fill="#ffffff"');
+ // The shell puts the URL into an unquoted CSS url(...): no parentheses or
+ // quotes may survive encoding, or the declaration would end early.
+ for (const url of [black, white]) {
+ expect(url).not.toMatch(/[()'"\s]/);
+ }
+ expect(wallpaperThumbUrl("plain-black")).toBe(black);
+ });
+});
/**
* The pre-per-theme slot must be migrated, never read live.
diff --git a/jarvis/ui/web/frontend/src/store/wallpaper.ts b/jarvis/ui/web/frontend/src/store/wallpaper.ts
index 272450610c..10015d2302 100644
--- a/jarvis/ui/web/frontend/src/store/wallpaper.ts
+++ b/jarvis/ui/web/frontend/src/store/wallpaper.ts
@@ -1,6 +1,7 @@
import { create } from "zustand";
import { cachedTheme, type Theme } from "@/hooks/useTheme";
+import { bundledWallpaperUrl } from "@/lib/bundledWallpapers";
/**
* Which desktop wallpaper the app is wearing — one choice PER THEME.
@@ -76,12 +77,13 @@ const FAVORITES_KEY = "jarvis.wallpaper.favorites.v1";
/**
* An id minted by the upload store (`u` + 16 hex), as opposed to one written by
- * the library's manifest builder (`03-anime-neon-07`).
+ * the library's manifest builder (`03-anime-neon-07`) or one of the few ids
+ * that ship inside the app (`original`, `plain-black`, …).
*
- * The two stores are served from different paths, and the id is what tells them
- * apart — deliberately, so that everything holding only an id (the shell that
- * paints the background, a per-theme selection restored from storage) resolves
- * to the right picture without carrying a flag alongside it.
+ * The three sources are served from different places, and the id is what
+ * tells them apart — deliberately, so that everything holding only an id (the
+ * shell that paints the background, a per-theme selection restored from
+ * storage) resolves to the right picture without carrying a flag alongside it.
*/
const UPLOAD_ID_PATTERN = /^u[0-9a-f]{16}$/;
@@ -89,8 +91,16 @@ export function isUploadId(id: string): boolean {
return UPLOAD_ID_PATTERN.test(id);
}
-/** Where a chosen wallpaper's full-size file is served from. */
+/**
+ * Where a chosen wallpaper's full-size file is served from.
+ *
+ * A bundled picture answers with its own URL and never touches the API: it is
+ * the one kind of wallpaper that must resolve on a machine with no library, no
+ * uploads and no backend at all.
+ */
export function wallpaperFullUrl(id: string): string {
+ const bundled = bundledWallpaperUrl(id);
+ if (bundled) return bundled;
const safe = encodeURIComponent(id);
return isUploadId(id)
? `/api/wallpapers/uploads/${safe}/full`
@@ -99,6 +109,8 @@ export function wallpaperFullUrl(id: string): string {
/** Where a chosen wallpaper's grid thumbnail is served from. */
export function wallpaperThumbUrl(id: string): string {
+ const bundled = bundledWallpaperUrl(id);
+ if (bundled) return bundled;
const safe = encodeURIComponent(id);
return isUploadId(id)
? `/api/wallpapers/uploads/${safe}/thumb`
diff --git a/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx b/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx
index ccaf739b15..824a268719 100644
--- a/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx
@@ -160,6 +160,14 @@ afterEach(() => {
vi.unstubAllGlobals();
});
+/** The style chip row as labels, from "All styles" onwards. */
+function styleChipLabels(): string[] {
+ const labels = [...document.querySelectorAll("button[aria-pressed]")].map(
+ (button) => button.textContent?.trim() ?? "",
+ );
+ return labels.slice(labels.indexOf("All styles"));
+}
+
describe("WallpaperView", () => {
it("browses on thumbnails alone — no full-size image is requested", async () => {
renderView();
@@ -174,19 +182,83 @@ describe("WallpaperView", () => {
expect(sources.some((src) => src.endsWith("/full"))).toBe(false);
});
- it("pins the originals to the very first tiles — night, then day", async () => {
+ it("pins the bundled pictures to the very first tiles — night, day, black, white", async () => {
renderView();
await screen.findByAltText("Flooded Observatory");
const tiles = [...document.querySelectorAll('[data-testid="wallpaper-grid"] img')];
- expect(tiles).toHaveLength(5);
- expect(tiles[0].getAttribute("alt")).toBe("The Original");
- expect(tiles[1].getAttribute("alt")).toBe("The Original, by day");
- expect(tiles[0].getAttribute("src")).not.toContain("/api/");
- expect(tiles[1].getAttribute("src")).not.toContain("/api/");
- // Two different pictures, not the same one twice.
- expect(tiles[1].getAttribute("src")).not.toBe(tiles[0].getAttribute("src"));
+ expect(tiles).toHaveLength(7);
+ expect(tiles.slice(0, 4).map((tile) => tile.getAttribute("alt"))).toEqual([
+ "The Original",
+ "The Original, by day",
+ "Black",
+ "White",
+ ]);
+ for (const tile of tiles.slice(0, 4)) {
+ expect(tile.getAttribute("src")).not.toContain("/api/");
+ }
+ // Four different pictures, not the same one over and over.
+ expect(new Set(tiles.slice(0, 4).map((tile) => tile.getAttribute("src"))).size).toBe(4);
+ });
+
+ it("draws the plain grounds instead of downloading them", async () => {
+ renderView();
+
+ const black = await screen.findByAltText("Black");
+ const white = await screen.findByAltText("White");
+
+ expect(black.getAttribute("src")?.startsWith("data:image/svg+xml,")).toBe(true);
+ expect(white.getAttribute("src")?.startsWith("data:image/svg+xml,")).toBe(true);
+ expect(black.getAttribute("src")).toContain(encodeURIComponent("#000000"));
+ expect(white.getAttribute("src")).toContain(encodeURIComponent("#ffffff"));
+ // Their chip sits right behind the originals, ahead of the library's.
+ expect(styleChipLabels().slice(0, 4)).toEqual([
+ "All styles",
+ "Original",
+ "Plain",
+ "Cinematic Photorealistic",
+ ]);
+ fireEvent.click(screen.getByRole("button", { name: "Plain" }));
+ await waitFor(() => {
+ const tiles = [...document.querySelectorAll('[data-testid="wallpaper-grid"] img')];
+ expect(tiles.map((tile) => tile.getAttribute("alt"))).toEqual(["Black", "White"]);
+ });
+ });
+
+ it("adopting the black ground stores its id under dark and paints dark", async () => {
+ renderView();
+ act(() => useWallpaperStore.getState().select("03-anime-neon-01", "dark"));
+
+ fireEvent.click(await screen.findByAltText("Black"));
+ fireEvent.click(await screen.findByRole("button", { name: "Use this wallpaper" }));
+
+ await waitFor(() => {
+ expect(useWallpaperStore.getState().selections.dark).toBe("plain-black");
+ });
+ expect(isDark()).toBe(true);
+ // Not a default: the black ground is a pick of its own, and the night
+ // original is no longer the one in use.
+ expect(await screen.findByRole("button", { name: /In use/ })).toBeTruthy();
+ });
+
+ it("adopting the white ground switches to light and stores its id there", async () => {
+ renderView();
+
+ fireEvent.click(await screen.findByAltText("White"));
+ fireEvent.click(await screen.findByRole("button", { name: "Use this wallpaper" }));
+
+ await waitFor(() => expect(isDark()).toBe(false));
+ expect(useWallpaperStore.getState().selections.light).toBe("plain-white");
+ // The dark pick is untouched — every mode keeps its own.
+ expect(useWallpaperStore.getState().selections.dark).toBeNull();
+ // And "Default" from here goes back to the daylight original, not to black.
+ fireEvent.click(screen.getByRole("button", { name: "Close preview" }));
+ fireEvent.click(await screen.findByRole("button", { name: "Default" }));
+ await waitFor(() => {
+ expect(useWallpaperStore.getState().selections.light).toBeNull();
+ });
+ expect(isDark()).toBe(false);
});
it("keeps the original first when sorting by style", async () => {
@@ -355,9 +427,12 @@ describe("WallpaperView", () => {
expect(requestedSources().filter((src) => src.includes("/api/"))).toHaveLength(1),
);
expect(screen.getByAltText("Morning Atrium")).toBeTruthy();
- // The daylight original is a light wallpaper like any other.
+ // The daylight original and the white ground are light wallpapers like any
+ // other; the night scene and the black ground are not.
expect(screen.getByAltText("The Original, by day")).toBeTruthy();
+ expect(screen.getByAltText("White")).toBeTruthy();
expect(screen.queryByAltText("The Original")).toBeNull();
+ expect(screen.queryByAltText("Black")).toBeNull();
});
it("keeps the same shuffled order across renders", async () => {
@@ -514,17 +589,27 @@ describe("WallpaperView", () => {
fireEvent.change(input, { target: { files: [file] } });
}
- it("lists an uploaded picture right after the originals", async () => {
+ it("lists an uploaded picture right after the bundled ones", async () => {
renderView(CATALOG, [OWN]);
await screen.findByAltText("Kitchen Window");
const tiles = [...document.querySelectorAll('[data-testid="wallpaper-grid"] img')];
- expect(tiles.slice(0, 3).map((tile) => tile.getAttribute("alt"))).toEqual([
+ expect(tiles.slice(0, 5).map((tile) => tile.getAttribute("alt"))).toEqual([
"The Original",
"The Original, by day",
+ "Black",
+ "White",
"Kitchen Window",
]);
+ // Its chip follows the bundled chips too, ahead of the library's.
+ expect(styleChipLabels().slice(0, 5)).toEqual([
+ "All styles",
+ "Original",
+ "Plain",
+ "Yours",
+ "Cinematic Photorealistic",
+ ]);
});
it("serves an upload's thumbnail from the uploads endpoint", async () => {
diff --git a/jarvis/ui/web/frontend/src/views/WallpaperView.tsx b/jarvis/ui/web/frontend/src/views/WallpaperView.tsx
index 1b8f100742..980fa2c89f 100644
--- a/jarvis/ui/web/frontend/src/views/WallpaperView.tsx
+++ b/jarvis/ui/web/frontend/src/views/WallpaperView.tsx
@@ -21,8 +21,9 @@ import { Button } from "@/components/ui/button";
import { ScrollArea } from "@/components/ui/scroll-area";
import { ViewHeader } from "@/views/ChatsView";
import {
- DEFAULT_WALLPAPER_ENTRIES,
+ BUNDLED_WALLPAPER_ENTRIES,
fullUrlFor,
+ isBundledStyle,
thumbUrlFor,
useWallpaperCatalog,
type WallpaperEntry,
@@ -67,15 +68,15 @@ function shuffleRank(id: string): number {
/** Where a wallpaper came from, as the grid orders it: bundled, own, library. */
function originRank(item: WallpaperEntry): number {
- if (item.isDefault) return 0;
+ if (item.isBundled) return 0;
if (item.isUpload) return 1;
return 2;
}
-/** The bundled originals in the order they ship: the night scene, then day. */
+/** The bundled pictures in the order they ship: night, day, black, white. */
function bundledRank(item: WallpaperEntry): number {
- const index = DEFAULT_WALLPAPER_ENTRIES.findIndex((entry) => entry.id === item.id);
- return index === -1 ? DEFAULT_WALLPAPER_ENTRIES.length : index;
+ const index = BUNDLED_WALLPAPER_ENTRIES.findIndex((entry) => entry.id === item.id);
+ return index === -1 ? BUNDLED_WALLPAPER_ENTRIES.length : index;
}
/** The segmented filter/ordering controls share one look. */
@@ -284,9 +285,10 @@ function WallpaperTile({
<img
src={thumbUrlFor(item)}
alt={item.title}
- // The pinned original is the first thing on screen and the shell has
- // already loaded it, so waiting for an intersection buys nothing.
- loading={item.isDefault ? "eager" : "lazy"}
+ // The pinned bundled tiles are the first thing on screen and their
+ // pixels are already in the bundle, so waiting for an intersection
+ // buys nothing.
+ loading={item.isBundled ? "eager" : "lazy"}
decoding="async"
width={480}
height={270}
@@ -399,8 +401,9 @@ function WallpaperPreview({
</p>
</div>
{/* Only an upload can be re-themed: the library's own light/dark comes
- from the prompt each picture was painted to, and the bundled
- original is a night scene by definition. */}
+ from the prompt each picture was painted to, and each bundled
+ picture is authored for its mode by definition — a night scene, a
+ daylight one, black, white. */}
{item.isUpload && (
<div className="flex items-center gap-1 rounded-lg border border-border p-0.5">
<SegmentButton
@@ -526,14 +529,14 @@ export function WallpaperView() {
[uploads],
);
- // The owner's own pictures sit between the bundled originals and the
+ // The owner's own pictures sit between the bundled pictures and the
// generated library — brought here on purpose, so they are found without
// scrolling.
const items = useMemo(() => {
const catalog = data?.items ?? [];
if (!ownEntries.length) return catalog;
- const bundled = catalog.filter((item) => item.isDefault);
- const rest = catalog.filter((item) => !item.isDefault);
+ const bundled = catalog.filter((item) => item.isBundled);
+ const rest = catalog.filter((item) => !item.isBundled);
return [...bundled, ...ownEntries, ...rest];
}, [data?.items, ownEntries]);
@@ -563,8 +566,10 @@ export function WallpaperView() {
},
].filter(Boolean) as { slug: string; label: string; count: number }[];
if (!chips.length) return known;
- const [bundled, ...rest] = known;
- return bundled ? [bundled, ...chips, ...rest] : [...chips, ...known];
+ // Right behind the bundled chips (Original, Plain), ahead of the library's.
+ const bundled = known.filter((chip) => isBundledStyle(chip.slug));
+ const rest = known.filter((chip) => !isBundledStyle(chip.slug));
+ return [...bundled, ...chips, ...rest];
}, [data?.styles, ownEntries]);
const favoriteIds = useMemo(() => new Set(favorites), [favorites]);
@@ -586,13 +591,14 @@ export function WallpaperView() {
// tile that jumps away the instant its heart is clicked loses the place
// the reader was looking at. The Favorites filter is where they gather.
return filtered.sort((left, right) => {
- // The bundled originals outrank every ordering and every shuffle: the
+ // The bundled pictures outrank every ordering and every shuffle: the
// night scene is the first wallpaper this app ever had and stays the
- // first tile, its daylight twin sits right beside it. The owner's own
- // pictures come next, ahead of the generated five hundred.
+ // first tile, its daylight twin sits right beside it, then the plain
+ // black and white grounds. The owner's own pictures come next, ahead
+ // of the generated five hundred.
const byOrigin = originRank(left) - originRank(right);
if (byOrigin !== 0) return byOrigin;
- if (left.isDefault && right.isDefault) {
+ if (left.isBundled && right.isBundled) {
return bundledRank(left) - bundledRank(right);
}
if (ordering === "style") {