From 640df819121ffd48d014b656a4379dcbce56428a Mon Sep 17 00:00:00 2001 From: Val Alexander Date: Fri, 24 Apr 2026 20:07:36 -0500 Subject: [PATCH] fix(ui): address custom theme review cleanup --- ui/src/styles/config.css | 14 -------------- ui/src/ui/custom-theme.test.ts | 9 +++++++++ ui/src/ui/custom-theme.ts | 2 +- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/ui/src/styles/config.css b/ui/src/styles/config.css index 345a4f86aa4..ff4e4e534fe 100644 --- a/ui/src/styles/config.css +++ b/ui/src/styles/config.css @@ -559,26 +559,12 @@ transform: translateY(-1px); } -.settings-theme-card:disabled { - cursor: not-allowed; -} - .settings-theme-card--active { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 10%, var(--bg-elevated)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent); } -.settings-theme-card--disabled { - opacity: 0.6; -} - -.settings-theme-card--disabled:hover { - border-color: var(--border); - background: var(--bg); - transform: none; -} - .settings-theme-card__icon, .settings-theme-card__check { display: inline-flex; diff --git a/ui/src/ui/custom-theme.test.ts b/ui/src/ui/custom-theme.test.ts index baa7025901c..35b39cd5734 100644 --- a/ui/src/ui/custom-theme.test.ts +++ b/ui/src/ui/custom-theme.test.ts @@ -7,6 +7,7 @@ import { parseImportedCustomTheme, syncCustomThemeStyleTag, } from "./custom-theme.ts"; +import type { ImportedCustomTheme } from "./custom-theme.ts"; function createTweakcnPayload() { return { @@ -183,6 +184,14 @@ describe("custom theme import helpers", () => { expect(css).toContain("--bg: oklch(0.98 0.01 120);"); }); + it("throws when stored custom theme tokens are missing", () => { + const theme = { ...createImportedTheme(), light: undefined } as unknown as ImportedCustomTheme; + + expect(() => buildCustomThemeStyles(theme)).toThrow( + "Stored custom theme is missing required tokens.", + ); + }); + it("parses stored imported themes and rejects malformed records", () => { const imported = createImportedTheme(); diff --git a/ui/src/ui/custom-theme.ts b/ui/src/ui/custom-theme.ts index 723510a9204..cf99e496ac0 100644 --- a/ui/src/ui/custom-theme.ts +++ b/ui/src/ui/custom-theme.ts @@ -504,7 +504,7 @@ export function buildCustomThemeStyles(theme: ImportedCustomTheme) { const light = normalizeStoredTokenMap(theme.light); const dark = normalizeStoredTokenMap(theme.dark); if (!light || !dark) { - return ""; + throw new Error("Stored custom theme is missing required tokens."); } const renderDeclarations = (modeTokens: ThemeTokenMap) => MODE_TOKEN_ORDER.map((key) => ` --${key}: ${modeTokens[key]};`).join("\n");