import { Component, createMemo, type JSX } from "solid-js" import { Select } from "@opencode-ai/ui/select" import { Switch } from "@opencode-ai/ui/switch" import { useTheme, type ColorScheme } from "@opencode-ai/ui/theme" import { useSettings, monoFontFamily } from "@/context/settings" import { playSound, SOUND_OPTIONS } from "@/utils/sound" export const SettingsGeneral: Component = () => { const theme = useTheme() const settings = useSettings() const themeOptions = createMemo(() => Object.entries(theme.themes()).map(([id, def]) => ({ id, name: def.name ?? id })), ) const colorSchemeOptions: { value: ColorScheme; label: string }[] = [ { value: "system", label: "System setting" }, { value: "light", label: "Light" }, { value: "dark", label: "Dark" }, ] const fontOptions = [ { value: "ibm-plex-mono", label: "IBM Plex Mono" }, { value: "cascadia-code", label: "Cascadia Code" }, { value: "fira-code", label: "Fira Code" }, { value: "hack", label: "Hack" }, { value: "inconsolata", label: "Inconsolata" }, { value: "intel-one-mono", label: "Intel One Mono" }, { value: "jetbrains-mono", label: "JetBrains Mono" }, { value: "meslo-lgs", label: "Meslo LGS" }, { value: "roboto-mono", label: "Roboto Mono" }, { value: "source-code-pro", label: "Source Code Pro" }, { value: "ubuntu-mono", label: "Ubuntu Mono" }, ] const soundOptions = [...SOUND_OPTIONS] return (

General

{/* Appearance Section */}

Appearance

o.id === theme.themeId())} value={(o) => o.id} label={(o) => o.name} onSelect={(option) => { if (!option) return theme.setTheme(option.id) }} onHighlight={(option) => { if (!option) return theme.previewTheme(option.id) return () => theme.cancelPreview() }} variant="secondary" size="small" triggerVariant="settings" />
{/* System notifications Section */}

System notifications

settings.notifications.setAgent(checked)} /> settings.notifications.setPermissions(checked)} /> settings.notifications.setErrors(checked)} />
{/* Sound effects Section */}

Sound effects

o.id === settings.sounds.permissions())} value={(o) => o.id} label={(o) => o.label} onHighlight={(option) => { if (!option) return playSound(option.src) }} onSelect={(option) => { if (!option) return settings.sounds.setPermissions(option.id) playSound(option.src) }} variant="secondary" size="small" triggerVariant="settings" />