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.

fix(wallpaper): light mode has an original of its own

Harald6e23ba910de0
diff --git a/jarvis/ui/web/frontend/src/assets/jarvis-desktop-wallpaper-light.webp b/jarvis/ui/web/frontend/src/assets/jarvis-desktop-wallpaper-light.webp
new file mode 100644
index 0000000000..fa97a34ff0
Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/jarvis-desktop-wallpaper-light.webp differ
diff --git a/jarvis/ui/web/frontend/src/hooks/useApplyWallpaper.ts b/jarvis/ui/web/frontend/src/hooks/useApplyWallpaper.ts
index dff8beabf4..1957629d8e 100644
--- a/jarvis/ui/web/frontend/src/hooks/useApplyWallpaper.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useApplyWallpaper.ts
@@ -1,18 +1,9 @@
import { useCallback } from "react";
-import { useTheme, type Theme } from "@/hooks/useTheme";
+import { useTheme } from "@/hooks/useTheme";
import type { WallpaperEntry } from "@/hooks/useWallpaperCatalog";
import { useWallpaperStore } from "@/store/wallpaper";
-/**
- * The theme the bundled artwork belongs to.
- *
- * It is a night scene — a moonlit woodblock ocean — so returning to the default
- * wallpaper returns to dark mode. This also happens to be the app's own default
- * preference, which is why a fresh profile is consistent from the first paint.
- */
-export const DEFAULT_WALLPAPER_THEME: Theme = "dark";
-
/**
* Adopt a wallpaper, and take the interface theme with it.
*
@@ -26,24 +17,34 @@ export const DEFAULT_WALLPAPER_THEME: Theme = "dark";
* so nothing here invents a second source of truth. The theme switcher in
* Settings keeps working afterwards; it is the next wallpaper, not this one,
* that overrides a manual change.
+ *
+ * `null` means "back to the default": the current mode drops its pick and
+ * shows the picture bundled for it, and the mode itself stays. It used to
+ * clear the DARK slot and switch to dark regardless of where the user was —
+ * so "Default" in light mode flipped the whole app and left the light pick in
+ * place. Every mode has its own bundled picture now (useDesktopWallpaper), so
+ * the default of the mode you are in is the only sensible reading.
*/
export function useApplyWallpaper(): (item: WallpaperEntry | null) => void {
const select = useWallpaperStore((state) => state.select);
- const { setPreference } = useTheme();
+ const { theme: current, setPreference } = useTheme();
return useCallback(
(item: WallpaperEntry | null) => {
- // The bundled original has a grid tile of its own, but adopting it is
- // the same act as clearing the choice: one stored state for one picture,
- // so the tile and the "Default" button can never disagree.
+ if (item === null) {
+ select(null, current);
+ return;
+ }
+ // A bundled original has a grid tile of its own, but adopting it is the
+ // same act as clearing the choice for its mode: one stored state for one
+ // picture, so the tile and the "Default" button can never disagree.
//
// The pick is filed under the theme the picture was AUTHORED for — the
// same theme the app is about to switch into. Each mode keeps its own
// picture, so a later manual theme toggle brings the right one back.
- const theme = item?.theme ?? DEFAULT_WALLPAPER_THEME;
- select(item && !item.isDefault ? item.id : null, theme);
- setPreference(theme);
+ select(item.isDefault ? null : item.id, item.theme);
+ setPreference(item.theme);
},
- [select, setPreference],
+ [select, setPreference, current],
);
}
diff --git a/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.test.tsx b/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.test.tsx
index 630ff793ed..29ddca0ae2 100644
--- a/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.test.tsx
+++ b/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.test.tsx
@@ -2,7 +2,8 @@ import { act, cleanup, render, screen, waitFor } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
- DEFAULT_WALLPAPER_URL,
+ DEFAULT_WALLPAPER_URLS,
+ defaultWallpaperUrl,
useDesktopWallpaper,
} from "@/hooks/useDesktopWallpaper";
import { useWallpaperStore } from "@/store/wallpaper";
@@ -50,13 +51,29 @@ beforeEach(() => {
afterEach(() => {
cleanup();
vi.unstubAllGlobals();
+ document.documentElement.classList.remove("dark");
});
describe("useDesktopWallpaper", () => {
- it("starts on the bundled wallpaper", () => {
+ it("starts on the bundled wallpaper of the mode on screen", () => {
render(<Probe />);
- expect(screen.getByTestId("url").textContent).toBe(DEFAULT_WALLPAPER_URL);
+ expect(screen.getByTestId("url").textContent).toBe(defaultWallpaperUrl("light"));
+ expect(pending).toHaveLength(0);
+ });
+
+ it("paints the night original in dark mode and the daylight one in light", async () => {
+ document.documentElement.classList.add("dark");
+ render(<Probe />);
+ expect(screen.getByTestId("url").textContent).toBe(DEFAULT_WALLPAPER_URLS.dark);
+
+ // Light chrome never lands on the night scene: with no light pick stored,
+ // the light mode shows the picture bundled FOR light.
+ act(() => document.documentElement.classList.remove("dark"));
+ await waitFor(() =>
+ expect(screen.getByTestId("url").textContent).toBe(DEFAULT_WALLPAPER_URLS.light),
+ );
+ expect(DEFAULT_WALLPAPER_URLS.light).not.toBe(DEFAULT_WALLPAPER_URLS.dark);
expect(pending).toHaveLength(0);
});
@@ -66,7 +83,7 @@ describe("useDesktopWallpaper", () => {
// Requested, but not yet painted — the shell must not go blank meanwhile.
expect(pending[0]?.src).toBe("/api/wallpapers/03-anime-neon-01/full");
- expect(screen.getByTestId("url").textContent).toBe(DEFAULT_WALLPAPER_URL);
+ expect(screen.getByTestId("url").textContent).toBe(defaultWallpaperUrl("light"));
act(() => pending[0]?.onload?.(new Event("load") as never));
@@ -77,7 +94,7 @@ describe("useDesktopWallpaper", () => {
);
});
- it("falls back to the bundled wallpaper when the library is missing", async () => {
+ 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 },
});
@@ -86,7 +103,7 @@ describe("useDesktopWallpaper", () => {
act(() => pending[0]?.onerror?.(new Event("error") as never));
await waitFor(() =>
- expect(screen.getByTestId("url").textContent).toBe(DEFAULT_WALLPAPER_URL),
+ expect(screen.getByTestId("url").textContent).toBe(defaultWallpaperUrl("light")),
);
});
});
diff --git a/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.ts b/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.ts
index b0648563be..bfec4e6d0b 100644
--- a/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useDesktopWallpaper.ts
@@ -1,11 +1,35 @@
import { useEffect, useState } from "react";
+import jarvisDesktopWallpaperLight from "@/assets/jarvis-desktop-wallpaper-light.webp";
import jarvisDesktopWallpaper from "@/assets/jarvis-desktop-wallpaper.webp";
-import { useThemeValue } from "@/hooks/useTheme";
+import { useThemeValue, type Theme } from "@/hooks/useTheme";
import { useWallpaperStore, wallpaperFullUrl } from "@/store/wallpaper";
-/** The artwork that ships inside the bundle — the default and the fallback. */
-export const DEFAULT_WALLPAPER_URL = jarvisDesktopWallpaper;
+/**
+ * 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 dark original — the picture the app was born with. */
+export const DEFAULT_WALLPAPER_URL = DEFAULT_WALLPAPER_URLS.dark;
/**
* The background-image URL the app shell should currently paint.
@@ -16,20 +40,21 @@ export const DEFAULT_WALLPAPER_URL = jarvisDesktopWallpaper;
* the switch happens only once it can be drawn — the visible change is then a
* single repaint, with no gap in between.
*
- * A failed load falls back to the bundled artwork instead of leaving the shell
- * bare. That is the ordinary case on a machine where the wallpaper library was
- * never generated: the id in localStorage is still valid, the files simply are
- * not there.
+ * A failed load falls back to the bundled artwork of the mode instead of
+ * leaving the shell bare. That is the ordinary case on a machine where the
+ * wallpaper library was never generated: the id in localStorage is still
+ * valid, the files simply are not there.
*/
export function useDesktopWallpaper(): string {
// The pick is per theme: toggling the mode swaps in that mode's picture.
const theme = useThemeValue();
const selectedId = useWallpaperStore((state) => state.selections[theme]);
- const [url, setUrl] = useState(DEFAULT_WALLPAPER_URL);
+ const [url, setUrl] = useState(() => defaultWallpaperUrl(theme));
useEffect(() => {
+ const fallback = defaultWallpaperUrl(theme);
if (!selectedId) {
- setUrl(DEFAULT_WALLPAPER_URL);
+ setUrl(fallback);
return;
}
@@ -40,7 +65,7 @@ export function useDesktopWallpaper(): string {
if (!cancelled) setUrl(target);
};
image.onerror = () => {
- if (!cancelled) setUrl(DEFAULT_WALLPAPER_URL);
+ if (!cancelled) setUrl(fallback);
};
image.src = target;
// A cached image can be complete before the handlers are attached — in
@@ -52,7 +77,7 @@ export function useDesktopWallpaper(): string {
image.onload = null;
image.onerror = null;
};
- }, [selectedId]);
+ }, [selectedId, theme]);
return url;
}
diff --git a/jarvis/ui/web/frontend/src/hooks/useWallpaperCatalog.ts b/jarvis/ui/web/frontend/src/hooks/useWallpaperCatalog.ts
index 520cf35d20..4f9a80b9c3 100644
--- a/jarvis/ui/web/frontend/src/hooks/useWallpaperCatalog.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useWallpaperCatalog.ts
@@ -1,6 +1,6 @@
import { useQuery } from "@tanstack/react-query";
-import { DEFAULT_WALLPAPER_URL } from "@/hooks/useDesktopWallpaper";
+import { defaultWallpaperUrl } from "@/hooks/useDesktopWallpaper";
import { wallpaperFullUrl, wallpaperThumbUrl } from "@/store/wallpaper";
/** One wallpaper as the browse grid knows it — metadata only, no pixels. */
@@ -13,9 +13,9 @@ export interface WallpaperEntry {
styleLabel: string;
theme: "light" | "dark";
/**
- * True for the one wallpaper that ships inside the app rather than in the
- * generated library. It is pinned to the front of the grid and its pixels
- * come from the bundle, not from `/api/wallpapers`.
+ * 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`.
*/
isDefault?: boolean;
/**
@@ -38,7 +38,7 @@ export interface WallpaperStyle {
}
export interface WallpaperCatalog {
- /** Always true — the bundled original is a wallpaper the grid can show. */
+ /** Always true — the bundled originals are wallpapers the grid can show. */
available: boolean;
/** False when the generated 500-piece library is not installed here. */
libraryAvailable: boolean;
@@ -47,50 +47,67 @@ export interface WallpaperCatalog {
items: WallpaperEntry[];
}
-/** The filter slug and chip label the bundled original lives under. */
+/** The filter slug and chip label the bundled originals live under. */
export const DEFAULT_WALLPAPER_STYLE = "original";
/**
- * The wallpaper the app ships with — the first one ever made for it, and the
- * one it falls back to.
+ * The wallpapers the app ships with — one per mode, each the picture its mode
+ * falls back to.
*
- * It is assembled here instead of being copied into the generated library so
- * that it is present unconditionally: the library is optional content under a
- * git-ignored directory, this picture is part of the program. Its pixels come
- * from the same bundled asset the shell already paints, so putting it in the
- * grid costs no download at all.
+ * 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.
+ *
+ * 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.
*/
-export const DEFAULT_WALLPAPER_ENTRY: WallpaperEntry = {
- id: "original",
- title: "The Original",
- style: DEFAULT_WALLPAPER_STYLE,
- styleLabel: "Original",
- // A moonlit woodblock ocean — see useApplyWallpaper.DEFAULT_WALLPAPER_THEME,
- // which has to agree with this or returning to the default would flip the
- // interface to the wrong mode.
- theme: "dark",
- isDefault: true,
-};
+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,
+ },
+];
+
+/** The dark original — the first wallpaper ever made for the app. */
+export const DEFAULT_WALLPAPER_ENTRY: WallpaperEntry = DEFAULT_WALLPAPER_ENTRIES[0];
/** Where a grid tile's thumbnail comes from. */
export function thumbUrlFor(item: WallpaperEntry): string {
- return item.isDefault ? DEFAULT_WALLPAPER_URL : wallpaperThumbUrl(item.id);
+ return item.isDefault ? defaultWallpaperUrl(item.theme) : wallpaperThumbUrl(item.id);
}
/** Where a preview's full-size image comes from. */
export function fullUrlFor(item: WallpaperEntry): string {
- return item.isDefault ? DEFAULT_WALLPAPER_URL : wallpaperFullUrl(item.id);
+ return item.isDefault ? defaultWallpaperUrl(item.theme) : wallpaperFullUrl(item.id);
}
/** The catalog as it looks before (or without) the generated library. */
const BUNDLED_ONLY: WallpaperCatalog = {
available: true,
libraryAvailable: false,
- count: 1,
+ count: DEFAULT_WALLPAPER_ENTRIES.length,
styles: [
- { slug: DEFAULT_WALLPAPER_STYLE, label: "Original", count: 1 },
+ { slug: DEFAULT_WALLPAPER_STYLE, label: "Original", count: DEFAULT_WALLPAPER_ENTRIES.length },
],
- items: [DEFAULT_WALLPAPER_ENTRY],
+ items: [...DEFAULT_WALLPAPER_ENTRIES],
};
/**
@@ -101,7 +118,7 @@ const BUNDLED_ONLY: WallpaperCatalog = {
* fetched once per session and kept — refetching it on every visit to the
* section would buy nothing.
*
- * The bundled original is prepended to whatever the server returns, so the
+ * The bundled originals 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.
*/
@@ -128,9 +145,11 @@ export function useWallpaperCatalog() {
return {
available: true,
libraryAvailable: Boolean(data.available),
- count: (typeof data.count === "number" ? data.count : data.items.length) + 1,
+ count:
+ (typeof data.count === "number" ? data.count : data.items.length) +
+ DEFAULT_WALLPAPER_ENTRIES.length,
styles: [BUNDLED_ONLY.styles[0], ...styles],
- items: [DEFAULT_WALLPAPER_ENTRY, ...data.items],
+ items: [...DEFAULT_WALLPAPER_ENTRIES, ...data.items],
};
},
});
diff --git a/jarvis/ui/web/frontend/src/store/wallpaper.ts b/jarvis/ui/web/frontend/src/store/wallpaper.ts
index d892b37774..272450610c 100644
--- a/jarvis/ui/web/frontend/src/store/wallpaper.ts
+++ b/jarvis/ui/web/frontend/src/store/wallpaper.ts
@@ -12,10 +12,12 @@ import { cachedTheme, type Theme } from "@/hooks/useTheme";
* dark chrome and read as a mistake. Each mode keeps its own pick instead,
* and toggling the theme brings that mode's picture back with it.
*
- * The bundled artwork stays the default and the fallback: an empty selection
- * means "the one that ships with the app", so a fresh profile, a cleared
- * browser storage, and a checkout without the generated library all land on
- * the same known-good picture rather than on a blank shell.
+ * The bundled artwork stays the default and the fallback — one picture PER
+ * MODE (useDesktopWallpaper): an empty selection means "the one that ships
+ * with the app for this mode", so a fresh profile, a cleared browser storage,
+ * and a checkout without the generated library all land on a known-good
+ * picture authored for the mode on screen rather than on a blank shell — or,
+ * as it was until 2026-08-18, on the night scene under light chrome.
*
* The choice lives in localStorage rather than on the server. It is a per-
* screen cosmetic preference with no backend meaning, and localStorage is the
diff --git a/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx b/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx
index 304061d8ac..ccaf739b15 100644
--- a/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx
@@ -165,7 +165,7 @@ describe("WallpaperView", () => {
renderView();
await screen.findByAltText("Flooded Observatory");
- // The bundled original rides along as a fourth tile, served from the app
+ // The two bundled originals ride along as extra tiles, served from the app
// bundle rather than from /api/wallpapers.
const sources = requestedSources().filter((src) => src.includes("/api/"));
@@ -174,15 +174,19 @@ describe("WallpaperView", () => {
expect(sources.some((src) => src.endsWith("/full"))).toBe(false);
});
- it("pins the original to the very first tile", async () => {
+ it("pins the originals to the very first tiles — night, then day", async () => {
renderView();
await screen.findByAltText("Flooded Observatory");
const tiles = [...document.querySelectorAll('[data-testid="wallpaper-grid"] img')];
- expect(tiles).toHaveLength(4);
+ 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"));
});
it("keeps the original first when sorting by style", async () => {
@@ -218,6 +222,48 @@ describe("WallpaperView", () => {
expect(isDark()).toBe(true);
});
+ it("marks the daylight original as in use only in light mode", async () => {
+ renderView();
+
+ // Painted dark: the night original is in use, the daylight one is not.
+ fireEvent.click(await screen.findByAltText("The Original, by day"));
+ expect(await screen.findByRole("button", { name: "Use this wallpaper" })).toBeTruthy();
+ expect(screen.queryByRole("button", { name: /In use/ })).toBeNull();
+ });
+
+ it("adopting the daylight original switches to light and clears the light slot", async () => {
+ renderView();
+ act(() => useWallpaperStore.getState().select("01-cinematic-photoreal-02", "light"));
+
+ fireEvent.click(await screen.findByAltText("The Original, by day"));
+ fireEvent.click(await screen.findByRole("button", { name: "Use this wallpaper" }));
+
+ await waitFor(() => expect(isDark()).toBe(false));
+ expect(useWallpaperStore.getState().selections.light).toBeNull();
+ // The dark pick is untouched — every mode keeps its own.
+ expect(useWallpaperStore.getState().selections.dark).toBeNull();
+ // The open preview now says so: the daylight original is the one in use.
+ expect(await screen.findByRole("button", { name: /In use/ })).toBeTruthy();
+ });
+
+ it("the Default button returns to the default of the mode on screen", async () => {
+ renderView();
+ // Painted dark, with a pick in BOTH modes.
+ act(() => {
+ useWallpaperStore.getState().select("03-anime-neon-01", "dark");
+ useWallpaperStore.getState().select("01-cinematic-photoreal-02", "light");
+ });
+
+ fireEvent.click(await screen.findByRole("button", { name: "Default" }));
+
+ await waitFor(() => {
+ expect(useWallpaperStore.getState().selections.dark).toBeNull();
+ });
+ // Light mode's pick survives, and the app did not change mode.
+ expect(useWallpaperStore.getState().selections.light).toBe("01-cinematic-photoreal-02");
+ expect(isDark()).toBe(true);
+ });
+
it("downloads the full-size image only once a wallpaper is previewed", async () => {
renderView();
@@ -268,7 +314,7 @@ describe("WallpaperView", () => {
await waitFor(() => expect(isDark()).toBe(true));
});
- it("returns to dark along with the bundled default", async () => {
+ it("returns to the daylight default and stays light after a light pick", async () => {
renderView();
fireEvent.click(await screen.findByAltText("Morning Atrium"));
@@ -277,8 +323,13 @@ describe("WallpaperView", () => {
fireEvent.click(await screen.findByRole("button", { name: /Default/ }));
- await waitFor(() => expect(isDark()).toBe(true));
- expect(useWallpaperStore.getState().selections.dark).toBeNull();
+ // The default of the mode on screen: light mode keeps its chrome and shows
+ // the picture bundled for it — it does NOT flip the whole app to dark, and
+ // it never puts the night scene under light chrome.
+ await waitFor(() => {
+ expect(useWallpaperStore.getState().selections.light).toBeNull();
+ });
+ expect(isDark()).toBe(false);
});
it("returns to the bundled default", async () => {
@@ -300,8 +351,13 @@ describe("WallpaperView", () => {
fireEvent.click(screen.getByRole("button", { name: "All styles" }));
fireEvent.click(screen.getByRole("button", { name: /Light/ }));
- await waitFor(() => expect(requestedSources()).toHaveLength(1));
+ await waitFor(() =>
+ 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.
+ expect(screen.getByAltText("The Original, by day")).toBeTruthy();
+ expect(screen.queryByAltText("The Original")).toBeNull();
});
it("keeps the same shuffled order across renders", async () => {
@@ -458,14 +514,15 @@ describe("WallpaperView", () => {
fireEvent.change(input, { target: { files: [file] } });
}
- it("lists an uploaded picture right after the original", async () => {
+ it("lists an uploaded picture right after the originals", async () => {
renderView(CATALOG, [OWN]);
await screen.findByAltText("Kitchen Window");
const tiles = [...document.querySelectorAll('[data-testid="wallpaper-grid"] img')];
- expect(tiles.slice(0, 2).map((tile) => tile.getAttribute("alt"))).toEqual([
+ expect(tiles.slice(0, 3).map((tile) => tile.getAttribute("alt"))).toEqual([
"The Original",
+ "The Original, by day",
"Kitchen Window",
]);
});
diff --git a/jarvis/ui/web/frontend/src/views/WallpaperView.tsx b/jarvis/ui/web/frontend/src/views/WallpaperView.tsx
index e995297499..1b8f100742 100644
--- a/jarvis/ui/web/frontend/src/views/WallpaperView.tsx
+++ b/jarvis/ui/web/frontend/src/views/WallpaperView.tsx
@@ -21,6 +21,7 @@ import { Button } from "@/components/ui/button";
import { ScrollArea } from "@/components/ui/scroll-area";
import { ViewHeader } from "@/views/ChatsView";
import {
+ DEFAULT_WALLPAPER_ENTRIES,
fullUrlFor,
thumbUrlFor,
useWallpaperCatalog,
@@ -71,6 +72,12 @@ function originRank(item: WallpaperEntry): number {
return 2;
}
+/** The bundled originals in the order they ship: the night scene, then day. */
+function bundledRank(item: WallpaperEntry): number {
+ const index = DEFAULT_WALLPAPER_ENTRIES.findIndex((entry) => entry.id === item.id);
+ return index === -1 ? DEFAULT_WALLPAPER_ENTRIES.length : index;
+}
+
/** The segmented filter/ordering controls share one look. */
function SegmentButton({
active,
@@ -488,8 +495,9 @@ function WallpaperPreview({
* size, and adopt it as the app's ground.
*
* Adopting one also switches light/dark to match the artwork — see
- * `useApplyWallpaper`. The bundled default is always one click away again, so
- * trying a wallpaper is meant to feel as reversible as it actually is.
+ * `useApplyWallpaper`. The bundled default of the mode you are in is always
+ * one click away again, so trying a wallpaper is meant to feel as reversible
+ * as it actually is.
*/
export function WallpaperView() {
const { data, isLoading } = useWallpaperCatalog();
@@ -518,13 +526,15 @@ export function WallpaperView() {
[uploads],
);
- // The owner's own pictures sit between the bundled original and the generated
- // library — brought here on purpose, so they are found without scrolling.
+ // The owner's own pictures sit between the bundled originals 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, ...rest] = catalog;
- return bundled ? [bundled, ...ownEntries, ...rest] : [...ownEntries, ...catalog];
+ const bundled = catalog.filter((item) => item.isDefault);
+ const rest = catalog.filter((item) => !item.isDefault);
+ return [...bundled, ...ownEntries, ...rest];
}, [data?.items, ownEntries]);
// This view is the one place that knows which mode every picture was
@@ -576,11 +586,15 @@ 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 original outranks every ordering and every shuffle: it is
- // the first wallpaper this app ever had, and it stays the first tile.
- // The owner's own pictures come next, ahead of the generated five hundred.
+ // The bundled originals 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.
const byOrigin = originRank(left) - originRank(right);
if (byOrigin !== 0) return byOrigin;
+ if (left.isDefault && right.isDefault) {
+ return bundledRank(left) - bundledRank(right);
+ }
if (ordering === "style") {
const byStyle = left.style.localeCompare(right.style);
if (byStyle !== 0) return byStyle;
@@ -591,9 +605,12 @@ export function WallpaperView() {
}, [favoriteIds, favoritesOnly, items, ordering, style, theme]);
// "No choice stored" and "the original is chosen" are the same state, so the
- // pinned tile carries the check mark on a fresh profile.
+ // pinned tile carries the check mark on a fresh profile — the one authored
+ // for the mode on screen, since each mode has an original of its own.
const isApplied = (item: WallpaperEntry) =>
- item.isDefault ? selectedId === null : item.id === selectedId;
+ item.isDefault
+ ? item.theme === activeTheme && selectedId === null
+ : item.id === selectedId;
const previewIndex = previewId
? visible.findIndex((item) => item.id === previewId)