From 20100a0982da7fc2fd8eeb5297f0ee47eb3a9ce0 Mon Sep 17 00:00:00 2001 From: Val Alexander Date: Mon, 9 Mar 2026 20:04:17 -0500 Subject: [PATCH] ui: fix review follow-ups for dashboard tabs --- ui/src/ui/app-settings.ts | 4 ++-- ui/src/ui/navigation-groups.test.ts | 9 +++++++++ ui/src/ui/navigation.ts | 11 +---------- ui/src/ui/theme.test.ts | 7 ++++++- ui/src/ui/theme.ts | 6 ++++++ 5 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 ui/src/ui/navigation-groups.test.ts diff --git a/ui/src/ui/app-settings.ts b/ui/src/ui/app-settings.ts index 55dd59ace0d..473ab45c4f4 100644 --- a/ui/src/ui/app-settings.ts +++ b/ui/src/ui/app-settings.ts @@ -36,7 +36,7 @@ import { } from "./navigation.ts"; import { saveSettings, type UiSettings } from "./storage.ts"; import { startThemeTransition, type ThemeTransitionContext } from "./theme-transition.ts"; -import { resolveTheme, type ResolvedTheme, type ThemeMode } from "./theme.ts"; +import { colorSchemeForTheme, resolveTheme, type ResolvedTheme, type ThemeMode } from "./theme.ts"; import type { AgentsListResult } from "./types.ts"; type SettingsHost = { @@ -273,7 +273,7 @@ export function applyResolvedTheme(host: SettingsHost, resolved: ResolvedTheme) } const root = document.documentElement; root.dataset.theme = resolved; - root.style.colorScheme = resolved; + root.style.colorScheme = colorSchemeForTheme(resolved); } export function attachThemeListener(host: SettingsHost) { diff --git a/ui/src/ui/navigation-groups.test.ts b/ui/src/ui/navigation-groups.test.ts new file mode 100644 index 00000000000..2e2bb58e58d --- /dev/null +++ b/ui/src/ui/navigation-groups.test.ts @@ -0,0 +1,9 @@ +import { describe, expect, it } from "vitest"; +import { TAB_GROUPS } from "./navigation.ts"; + +describe("TAB_GROUPS", () => { + it("does not expose unfinished settings slices in the sidebar", () => { + const settings = TAB_GROUPS.find((group) => group.label === "settings"); + expect(settings?.tabs).toEqual(["config", "debug", "logs"]); + }); +}); diff --git a/ui/src/ui/navigation.ts b/ui/src/ui/navigation.ts index 20c8a2a7d8a..2945560af62 100644 --- a/ui/src/ui/navigation.ts +++ b/ui/src/ui/navigation.ts @@ -10,16 +10,7 @@ export const TAB_GROUPS = [ { label: "agent", tabs: ["agents", "skills", "nodes"] }, { label: "settings", - tabs: [ - "config", - "communications", - "appearance", - "automation", - "infrastructure", - "aiAgents", - "debug", - "logs", - ], + tabs: ["config", "debug", "logs"], }, ] as const; diff --git a/ui/src/ui/theme.test.ts b/ui/src/ui/theme.test.ts index a151d8cca96..68a855a4478 100644 --- a/ui/src/ui/theme.test.ts +++ b/ui/src/ui/theme.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from "vitest"; -import { parseThemeSelection, resolveTheme } from "./theme.ts"; +import { colorSchemeForTheme, parseThemeSelection, resolveTheme } from "./theme.ts"; describe("resolveTheme", () => { it("keeps the legacy mode-only signature working for existing callers", () => { @@ -17,6 +17,11 @@ describe("resolveTheme", () => { expect(resolveTheme("knot")).toBe("openknot-light"); vi.unstubAllGlobals(); }); + + it("maps resolved theme families back to valid CSS color-scheme values", () => { + expect(colorSchemeForTheme("openknot")).toBe("dark"); + expect(colorSchemeForTheme("dash-light")).toBe("light"); + }); }); describe("parseThemeSelection", () => { diff --git a/ui/src/ui/theme.ts b/ui/src/ui/theme.ts index e4a7b730147..1e30beab47d 100644 --- a/ui/src/ui/theme.ts +++ b/ui/src/ui/theme.ts @@ -91,3 +91,9 @@ export function resolveTheme(themeOrMode: ThemeName | ThemeMode, mode?: ThemeMod } return resolvedMode === "light" ? "dash-light" : "dash"; } + +export function colorSchemeForTheme(theme: ResolvedTheme): "light" | "dark" { + return theme === "light" || theme === "openknot-light" || theme === "dash-light" + ? "light" + : "dark"; +}