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 } 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, notifications, and sound preferences.

{/* Appearance Section */}

Appearance

o.id === theme.themeId())} value={(o) => o.id} label={(o) => o.name} onSelect={(option) => option && theme.setTheme(option.id)} variant="secondary" size="small" /> o.id === settings.sounds.agent())} value={(o) => o.id} label={(o) => o.label} onSelect={(option) => { if (!option) return settings.sounds.setAgent(option.id) playSound(option.src) }} variant="secondary" size="small" /> o.id === settings.sounds.errors())} value={(o) => o.id} label={(o) => o.label} onSelect={(option) => { if (!option) return settings.sounds.setErrors(option.id) playSound(option.src) }} variant="secondary" size="small" />
) } interface SettingsRowProps { title: string description: string | JSX.Element children: JSX.Element } const SettingsRow: Component = (props) => { return (
{props.title} {props.description}
{props.children}
) }