ui: theme picker in Settings, and ship the component gallery

The gallery at /theme-sample is now a normal route rather than a development
one, and Settings links to it, so a user can see what a theme actually looks
like before committing to it. Every new component belongs in the gallery: it is
how the design gets reviewed, and how a component that only looks wrong in one
of the four themes gets caught.

Settings gains a Theme section with the new ThemePicker, which explains what
each theme is for - notably that night mode filters videos, documents and maps
to red as well, not just the interface.

Theme names and picker options move to themes/names.ts so the component library
can read them without importing components/Theme.tsx, which still pulls in
Semantic UI. Theme.tsx re-exports them, so existing call sites are unchanged.
The navigation bar's compact picker now reads the same list, so the two cannot
drift apart.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-29 19:38:04 -06:00
parent 1bf8ea3da8
commit ea50ee2f16
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
10 changed files with 290 additions and 52 deletions

63
app/src/themes/names.ts Normal file
View file

@ -0,0 +1,63 @@
import {SavedThemeName, ThemeName} from '../types/theme';
/*
* Theme names and the choices offered by the pickers.
*
* These live here rather than in components/Theme.tsx so the component library can
* use them without importing that module, which still pulls in Semantic UI.
*/
export const darkTheme = 'dark';
export const lightTheme = 'light';
export const nightTheme = 'night';
export const amberTheme = 'amber';
export const defaultTheme = lightTheme;
export const systemTheme = 'system';
export const themeSessionKey = 'color-scheme';
/** Every theme a user can apply, in the order the pickers offer them. */
export const themeNames: ThemeName[] = [lightTheme, darkTheme, nightTheme, amberTheme];
/** Themes built on a dark background. Semantic components are `inverted` in these. */
export const darkThemes: ThemeName[] = [darkTheme, nightTheme, amberTheme];
/** Themes a user must choose deliberately; `prefers-color-scheme` never picks them. */
export const explicitOnlyThemes: ThemeName[] = [nightTheme, amberTheme];
export const isDarkTheme = (theme: ThemeName): boolean => darkThemes.includes(theme);
export const isThemeName = (value: unknown): value is ThemeName =>
themeNames.includes(value as ThemeName);
export interface ThemeChoice {
value: SavedThemeName;
text: string;
/** Semantic icon name; resolved to a Tabler component by the Icon shim. */
icon: string;
description: string;
}
/** Shared by the navigation bar picker and the Settings page, so the two cannot drift. */
export const themeChoices: ThemeChoice[] = [
{
value: systemTheme,
text: 'System',
icon: 'lightbulb outline',
description: "Follow this device's light or dark preference.",
},
{value: lightTheme, text: 'Light', icon: 'sun', description: 'A light background.'},
{value: darkTheme, text: 'Dark', icon: 'moon', description: 'A dark background.'},
{
value: nightTheme,
text: 'Night',
icon: 'eye',
description: 'Red only, to preserve your night vision in the dark. Videos, documents, ' +
'and maps are filtered to red as well.',
},
{
value: amberTheme,
text: 'Amber',
icon: 'terminal',
description: 'Monochrome amber, like a classic terminal.',
},
];