From 0156f03e0ef4e256236256aac05f4fc10577280f Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Sun, 28 Dec 2025 19:26:46 -0600 Subject: chore: cleanup theme stuff --- packages/app/src/context/command.tsx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'packages/app/src/context/command.tsx') diff --git a/packages/app/src/context/command.tsx b/packages/app/src/context/command.tsx index 626bfdbe4..efd83bec8 100644 --- a/packages/app/src/context/command.tsx +++ b/packages/app/src/context/command.tsx @@ -3,7 +3,6 @@ import { createSimpleContext } from "@opencode-ai/ui/context" import { useDialog } from "@opencode-ai/ui/context/dialog" import { Dialog } from "@opencode-ai/ui/dialog" import { List } from "@opencode-ai/ui/list" -import { useTheme } from "@opencode-ai/ui/theme" const IS_MAC = typeof navigator === "object" && /(Mac|iPod|iPhone|iPad)/.test(navigator.platform) @@ -27,6 +26,7 @@ export interface CommandOption { suggested?: boolean disabled?: boolean onSelect?: (source?: "palette" | "keybind" | "slash") => void + onHighlight?: () => (() => void) | void } export function parseKeybind(config: string): Keybind[] { @@ -116,24 +116,18 @@ export function formatKeybind(config: string): string { function DialogCommand(props: { options: CommandOption[] }) { const dialog = useDialog() - const theme = useTheme() + let cleanup: (() => void) | void let committed = false const handleMove = (option: CommandOption | undefined) => { - if (!option) return - if (option.id.startsWith("theme.set.")) { - const id = option.id.replace("theme.set.", "") - theme.previewTheme(id) - } else if (option.id.startsWith("theme.scheme.") && !option.id.includes("cycle")) { - const scheme = option.id.replace("theme.scheme.", "") as "light" | "dark" | "system" - theme.previewColorScheme(scheme) - } + cleanup?.() + cleanup = option?.onHighlight?.() } const handleSelect = (option: CommandOption | undefined) => { if (option) { - theme.commitPreview() committed = true + cleanup = undefined dialog.close() option.onSelect?.("palette") } @@ -141,7 +135,7 @@ function DialogCommand(props: { options: CommandOption[] }) { onCleanup(() => { if (!committed) { - theme.cancelPreview() + cleanup?.() } }) -- cgit v1.2.3