mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 06:40:43 +00:00
fix(ui): address custom theme review cleanup
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user