Skip to content

Self-improving AI Employees for everyone

feat(theme): one theme button and the chosen theme in both modes

trohitg6b6ed4e0da10
diff --git a/client/index.html b/client/index.html
index 75f07857..d2887483 100644
--- a/client/index.html
+++ b/client/index.html
@@ -11,12 +11,6 @@
the key migrations and every later write. The two theme lists must
match AVAILABLE_THEMES and DARK_FAMILY there; the
contexts/__tests__/themePrePaint.test.ts test enforces it.
-
- Home (Normal mode) shows the base theme of the stored theme's family
- (src/app/ShellThemeProvider.tsx); the saved screen is read the way
- readStoredShellMode in src/store/useAppStore.ts reads it. With Normal
- mode turned off (VITE_NORMAL_MODE=false) the app corrects the theme
- on its first render.
-->
<script>
(function () {
@@ -35,13 +29,6 @@
} catch (e) {
// Storage blocked by browser policy: keep the default.
}
- try {
- var shell = localStorage.getItem('ui_shell_mode');
- if (shell !== 'normal' && shell !== 'dev') shell = localStorage.getItem('ui_pro_mode') === 'true' ? 'dev' : 'normal';
- if (shell === 'normal') theme = DARK_FAMILY.indexOf(theme) !== -1 ? 'dark' : 'light';
- } catch (e) {
- // Storage blocked: the stored theme could not be read either.
- }
var html = document.documentElement;
html.setAttribute('data-theme', theme);
if (DARK_FAMILY.indexOf(theme) !== -1) html.classList.add('dark');
diff --git a/client/src/app/ShellThemeProvider.tsx b/client/src/app/ShellThemeProvider.tsx
deleted file mode 100644
index 162dec78..00000000
--- a/client/src/app/ShellThemeProvider.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * The app's ThemeProvider, with the shell's rule: Home (Normal mode) and
- * the sign-in gate's screens (Connecting, sign-in) show the base theme of
- * the chosen theme's family, light or dark, because they are designed for
- * those two only. The editor (Dev mode) shows the chosen theme itself,
- * stylized or not. Moving between them never changes the choice.
- * index.html's pre-paint script applies the mode rule to the first frame.
- */
-
-import type { ReactNode } from 'react';
-import { ThemeProvider } from '../contexts/ThemeContext';
-import { useShellDialogsStore } from '../stores/shellDialogsStore';
-import { useShellMode } from './ShellModeSwitch';
-
-export function ShellThemeProvider({ children }: { children: ReactNode }) {
- const mode = useShellMode();
- const connectScreen = useShellDialogsStore((s) => s.connectScreenOpen);
- return <ThemeProvider baseOnly={mode === 'normal' || connectScreen}>{children}</ThemeProvider>;
-}
-
-export default ShellThemeProvider;
diff --git a/client/src/app/__tests__/modeSwitch.test.tsx b/client/src/app/__tests__/modeSwitch.test.tsx
index d79e9b13..64b36e49 100644
--- a/client/src/app/__tests__/modeSwitch.test.tsx
+++ b/client/src/app/__tests__/modeSwitch.test.tsx
@@ -1,6 +1,6 @@
/**
* The Normal / Dev switch end to end: the real toggle, shell actions,
- * transition, screen switch and theme rule. Only the two screens are
+ * transition, screen switch and theme. Only the two screens are
* stand-ins.
*/
@@ -14,8 +14,8 @@ vi.mock('../../features/home/HomeShell', () => ({ default: () => <div>Home scree
import { ModeToggle } from '../../components/shell/ModeToggle';
import { useAppStore } from '../../store/useAppStore';
+import { ThemeProvider } from '../../contexts/ThemeContext';
import { ShellModeSwitch } from '../ShellModeSwitch';
-import { ShellThemeProvider } from '../ShellThemeProvider';
const html = document.documentElement;
@@ -52,21 +52,21 @@ describe('mode switch', () => {
expect(localStorage.getItem('ui_shell_mode')).toBe('dev');
});
- it('shows Home in the base theme and the editor in the chosen one', async () => {
+ it('shows the chosen theme in both modes', async () => {
localStorage.setItem('opencompany-theme', 'atomic');
const user = userEvent.setup();
render(
- <ShellThemeProvider>
+ <ThemeProvider>
<ModeToggle />
<ShellModeSwitch />
- </ShellThemeProvider>,
+ </ThemeProvider>,
);
await screen.findByText('Workflow editor');
expect(html.dataset.theme).toBe('atomic');
await user.click(screen.getByRole('radio', { name: 'Normal' }));
await screen.findByText('Home screen');
- expect(html.dataset.theme).toBe('light');
+ expect(html.dataset.theme).toBe('atomic');
expect(localStorage.getItem('opencompany-theme')).toBe('atomic');
await user.click(screen.getByRole('radio', { name: 'Dev' }));
diff --git a/client/src/components/auth/ConnectScreen.tsx b/client/src/components/auth/ConnectScreen.tsx
index a7e421e1..12709470 100644
--- a/client/src/components/auth/ConnectScreen.tsx
+++ b/client/src/components/auth/ConnectScreen.tsx
@@ -4,24 +4,16 @@
* top bar with the logo and the theme button. Connecting and sign-in render
* inside one, so the orb glides from one's slot to the other's. As the
* overlay (signed in, the server away) it covers the app, which stays
- * mounted underneath and inert, and borrows the orb until it goes. While
- * one shows, the theme is the base of the chosen family, as on Home.
+ * mounted underneath and inert, and borrows the orb until it goes.
*/
-import { useLayoutEffect, type ReactNode } from 'react';
+import type { ReactNode } from 'react';
import { OcLogo } from '@/components/brand/Logo';
-import { ThemeButton } from '@/features/home/header/ThemeButton';
+import { ThemeButton } from '@/components/ui/ThemeButton';
import { OrbStage } from '@/features/home/orb/OrbStage';
import { cn } from '@/lib/utils';
-import { useShellDialogsStore } from '@/stores/shellDialogsStore';
export function ConnectScreen({ overlay = false, children }: { overlay?: boolean; children: ReactNode }) {
- useLayoutEffect(() => {
- const { setConnectScreenOpen } = useShellDialogsStore.getState();
- setConnectScreenOpen(true);
- return () => setConnectScreenOpen(false);
- }, []);
-
return (
<div
role={overlay ? 'dialog' : undefined}
diff --git a/client/src/components/auth/__tests__/ProtectedRoute.test.tsx b/client/src/components/auth/__tests__/ProtectedRoute.test.tsx
index ea2c827e..0c9aa949 100644
--- a/client/src/components/auth/__tests__/ProtectedRoute.test.tsx
+++ b/client/src/components/auth/__tests__/ProtectedRoute.test.tsx
@@ -5,8 +5,7 @@
* answers, then sign-in or the app; the sign-in screen kept up while a
* sign-in finishes, for its welcome; and, signed in, Connecting over the
* app while the WebSocket is down, the app staying mounted, an expired
- * session going to sign-in. The theme shows as its base while a
- * Connecting or sign-in screen is up.
+ * session going to sign-in.
*/
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -27,9 +26,18 @@ let ws: { reconnecting: boolean };
vi.mock('../../../contexts/AuthContext', () => ({ useAuth: () => auth }));
vi.mock('../../../contexts/WebSocketContext', () => ({ useWebSocketActions: () => ws }));
vi.mock('../LoginPage', () => ({ default: () => <p>Sign in page</p> }));
-vi.mock('@/features/home/header/ThemeButton', () => ({ ThemeButton: () => null }));
+// Only the gate's screen (ConnectScreen) shows the theme button here, so the
+// button stands for that screen: whether it is up, and how often it mounted.
+let screens = 0;
+vi.mock('@/components/ui/ThemeButton', () => ({
+ ThemeButton: () => {
+ useEffect(() => {
+ screens += 1;
+ }, []);
+ return <span>Theme button</span>;
+ },
+}));
-import { useShellDialogsStore } from '@/stores/shellDialogsStore';
import ProtectedRoute from '../ProtectedRoute';
let mounts = 0;
@@ -60,6 +68,7 @@ beforeEach(() => {
// No WebGL in jsdom: the orb's slots show the mark.
getContext = vi.spyOn(HTMLCanvasElement.prototype, 'getContext').mockReturnValue(null);
mounts = 0;
+ screens = 0;
ws = { reconnecting: false };
auth = {
isAuthenticated: false,
@@ -89,7 +98,7 @@ describe('the sign-in gate', () => {
expect(screen.getByText('Connecting')).toBeInTheDocument();
expect(screen.getByText('Trying again in 2s')).toBeInTheDocument();
expect(screen.getByText('Attempt 1')).toBeInTheDocument();
- expect(useShellDialogsStore.getState().connectScreenOpen).toBe(true);
+ expect(screen.getByText('Theme button')).toBeInTheDocument();
await seconds(2);
expect(auth.checkAuth).toHaveBeenCalledTimes(1);
@@ -110,7 +119,8 @@ describe('the sign-in gate', () => {
await seconds(1.5);
expect(screen.getByText('Sign in page')).toBeInTheDocument();
// One screen throughout, so the orb glides from Connecting to sign-in.
- expect(useShellDialogsStore.getState().connectScreenOpen).toBe(true);
+ expect(screen.getByText('Theme button')).toBeInTheDocument();
+ expect(screens).toBe(1);
});
it('goes straight into the app after Connected when the session is good', async () => {
@@ -121,7 +131,7 @@ describe('the sign-in gate', () => {
expect(screen.getByRole('heading', { name: 'Connected' })).toBeInTheDocument();
await seconds(1.5);
expect(screen.getByText('The app')).toBeInTheDocument();
- expect(useShellDialogsStore.getState().connectScreenOpen).toBe(false);
+ expect(screen.queryByText('Theme button')).not.toBeInTheDocument();
});
it('keeps the sign-in screen up until the sign-in finishes, for its welcome', () => {
@@ -130,13 +140,13 @@ describe('the sign-in gate', () => {
rerender(view());
expect(screen.getByText('Sign in page')).toBeInTheDocument();
expect(screen.queryByText('The app')).not.toBeInTheDocument();
- expect(useShellDialogsStore.getState().connectScreenOpen).toBe(true);
+ expect(screen.getByText('Theme button')).toBeInTheDocument();
auth = { ...auth, signingIn: false };
rerender(view());
expect(screen.getByText('The app')).toBeInTheDocument();
expect(mounts).toBe(1);
- expect(useShellDialogsStore.getState().connectScreenOpen).toBe(false);
+ expect(screen.queryByText('Theme button')).not.toBeInTheDocument();
});
it('shows the app when the session is good, and sign-in when it is not', () => {
diff --git a/client/src/components/ui/CommandPaletteHost.tsx b/client/src/components/ui/CommandPaletteHost.tsx
index 1216bca4..97f52d06 100644
--- a/client/src/components/ui/CommandPaletteHost.tsx
+++ b/client/src/components/ui/CommandPaletteHost.tsx
@@ -32,7 +32,7 @@ import {
Upload,
} from 'lucide-react';
import { CommandPalette, type CommandItem } from './CommandPalette';
-import { AVAILABLE_THEMES, useTheme, type ThemeName } from '../../contexts/ThemeContext';
+import { AVAILABLE_THEMES, THEME_LABEL, useTheme } from '../../contexts/ThemeContext';
import {
type WorkflowControlPendingMutation,
type WorkflowControlStatus,
@@ -60,12 +60,6 @@ export interface CommandPaletteHandlers {
focusChat?: () => void;
}
-const THEME_LABEL: Record<ThemeName, string> = {
- light: 'Light',
- dark: 'Dark',
- atomic: 'Atomic Modern',
-};
-
interface Props {
open: boolean;
onOpenChange: (open: boolean) => void;
diff --git a/client/src/components/ui/StatusBar.tsx b/client/src/components/ui/StatusBar.tsx
index d952bbe6..45c7dfb1 100644
--- a/client/src/components/ui/StatusBar.tsx
+++ b/client/src/components/ui/StatusBar.tsx
@@ -14,15 +14,9 @@
import * as React from 'react';
import { useEffect, useState } from 'react';
import { useWebSocket } from '../../contexts/WebSocketContext';
-import { useTheme, type ThemeName } from '../../contexts/ThemeContext';
+import { THEME_LABEL, useTheme } from '../../contexts/ThemeContext';
import { cn } from '@/lib/utils';
-const THEME_LABEL: Record<ThemeName, string> = {
- light: 'LIGHT',
- dark: 'DARK',
- atomic: 'ATOMIC',
-};
-
interface StatusBarProps {
workflowName?: string;
nodeCount?: number;
@@ -87,7 +81,7 @@ export const StatusBar: React.FC<StatusBarProps> = ({ workflowName, nodeCount })
<span className="ml-auto flex items-center gap-3">
<span>
- THEME: <span className="text-fg-default">{THEME_LABEL[theme]}</span>
+ THEME: <span className="text-fg-default">{THEME_LABEL[theme].toUpperCase()}</span>
</span>
<Sep />
<span className="tabular-nums">{clock}</span>
diff --git a/client/src/components/ui/ThemeButton.tsx b/client/src/components/ui/ThemeButton.tsx
new file mode 100644
index 00000000..ea58c567
--- /dev/null
+++ b/client/src/components/ui/ThemeButton.tsx
@@ -0,0 +1,55 @@
+/**
+ * The theme button (design handoff "theme button"), the same in the Home
+ * header, the editor's toolbar and the sign-in screen: each press steps to
+ * the next theme (Light, Dark, Atomic), revealing it as a circle grown from
+ * the button while the button spins once with a squash. The icon and label
+ * name the theme a press switches to.
+ */
+
+import type { ComponentProps } from 'react';
+import { Atom, Moon, Sun, type LucideIcon } from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { THEME_LABEL, nextTheme, useTheme, type ThemeName } from '@/contexts/ThemeContext';
+import { SPIKE, spikeOrb } from '@/features/home/orb/orb';
+import { animate } from '@/lib/motion';
+
+const SPIN: Keyframe[] = [
+ { transform: 'rotate(0deg) scale(1)' },
+ { transform: 'rotate(200deg) scale(.78)', offset: 0.45 },
+ { transform: 'rotate(360deg) scale(1)' },
+];
+
+const ICON: Record<ThemeName, LucideIcon> = { light: Sun, dark: Moon, atomic: Atom };
+
+type ThemeButtonProps = Pick<ComponentProps<typeof Button>, 'variant' | 'size' | 'className'>;
+
+/** Home's look by default; the editor's toolbar passes its own. */
+export function ThemeButton({
+ variant = 'quiet',
+ size = 'icon',
+ className = 'size-8.5 rounded-pill border-border-default',
+}: ThemeButtonProps) {
+ const { theme, cycleTheme } = useTheme();
+ const next = nextTheme(theme);
+ const Icon = ICON[next];
+ const label = `Switch to ${THEME_LABEL[next]}`;
+ return (
+ <Button
+ variant={variant}
+ size={size}
+ aria-label={label}
+ title={label}
+ className={className}
+ onClick={(event) => {
+ const rect = event.currentTarget.getBoundingClientRect();
+ animate(event.currentTarget, SPIN, { duration: 'theme-icon', easing: 'spring', fill: 'none' });
+ spikeOrb(SPIKE.theme);
+ cycleTheme({ reveal: true, origin: { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 } });
+ }}
+ >
+ <Icon aria-hidden strokeWidth={1.75} />
+ </Button>
+ );
+}
+
+export default ThemeButton;
diff --git a/client/src/components/ui/ThemeSwitcher.tsx b/client/src/components/ui/ThemeSwitcher.tsx
deleted file mode 100644
index f747e3a2..00000000
--- a/client/src/components/ui/ThemeSwitcher.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * ThemeSwitcher — picks the active visual theme.
- *
- * Renders one DropdownMenu item per theme listed in `AVAILABLE_THEMES`,
- * in that order.
- *
- * Adding a new theme: drop a CSS file under client/src/themes/, import
- * it in main.tsx, add the name to `AVAILABLE_THEMES` in ThemeContext,
- * and add an entry to `THEME_META` below.
- */
-
-import * as React from 'react';
-import { Check, Palette } from 'lucide-react';
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu';
-import { Button } from '@/components/ui/button';
-import { AVAILABLE_THEMES, useTheme, type ThemeName } from '../../contexts/ThemeContext';
-
-interface ThemeMeta {
- label: string;
- blurb: string;
-}
-
-const THEME_META: Record<ThemeName, ThemeMeta> = {
- light: { label: 'Light', blurb: 'Clean default' },
- dark: { label: 'Dark', blurb: 'Solarized + Dracula' },
- atomic: { label: 'Atomic Modern', blurb: 'Eames mid-century' },
-};
-
-export const ThemeSwitcher: React.FC<{ className?: string }> = ({ className }) => {
- const { theme, setTheme } = useTheme();
- const activeMeta = THEME_META[theme];
-
- return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- variant="outline"
- size="icon-sm"
- title={`Theme: ${activeMeta.label}`}
- className="border-action-secret-border bg-action-secret-soft text-action-secret-ink hover:bg-action-secret-hover"
- >
- <Palette />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className={className ?? 'min-w-[240px]'}>
- {AVAILABLE_THEMES.map((name) => {
- const meta = THEME_META[name];
- const isActive = name === theme;
- return (
- <DropdownMenuItem
- key={name}
- onSelect={() => setTheme(name)}
- className="flex items-center gap-2"
- >
- <span className="flex h-4 w-4 items-center justify-center">
- {isActive && <Check className="h-3.5 w-3.5" />}
- </span>
- <span className="flex-1">
- <span className="block text-sm font-medium">{meta.label}</span>
- <span className="block text-[11px] text-muted-foreground">{meta.blurb}</span>
- </span>
- </DropdownMenuItem>
- );
- })}
- </DropdownMenuContent>
- </DropdownMenu>
- );
-};
-
-export default ThemeSwitcher;
diff --git a/client/src/components/ui/TopToolbar.tsx b/client/src/components/ui/TopToolbar.tsx
index bfe3a7cb..8ca08dff 100644
--- a/client/src/components/ui/TopToolbar.tsx
+++ b/client/src/components/ui/TopToolbar.tsx
@@ -55,7 +55,7 @@ import {
type WorkflowControlPendingMutation,
type WorkflowControlStatus,
} from '../../contexts/WebSocketContext';
-import { ThemeSwitcher } from '@/components/ui/ThemeSwitcher';
+import { ThemeButton } from '@/components/ui/ThemeButton';
import { cn } from '@/lib/utils';
import { featureFlags } from '@/lib/featureFlags';
import { ModeToggle } from '@/components/shell/ModeToggle';
@@ -415,7 +415,11 @@ const TopToolbar: React.FC<TopToolbarProps> = ({
<KeyRound />
</Button>
- <ThemeSwitcher />
+ <ThemeButton
+ variant="outline"
+ size="icon-sm"
+ className="border-action-secret-border bg-action-secret-soft text-action-secret-ink hover:bg-action-secret-hover"
+ />
{user && (
<Button
diff --git a/client/src/components/ui/__tests__/ThemeButton.test.tsx b/client/src/components/ui/__tests__/ThemeButton.test.tsx
new file mode 100644
index 00000000..051d4448
--- /dev/null
+++ b/client/src/components/ui/__tests__/ThemeButton.test.tsx
@@ -0,0 +1,50 @@
+/**
+ * The theme button, the same in both modes and on the sign-in screen: each
+ * press steps to the next theme, and its name says which one that is.
+ */
+
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+import { ThemeProvider } from '@/contexts/ThemeContext';
+import { setReducedMotion } from '@/test/waapi';
+import { ThemeButton } from '../ThemeButton';
+
+const html = document.documentElement;
+let restoreMotion: () => void;
+
+beforeEach(() => {
+ localStorage.clear();
+ restoreMotion = setReducedMotion(true);
+});
+
+afterEach(() => {
+ restoreMotion();
+ localStorage.clear();
+ html.removeAttribute('data-theme');
+ html.className = '';
+});
+
+describe('ThemeButton', () => {
+ it('steps from Dark to Atomic to Light and back to Dark', async () => {
+ const user = userEvent.setup();
+ render(
+ <ThemeProvider>
+ <ThemeButton />
+ </ThemeProvider>,
+ );
+
+ // A first launch opens in Dark.
+ await user.click(screen.getByRole('button', { name: 'Switch to Atomic' }));
+ expect(html.dataset.theme).toBe('atomic');
+ expect(html.classList.contains('dark')).toBe(false);
+
+ await user.click(screen.getByRole('button', { name: 'Switch to Light' }));
+ expect(html.dataset.theme).toBe('light');
+
+ await user.click(screen.getByRole('button', { name: 'Switch to Dark' }));
+ expect(html.dataset.theme).toBe('dark');
+ expect(html.classList.contains('dark')).toBe(true);
+ expect(localStorage.getItem('opencompany-theme')).toBe('dark');
+ });
+});
diff --git a/client/src/contexts/ThemeContext.tsx b/client/src/contexts/ThemeContext.tsx
index 83ad1946..a407e742 100644
--- a/client/src/contexts/ThemeContext.tsx
+++ b/client/src/contexts/ThemeContext.tsx
@@ -7,20 +7,16 @@
* write the theme to `<html data-theme>` (and the legacy
* `<html class="dark">` flag for any `dark:` Tailwind variants still
* in use), persist the user's choice to localStorage, and migrate legacy
- * callers reading `isDarkMode` / `toggleTheme`.
- *
- * Two themes are tracked: the one the user chose (`chosenTheme`, persisted)
- * and the one on the page (`theme`). They differ only under `baseOnly`,
- * which shows a chosen stylized theme as its family's base theme (light or
- * dark) and keeps the choice for when it clears. Home sets it (see
- * app/ShellThemeProvider): Home is designed for the two base themes only.
+ * callers reading `isDarkMode`. Home, the editor and the sign-in gate all
+ * show the chosen theme; the theme button steps through the themes with
+ * `cycleTheme`.
*
* The DOM is written synchronously inside `setTheme`, before React state
* changes, so any effect reacting to the new theme (the sound pack reads
* `--sound-pack` from computed style) already sees the new tokens.
- * `index.html` runs a pre-paint copy of `loadInitialTheme` and the
- * `baseOnly` rule so the first frame is already themed; its theme lists
- * are locked to the ones below by `contexts/__tests__/themePrePaint.test.ts`.
+ * `index.html` runs a pre-paint copy of `loadInitialTheme` so the first
+ * frame is already themed; its theme lists are locked to the ones below by
+ * `contexts/__tests__/themePrePaint.test.ts`.
*
* `setTheme(next, { reveal: true, origin })` animates the switch: the new
* theme grows as a circle from `origin` over the old one (View Transitions),
@@ -29,8 +25,8 @@
*
* Adding a new theme: drop a new CSS file under client/src/themes/
* scoped to `:root[data-theme="<name>"]`, import it in main.tsx, and
- * add the name to `AVAILABLE_THEMES` below and to the pre-paint script
- * in index.html.
+ * add the name to `AVAILABLE_THEMES` and `THEME_LABEL` below and to the
+ * pre-paint script in index.html.
*/
import React, { createContext, useCallback, useContext, useLayoutEffect, useMemo, useRef, useState } from 'react';
@@ -41,10 +37,17 @@ import { prefersReducedMotion } from '../lib/useReducedMotion';
export type ThemeName = 'light' | 'dark' | 'atomic';
-/** Order matters: it is the order of the ThemeSwitcher menu and the
- * command palette's theme items. */
+/** Order matters: the theme button steps through it in this order, and it
+ * is the order of Settings → Appearance and the command palette. */
export const AVAILABLE_THEMES: readonly ThemeName[] = ['light', 'dark', 'atomic'];
+/** Each theme's name, wherever one is shown. */
+export const THEME_LABEL: Record<ThemeName, string> = {
+ light: 'Light',
+ dark: 'Dark',
+ atomic: 'Atomic',
+};
+
const THEME_STORAGE_KEYS = BRAND_STORAGE_KEYS.theme;
const LEGACY_DARK_MODE_KEY = 'darkMode';
@@ -52,20 +55,9 @@ const LEGACY_DARK_MODE_KEY = 'darkMode';
* Tailwind variant so existing `dark:` utilities resolve correctly. */
export const DARK_FAMILY: ReadonlySet<ThemeName> = new Set<ThemeName>(['dark']);
-export function isDarkTheme(theme: ThemeName): boolean {
- return DARK_FAMILY.has(theme);
-}
-
-/** The base theme of the other family: any dark-family theme maps to
- * `light`, any light-family theme to `dark`. Drives the sun/moon toggle. */
-export function oppositeBaseTheme(theme: ThemeName): ThemeName {
- return DARK_FAMILY.has(theme) ? 'light' : 'dark';
-}
-
-/** The base theme of the same family: `dark` for a dark-family theme,
- * `light` otherwise. What `baseOnly` shows for a chosen theme. */
-export function familyBaseTheme(theme: ThemeName): ThemeName {
- return DARK_FAMILY.has(theme) ? 'dark' : 'light';
+/** The theme after `theme` in `AVAILABLE_THEMES`, wrapping round. */
+export function nextTheme(theme: ThemeName): ThemeName {
+ return AVAILABLE_THEMES[(AVAILABLE_THEMES.indexOf(theme) + 1) % AVAILABLE_THEMES.length];
}
export interface SetThemeOptions {
@@ -76,17 +68,14 @@ export interface SetThemeOptions {
}
interface ThemeContextType {
- /** The theme on the page (what `<html data-theme>` says). */
+ /** The chosen theme, which is the one on the page (`<html data-theme>`). */
theme: ThemeName;
- /** The theme the user chose. Differs from `theme` only under `baseOnly`. */
- chosenTheme: ThemeName;
- /** Choose a theme. Under `baseOnly` the page shows its family's base. */
setTheme: (t: ThemeName, options?: SetThemeOptions) => void;
availableThemes: readonly ThemeName[];
/** True for every theme in `DARK_FAMILY`. */
isDarkMode: boolean;
- /** Flip to the other family's base theme (see `oppositeBaseTheme`). */
- toggleTheme: (options?: SetThemeOptions) => void;
+ /** Switch to the next theme (see `nextTheme`). */
+ cycleTheme: (options?: SetThemeOptions) => void;
}
const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
@@ -113,8 +102,7 @@ function loadInitialTheme(): ThemeName {
return 'dark';
}
-/** Write `theme` to `<html>`. Idempotent. Storage holds the chosen theme,
- * which is not always the one on the page, so it is saved separately. */
+/** Write `theme` to `<html>`. Idempotent. */
export function applyThemeToDom(theme: ThemeName): void {
const html = document.documentElement;
if (html.dataset.theme !== theme) html.dataset.theme = theme;
@@ -122,7 +110,7 @@ export function applyThemeToDom(theme: ThemeName): void {
invalidateMotionTokens();
}
-function saveChosenTheme(theme: ThemeName): void {
+function saveTheme(theme: ThemeName): void {
try {
localStorage.setItem(THEME_STORAGE_KEYS.canonical, theme);
} catch {
@@ -153,49 +141,30 @@ function revealRadius(origin: { x: number; y: number }): number {
let fadeTimer: number | undefined;
-interface ThemeProviderProps {
- children: React.ReactNode;
- /** Show only the base themes: a chosen stylized theme appears as its
- * family's base (`familyBaseTheme`). The choice itself is kept and
- * shows again once this clears. */
- baseOnly?: boolean;
-}
-
-export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children, baseOnly = false }) => {
- const [chosen, setChosen] = useState<ThemeName>(loadInitialTheme);
- const shown = baseOnly ? familyBaseTheme(chosen) : chosen;
+export const ThemeProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
+ const [theme, setThemeState] = useState<ThemeName>(loadInitialTheme);
// The most recently requested theme. A revealed switch commits React state
// only inside the View Transition callback, so a second click before then
- // must toggle from the pending theme, not the rendered one.
- const requestedRef = useRef<ThemeName>(chosen);
- const baseOnlyRef = useRef(baseOnly);
-
- useLayoutEffect(() => {
- baseOnlyRef.current = baseOnly;
- }, [baseOnly]);
+ // must step on from the pending theme, not the rendered one.
+ const requestedRef = useRef<ThemeName>(theme);
// Safety net for the first render (no pre-paint script, e.g. tests), and
- // the path for `baseOnly` changing (a mode switch). Layout effects run
- // before every passive effect, so consumers still see the DOM already
- // switched.
- useLayoutEffect(() => {
- applyThemeToDom(shown);
- }, [shown]);
-
+ // the save of every choice. Layout effects run before every passive
+ // effect, so consumers still see the DOM already switched.
useLayoutEffect(() => {
- saveChosenTheme(chosen);
- }, [chosen]);
+ applyThemeToDom(theme);
+ saveTheme(theme);
+ }, [theme]);
const setTheme = useCallback((next: ThemeName, options?: SetThemeOptions) => {
requestedRef.current = next;
const html = document.documentElement;
- const onPage = (theme: ThemeName) => (baseOnlyRef.current ? familyBaseTheme(theme) : theme);
const commit = () => {
- applyThemeToDom(onPage(next));
- setChosen(next);
+ applyThemeToDom(next);
+ setThemeState(next);
};
- if (!options?.reveal || prefersReducedMotion() || html.dataset.theme === onPage(next)) {
+ if (!options?.reveal || prefersReducedMotion() || html.dataset.theme === next) {
commit();
return;
}
@@ -218,8 +187,8 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children, baseOnly
// keeps a stale callback from overriding it.
transition = doc.startViewTransition(() => {
const latest = requestedRef.current;
- applyThemeToDom(onPage(latest));
- flushSync(() => setChosen(latest));
+ applyThemeToDom(latest);
+ flushSync(() => setThemeState(latest));
});
} catch {
html.classList.remove(SWAPPING_CLASS);
@@ -251,23 +220,22 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children, baseOnly
.finally(() => html.classList.remove(SWAPPING_CLASS));
}, []);
- const toggleTheme = useCallback(
+ const cycleTheme = useCallback(
(options?: SetThemeOptions) => {
- setTheme(oppositeBaseTheme(requestedRef.current), options);
+ setTheme(nextTheme(requestedRef.current), options);
},
[setTheme],
);
const value = useMemo<ThemeContextType>(
() => ({
- theme: shown,
- chosenTheme: chosen,
+ theme,
setTheme,
availableThemes: AVAILABLE_THEMES,
- isDarkMode: DARK_FAMILY.has(shown),
- toggleTheme,
+ isDarkMode: DARK_FAMILY.has(theme),
+ cycleTheme,
}),
- [shown, chosen, setTheme, toggleTheme],
+ [theme, setTheme, cycleTheme],
);
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;
diff --git a/client/src/contexts/__tests__/ThemeContext.test.tsx b/client/src/contexts/__tests__/ThemeContext.test.tsx
index e5b6a4a4..3d9adb1a 100644
--- a/client/src/contexts/__tests__/ThemeContext.test.tsx
+++ b/client/src/contexts/__tests__/ThemeContext.test.tsx
@@ -1,14 +1,7 @@
import { useEffect } from 'react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { act, render, renderHook } from '@testing-library/react';
-import {
- AVAILABLE_THEMES,
- DARK_FAMILY,
- ThemeProvider,
- isDarkTheme,
- oppositeBaseTheme,
- useTheme,
-} from '../ThemeContext';
+import { AVAILABLE_THEMES, ThemeProvider, nextTheme, useTheme } from '../ThemeContext';
import { installWaapiStub, setReducedMotion } from '../../test/waapi';
const html = document.documentElement;
@@ -64,13 +57,8 @@ beforeEach(resetDom);
afterEach(resetDom);
describe('theme helpers', () => {
- it('maps every theme to the base theme of the other family', () => {
- for (const theme of AVAILABLE_THEMES) {
- expect(oppositeBaseTheme(theme)).toBe(DARK_FAMILY.has(theme) ? 'light' : 'dark');
- expect(isDarkTheme(theme)).toBe(DARK_FAMILY.has(theme));
- }
- expect(oppositeBaseTheme('light')).toBe('dark');
- expect(oppositeBaseTheme('dark')).toBe('light');
+ it('steps through the themes in order and wraps round', () => {
+ expect(AVAILABLE_THEMES.map(nextTheme)).toEqual(['dark', 'atomic', 'light']);
});
});
@@ -147,75 +135,18 @@ describe('setTheme', () => {
expect(seen).toEqual(['dark:dark', 'light:light']);
});
- it('toggles to the base theme of the other family', () => {
+ it('cycles through the themes from the stored one', () => {
localStorage.setItem('opencompany-theme', 'atomic');
const { result } = renderHook(() => useTheme(), { wrapper: ThemeProvider });
- act(() => result.current.toggleTheme());
- expect(result.current.theme).toBe('dark');
- act(() => result.current.toggleTheme());
+ act(() => result.current.cycleTheme());
expect(result.current.theme).toBe('light');
- });
-});
-
-describe('baseOnly (Home)', () => {
- function renderWith(baseOnly: boolean) {
- let ctx: ReturnType<typeof useTheme> | undefined;
- function Probe() {
- ctx = useTheme();
- return null;
- }
- const view = render(
- <ThemeProvider baseOnly={baseOnly}>
- <Probe />
- </ThemeProvider>,
- );
- return {
- ctx: () => ctx!,
- setBaseOnly: (next: boolean) =>
- view.rerender(
- <ThemeProvider baseOnly={next}>
- <Probe />
- </ThemeProvider>,
- ),
- };
- }
-
- it('shows a stylized theme as its family base and keeps the choice', () => {
- localStorage.setItem('opencompany-theme', 'atomic');
- const view = renderWith(true);
- expect(view.ctx().theme).toBe('light');
- expect(view.ctx().chosenTheme).toBe('atomic');
- expect(html.dataset.theme).toBe('light');
- expect(localStorage.getItem('opencompany-theme')).toBe('atomic');
- });
-
- it('brings the chosen theme back when it clears', () => {
- localStorage.setItem('opencompany-theme', 'atomic');
- const view = renderWith(true);
- view.setBaseOnly(false);
+ act(() => result.current.cycleTheme());
+ expect(result.current.theme).toBe('dark');
+ act(() => result.current.cycleTheme());
+ expect(result.current.theme).toBe('atomic');
expect(html.dataset.theme).toBe('atomic');
- expect(view.ctx().theme).toBe('atomic');
- view.setBaseOnly(true);
- expect(html.dataset.theme).toBe('light');
- });
-
- it('keeps a stylized choice while showing the base', () => {
- const view = renderWith(true);
- act(() => view.ctx().setTheme('atomic'));
- expect(html.dataset.theme).toBe('light');
- expect(view.ctx().chosenTheme).toBe('atomic');
expect(localStorage.getItem('opencompany-theme')).toBe('atomic');
});
-
- it('toggles between the base themes', () => {
- localStorage.setItem('opencompany-theme', 'atomic');
- const view = renderWith(true);
- act(() => view.ctx().toggleTheme());
- expect(html.dataset.theme).toBe('dark');
- expect(view.ctx().chosenTheme).toBe('dark');
- act(() => view.ctx().toggleTheme());
- expect(html.dataset.theme).toBe('light');
- });
});
describe('revealed switch', () => {
@@ -264,20 +195,21 @@ describe('revealed switch', () => {
}
});
- it('toggles from the pending theme while a transition has not captured yet', async () => {
+ it('cycles from the pending theme while a transition has not captured yet', async () => {
const vt = installViewTransitionStub({ defer: true });
try {
const { result } = renderHook(() => useTheme(), { wrapper: ThemeProvider });
act(() => {
- result.current.toggleTheme({ reveal: true });
- result.current.toggleTheme({ reveal: true });
+ result.current.cycleTheme({ reveal: true });
+ result.current.cycleTheme({ reveal: true });
});
await act(async () => {
for (const t of vt.transitions) t.runUpdate();
});
- // Two toggles from dark land back on dark, not on light.
- expect(result.current.theme).toBe('dark');
- expect(html.dataset.theme).toBe('dark');
+ // Two presses from dark step on to light; stepping from the rendered
+ // theme would have landed on atomic twice.
+ expect(result.current.theme).toBe('light');
+ expect(html.dataset.theme).toBe('light');
} finally {
vt.restore();
}
diff --git a/client/src/contexts/__tests__/themePrePaint.test.ts b/client/src/contexts/__tests__/themePrePaint.test.ts
index b584cc0b..0af99528 100644
--- a/client/src/contexts/__tests__/themePrePaint.test.ts
+++ b/client/src/contexts/__tests__/themePrePaint.test.ts
@@ -1,15 +1,13 @@
/**
* index.html carries a pre-paint copy of ThemeProvider's initial-theme logic
- * and of the shell's Home rule (plain ES5, so it can run before the bundle).
- * These tests keep the two in lockstep: the same theme lists, and the same
- * answer for every storage state.
+ * (plain ES5, so it can run before the bundle). These tests keep the two in
+ * lockstep: the same theme lists, and the same answer for every storage
+ * state.
*/
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
-import { createElement, type ReactNode } from 'react';
import { afterEach, describe, expect, it } from 'vitest';
import { renderHook } from '@testing-library/react';
-import { readStoredShellMode } from '../../store/useAppStore';
import { AVAILABLE_THEMES, DARK_FAMILY, ThemeProvider, useTheme } from '../ThemeContext';
// LF line endings, as the HTML parser produces, so a script's text can be
@@ -68,10 +66,6 @@ describe('pre-paint theme script', () => {
['an unknown stored name', { 'opencompany-theme': 'neon' }],
['an unknown name with darkMode false', { 'opencompany-theme': 'neon', darkMode: 'false' }],
['a removed theme', { 'opencompany-theme': 'cyber' }],
- ['Home with a stylized light theme', { 'opencompany-theme': 'atomic', ui_shell_mode: 'normal' }],
- ['the editor with a stylized theme', { 'opencompany-theme': 'atomic', ui_shell_mode: 'dev' }],
- ['the old Dev palette choice', { 'opencompany-theme': 'atomic', ui_pro_mode: 'true' }],
- ['an unknown saved screen', { 'opencompany-theme': 'atomic', ui_shell_mode: 'kiosk' }],
])('agrees with ThemeProvider for %s', (_label, stored) => {
for (const [key, value] of Object.entries(stored)) localStorage.setItem(key, value);
new Function(prePaintScript())();
@@ -81,19 +75,15 @@ describe('pre-paint theme script', () => {
resetDom();
for (const [key, value] of Object.entries(stored)) localStorage.setItem(key, value);
- // What ShellThemeProvider passes, from the store's own reading of storage.
- const baseOnly = readStoredShellMode() === 'normal';
- const { result, unmount } = renderHook(() => useTheme(), {
- wrapper: ({ children }: { children: ReactNode }) => createElement(ThemeProvider, { baseOnly, children }),
- });
+ const { result, unmount } = renderHook(() => useTheme(), { wrapper: ThemeProvider });
expect(prePainted).toEqual({ theme: result.current.theme, dark: result.current.isDarkMode });
unmount();
});
it.each<[string, Record<string, string>, string]>([
- ['Home shows a stylized light theme as light', { 'opencompany-theme': 'atomic' }, 'light'],
+ ['Home shows the stored theme', { 'opencompany-theme': 'atomic', ui_shell_mode: 'normal' }, 'atomic'],
['the editor shows the stored theme', { 'opencompany-theme': 'atomic', ui_shell_mode: 'dev' }, 'atomic'],
- ['a removed theme opens in dark', { 'opencompany-theme': 'cyber', ui_shell_mode: 'dev' }, 'dark'],
+ ['a removed theme opens in dark', { 'opencompany-theme': 'cyber' }, 'dark'],
])('%s', (_label, stored, expected) => {
for (const [key, value] of Object.entries(stored)) localStorage.setItem(key, value);
new Function(prePaintScript())();
diff --git a/client/src/features/home/__tests__/homeHeader.test.tsx b/client/src/features/home/__tests__/homeHeader.test.tsx
index 98234250..20ca4a08 100644
--- a/client/src/features/home/__tests__/homeHeader.test.tsx
+++ b/client/src/features/home/__tests__/homeHeader.test.tsx
@@ -21,7 +21,7 @@ vi.mock('@/contexts/WebSocketContext', async (importOriginal) => ({
vi.mock('../../../app/useShellActions', () => ({ enterDev: vi.fn(), enterNormal: vi.fn() }));
vi.mock('../../../app/ShellModeSwitch', () => ({ useShellMode: () => 'normal' }));
vi.mock('../workspace/WorkspaceButton', () => ({ WorkspaceButton: () => null }));
-vi.mock('../header/ThemeButton', () => ({ ThemeButton: () => null }));
+vi.mock('@/components/ui/ThemeButton', () => ({ ThemeButton: () => null }));
vi.mock('../ui/pillToast', () => ({ pillToast: vi.fn() }));
vi.mock('@/lib/workspaceUpload', () => ({ uploadToWorkspace: vi.fn() }));
diff --git a/client/src/features/home/header/HomeHeader.tsx b/client/src/features/home/header/HomeHeader.tsx
index 9f521276..ee9cf0a7 100644
--- a/client/src/features/home/header/HomeHeader.tsx
+++ b/client/src/features/home/header/HomeHeader.tsx
@@ -18,6 +18,7 @@ import { ModeToggle } from '@/components/shell/ModeToggle';
import { Button } from '@/components/ui/button';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
import { Input } from '@/components/ui/input';
+import { ThemeButton } from '@/components/ui/ThemeButton';
import { cn } from '@/lib/utils';
import { useWorkflowControlPending } from '@/stores/workflowControlStore';
import { PHOTO_TYPES, useRenameEmployee, useSetEmployeePhoto } from '../data/identity';
@@ -31,7 +32,6 @@ import { pillToast } from '../ui/pillToast';
import { WorkspaceButton } from '../workspace/WorkspaceButton';
import { GuideButton } from './GuideButton';
import { NewConversationButton } from './NewConversationButton';
-import { ThemeButton } from './ThemeButton';
/** "Receptionist · WhatsApp, Google Calendar". */
function subtitleOf(employee: EmployeeSummary): string {
diff --git a/client/src/features/home/header/ThemeButton.tsx b/client/src/features/home/header/ThemeButton.tsx
deleted file mode 100644
index dfa5547e..00000000
--- a/client/src/features/home/header/ThemeButton.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * The Home header's sun/moon button (design handoff "theme button"): flips
- * between light and dark, revealing the new theme as a circle grown from
- * the button while the button spins once with a squash. Home shows only
- * those two themes; the full theme menu stays in Dev mode.
- */
-
-import { Moon, Sun } from 'lucide-react';
-import { Button } from '@/components/ui/button';
-import { isDarkTheme, useTheme } from '@/contexts/ThemeContext';
-import { animate } from '@/lib/motion';
-import { SPIKE, spikeOrb } from '../orb/orb';
-
-const SPIN: Keyframe[] = [
- { transform: 'rotate(0deg) scale(1)' },
- { transform: 'rotate(200deg) scale(.78)', offset: 0.45 },
- { transform: 'rotate(360deg) scale(1)' },
-];
-
-export function ThemeButton() {
- const { theme, toggleTheme } = useTheme();
- const dark = isDarkTheme(theme);
- const label = dark ? 'Switch to light mode' : 'Switch to dark mode';
- return (
- <Button
- variant="quiet"
- size="icon"
- aria-label={label}
- title={label}
- className="size-8.5 rounded-pill border-border-default"
- onClick={(event) => {
- const rect = event.currentTarget.getBoundingClientRect();
- animate(event.currentTarget, SPIN, { duration: 'theme-icon', easing: 'spring', fill: 'none' });
- spikeOrb(SPIKE.theme);
- toggleTheme({ reveal: true, origin: { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 } });
- }}
- >
- {dark ? <Sun aria-hidden strokeWidth={1.75} /> : <Moon aria-hidden strokeWidth={1.75} />}
- </Button>
- );
-}
-
-export default ThemeButton;
diff --git a/client/src/features/home/settings/ProfileTab.tsx b/client/src/features/home/settings/ProfileTab.tsx
index 02d607ee..40707340 100644
--- a/client/src/features/home/settings/ProfileTab.tsx
+++ b/client/src/features/home/settings/ProfileTab.tsx
@@ -15,7 +15,7 @@ import { Input } from '@/components/ui/input';
import { Switch } from '@/components/ui/switch';
import { Textarea } from '@/components/ui/textarea';
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
-import { isDarkTheme, useTheme } from '@/contexts/ThemeContext';
+import { AVAILABLE_THEMES, THEME_LABEL, useTheme } from '@/contexts/ThemeContext';
import { animate } from '@/lib/motion';
import {
browserTimezone,
@@ -167,27 +167,27 @@ export function ProfileTab({ onDone }: { onDone: () => void }) {
/>
<div data-stagger className="flex flex-col">
- <SettingRow title="Appearance" detail="Choose light or dark.">
+ <SettingRow title="Appearance" detail="Choose a theme.">
<ToggleGroup
type="single"
variant="segmented"
aria-label="Appearance"
- value={isDarkTheme(theme) ? 'dark' : 'light'}
+ value={theme}
// The new theme grows from where it was clicked.
onPointerDown={(event) => {
revealFrom.current = { x: event.clientX, y: event.clientY };
}}
onValueChange={(next) => {
- if (next === 'light' || next === 'dark') setTheme(next, { reveal: true, origin: revealFrom.current });
+ const chosen = AVAILABLE_THEMES.find((name) => name === next);
+ if (chosen) setTheme(chosen, { reveal: true, origin: revealFrom.current });
revealFrom.current = undefined;
}}
>
- <ToggleGroupItem value="light" className="px-3.5 text-xs">
- Light
- </ToggleGroupItem>
- <ToggleGroupItem value="dark" className="px-3.5 text-xs">
- Dark
- </ToggleGroupItem>
+ {AVAILABLE_THEMES.map((name) => (
+ <ToggleGroupItem key={name} value={name} className="px-3.5 text-xs">
+ {THEME_LABEL[name]}
+ </ToggleGroupItem>
+ ))}
</ToggleGroup>
</SettingRow>
<FormField
diff --git a/client/src/main.tsx b/client/src/main.tsx
index 70f62aad..e549e6f0 100644
--- a/client/src/main.tsx
+++ b/client/src/main.tsx
@@ -17,8 +17,8 @@ import './themes/atomic.css'
import './themes/animations.css'
import './index.css'
import App from './App'
-import { ShellThemeProvider } from './app/ShellThemeProvider'
import { AuthProvider } from './contexts/AuthContext'
+import { ThemeProvider } from './contexts/ThemeContext'
import { WebSocketProvider } from './contexts/WebSocketContext'
import { queryClient } from './lib/queryClient'
import {
@@ -39,13 +39,13 @@ createRoot(document.getElementById('root')!).render(
dehydrateOptions: { shouldDehydrateQuery: shouldPersistQuery },
}}
>
- <ShellThemeProvider>
+ <ThemeProvider>
<AuthProvider>
<WebSocketProvider>
<App />
</WebSocketProvider>
</AuthProvider>
- </ShellThemeProvider>
+ </ThemeProvider>
{import.meta.env.DEV && (
<ReactQueryDevtools initialIsOpen={false} buttonPosition="bottom-right" />
)}
diff --git a/client/src/store/useAppStore.ts b/client/src/store/useAppStore.ts
index 7449e61d..cab82acb 100644
--- a/client/src/store/useAppStore.ts
+++ b/client/src/store/useAppStore.ts
@@ -219,9 +219,8 @@ const loadBooleanFromStorage = (
};
/** The saved screen: `ui_shell_mode`, else the old palette choice
- * (`ui_pro_mode === 'true'` means Dev). index.html's pre-paint theme
- * script repeats this rule. */
-export const readStoredShellMode = (): ShellMode => {
+ * (`ui_pro_mode === 'true'` means Dev). */
+const readStoredShellMode = (): ShellMode => {
try {
const saved = localStorage.getItem(STORAGE_KEYS.shellMode);
if (saved === 'normal' || saved === 'dev') return saved;
diff --git a/client/src/stores/shellDialogsStore.ts b/client/src/stores/shellDialogsStore.ts
index 275c1c8d..d5b1494d 100644
--- a/client/src/stores/shellDialogsStore.ts
+++ b/client/src/stores/shellDialogsStore.ts
@@ -21,10 +21,6 @@ interface ShellDialogsState {
credentialsOptions: CredentialsOptions & { intent: CredentialsIntent };
/** Repeated opens are navigation requests, even when their target matches. */
credentialsRequestId: number;
- /** The sign-in gate's Connecting or sign-in screen is showing
- * (components/auth/ConnectScreen): the theme shows as its base. */
- connectScreenOpen: boolean;
- setConnectScreenOpen: (open: boolean) => void;
openSettings: () => void;
closeSettings: () => void;
openCredentials: (options?: CredentialsOptions) => void;
@@ -36,8 +32,6 @@ export const useShellDialogsStore = create<ShellDialogsState>((set) => ({
credentialsOpen: false,
credentialsOptions: { intent: 'manage' },
credentialsRequestId: 0,
- connectScreenOpen: false,
- setConnectScreenOpen: (open) => set({ connectScreenOpen: open }),
openSettings: () => set({ settingsOpen: true }),
closeSettings: () => set({ settingsOpen: false }),
openCredentials: (options) => set((state) => ({