1- import { Component , Show , createMemo , createResource , onMount } from "solid-js"
1+ import { Component , Show , createMemo , createResource } from "solid-js"
22import { ButtonV2 } from "@opencode-ai/ui/v2/button-v2"
33import { Icon } from "@opencode-ai/ui/icon"
44import { SelectV2 } from "@opencode-ai/ui/v2/select-v2"
55import { Switch } from "@opencode-ai/ui/v2/switch-v2"
6- import { TextInputV2 } from "@opencode-ai/ui/v2/text-input-v2"
76import { Tooltip } from "@opencode-ai/ui/tooltip"
8- import { useTheme , type ColorScheme } from "@opencode-ai/ui/theme/context"
9- import { useDialog } from "@opencode-ai/ui/context/dialog"
107import { useParams } from "@solidjs/router"
118import { useLanguage } from "@/context/language"
129import { usePermission } from "@/context/permission"
1310import { usePlatform , type DisplayBackend } from "@/context/platform"
1411import { useServerSync } from "@/context/server-sync"
1512import { useServerSDK } from "@/context/server-sdk"
1613import { useUpdaterAction } from "../updater-action"
17- import {
18- monoDefault ,
19- monoFontFamily ,
20- monoInput ,
21- sansDefault ,
22- sansFontFamily ,
23- sansInput ,
24- terminalDefault ,
25- terminalFontFamily ,
26- terminalInput ,
27- useSettings ,
28- } from "@/context/settings"
14+ import { useSettings } from "@/context/settings"
2915import { decode64 } from "@/utils/base64"
3016import { playSoundById , SOUND_OPTIONS } from "@/utils/sound"
31- import { Link } from "../link"
3217import { SettingsListV2 } from "./parts/list"
3318import { SettingsRowV2 } from "./parts/row"
3419import "./settings-v2.css"
@@ -39,11 +24,6 @@ let demoSoundState = {
3924 run : 0 ,
4025}
4126
42- type ThemeOption = {
43- id : string
44- name : string
45- }
46-
4727type ShellOption = {
4828 path : string
4929 name : string
@@ -84,11 +64,9 @@ const playDemoSound = (id: string | undefined) => {
8464}
8565
8666export const SettingsGeneralV2 : Component = ( ) => {
87- const theme = useTheme ( )
8867 const language = useLanguage ( )
8968 const permission = usePermission ( )
9069 const platform = usePlatform ( )
91- const dialog = useDialog ( )
9270 const params = useParams ( )
9371 const settings = useSettings ( )
9472
@@ -122,8 +100,6 @@ export const SettingsGeneralV2: Component = () => {
122100 }
123101 const desktop = createMemo ( ( ) => platform . platform === "desktop" )
124102
125- const themeOptions = createMemo < ThemeOption [ ] > ( ( ) => theme . ids ( ) . map ( ( id ) => ( { id, name : theme . name ( id ) } ) ) )
126-
127103 const serverSync = useServerSync ( )
128104 const serverSdk = useServerSDK ( )
129105
@@ -148,10 +124,6 @@ export const SettingsGeneralV2: Component = () => {
148124 { initialValue : false } ,
149125 )
150126
151- onMount ( ( ) => {
152- void theme . loadThemes ( )
153- } )
154-
155127 const autoOption = { id : "auto" , value : "" , label : language . t ( "settings.general.row.shell.autoDefault" ) }
156128 const currentShell = createMemo ( ( ) => serverSync . data . config . shell ?? "" )
157129
@@ -201,12 +173,6 @@ export const SettingsGeneralV2: Component = () => {
201173 void update . catch ( ( ) => setPinchZoom ( ! checked ) )
202174 }
203175
204- const colorSchemeOptions = createMemo ( ( ) : { value : ColorScheme ; label : string } [ ] => [
205- { value : "system" , label : language . t ( "theme.scheme.system" ) } ,
206- { value : "light" , label : language . t ( "theme.scheme.light" ) } ,
207- { value : "dark" , label : language . t ( "theme.scheme.dark" ) } ,
208- ] )
209-
210176 const languageOptions = createMemo ( ( ) =>
211177 language . locales . map ( ( locale ) => ( {
212178 value : locale ,
@@ -216,9 +182,6 @@ export const SettingsGeneralV2: Component = () => {
216182
217183 const noneSound = { id : "none" , label : "sound.option.none" } as const
218184 const soundOptions = [ noneSound , ...SOUND_OPTIONS ]
219- const mono = ( ) => monoInput ( settings . appearance . font ( ) )
220- const sans = ( ) => sansInput ( settings . appearance . uiFont ( ) )
221- const terminal = ( ) => terminalInput ( settings . appearance . terminalFont ( ) )
222185
223186 const soundSelectProps = (
224187 enabled : ( ) => boolean ,
@@ -344,24 +307,6 @@ export const SettingsGeneralV2: Component = () => {
344307 />
345308 </ div >
346309 </ SettingsRowV2 >
347-
348- < SettingsRowV2
349- title = { language . t ( "settings.general.row.newLayoutDesigns.title" ) }
350- description = { language . t ( "settings.general.row.newLayoutDesigns.description" ) }
351- >
352- < div data-action = "settings-new-layout-designs" >
353- < Switch
354- checked = { settings . general . newLayoutDesigns ( ) }
355- onChange = { ( checked ) => {
356- settings . general . setNewLayoutDesigns ( checked )
357- if ( checked ) return
358- void import ( "@/components/dialog-settings" ) . then ( ( module ) => {
359- dialog . show ( ( ) => < module . DialogSettings /> )
360- } )
361- } }
362- />
363- </ div >
364- </ SettingsRowV2 >
365310 </ SettingsListV2 >
366311 </ div >
367312 )
@@ -446,134 +391,6 @@ export const SettingsGeneralV2: Component = () => {
446391 </ div >
447392 )
448393
449- const AppearanceSection = ( ) => (
450- < div class = "settings-v2-section" >
451- < h3 class = "settings-v2-section-title" > { language . t ( "settings.general.section.appearance" ) } </ h3 >
452-
453- < SettingsListV2 >
454- < SettingsRowV2
455- title = { language . t ( "settings.general.row.colorScheme.title" ) }
456- description = { language . t ( "settings.general.row.colorScheme.description" ) }
457- >
458- < SelectV2
459- appearance = "inline"
460- data-action = "settings-color-scheme"
461- options = { colorSchemeOptions ( ) }
462- current = { colorSchemeOptions ( ) . find ( ( o ) => o . value === theme . colorScheme ( ) ) }
463- placement = "bottom-end"
464- gutter = { 6 }
465- value = { ( o ) => o . value }
466- label = { ( o ) => o . label }
467- onSelect = { ( option ) => option && theme . setColorScheme ( option . value ) }
468- onHighlight = { ( option ) => {
469- if ( ! option ) return
470- theme . previewColorScheme ( option . value )
471- return ( ) => theme . cancelPreview ( )
472- } }
473- />
474- </ SettingsRowV2 >
475-
476- < SettingsRowV2
477- title = { language . t ( "settings.general.row.theme.title" ) }
478- description = {
479- < >
480- { language . t ( "settings.general.row.theme.description" ) } { " " }
481- < Link class = "settings-v2-link" href = "https://opencode.ai/docs/themes/" >
482- { language . t ( "common.learnMore" ) }
483- </ Link >
484- </ >
485- }
486- >
487- < SelectV2
488- appearance = "inline"
489- data-action = "settings-theme"
490- options = { themeOptions ( ) }
491- current = { themeOptions ( ) . find ( ( o ) => o . id === theme . themeId ( ) ) }
492- placement = "bottom-end"
493- gutter = { 6 }
494- value = { ( o ) => o . id }
495- label = { ( o ) => o . name }
496- onSelect = { ( option ) => {
497- if ( ! option ) return
498- theme . setTheme ( option . id )
499- } }
500- onHighlight = { ( option ) => {
501- if ( ! option ) return
502- theme . previewTheme ( option . id )
503- return ( ) => theme . cancelPreview ( )
504- } }
505- />
506- </ SettingsRowV2 >
507-
508- < SettingsRowV2
509- title = { language . t ( "settings.general.row.uiFont.title" ) }
510- description = { language . t ( "settings.general.row.uiFont.description" ) }
511- >
512- < div class = "w-full sm:w-[220px]" >
513- < TextInputV2
514- data-action = "settings-ui-font"
515- type = "text"
516- appearance = "base"
517- value = { sans ( ) }
518- onInput = { ( event ) => settings . appearance . setUIFont ( event . currentTarget . value ) }
519- placeholder = { sansDefault }
520- spellcheck = { false }
521- autocorrect = "off"
522- autocomplete = "off"
523- autocapitalize = "off"
524- aria-label = { language . t ( "settings.general.row.uiFont.title" ) }
525- style = { { "font-family" : sansFontFamily ( settings . appearance . uiFont ( ) ) } }
526- />
527- </ div >
528- </ SettingsRowV2 >
529-
530- < SettingsRowV2
531- title = { language . t ( "settings.general.row.font.title" ) }
532- description = { language . t ( "settings.general.row.font.description" ) }
533- >
534- < div class = "w-full sm:w-[220px]" >
535- < TextInputV2
536- data-action = "settings-code-font"
537- type = "text"
538- appearance = "base"
539- value = { mono ( ) }
540- onInput = { ( event ) => settings . appearance . setFont ( event . currentTarget . value ) }
541- placeholder = { monoDefault }
542- spellcheck = { false }
543- autocorrect = "off"
544- autocomplete = "off"
545- autocapitalize = "off"
546- aria-label = { language . t ( "settings.general.row.font.title" ) }
547- style = { { "font-family" : monoFontFamily ( settings . appearance . font ( ) ) } }
548- />
549- </ div >
550- </ SettingsRowV2 >
551-
552- < SettingsRowV2
553- title = { language . t ( "settings.general.row.terminalFont.title" ) }
554- description = { language . t ( "settings.general.row.terminalFont.description" ) }
555- >
556- < div class = "w-full sm:w-[220px]" >
557- < TextInputV2
558- data-action = "settings-terminal-font"
559- type = "text"
560- appearance = "base"
561- value = { terminal ( ) }
562- onInput = { ( event ) => settings . appearance . setTerminalFont ( event . currentTarget . value ) }
563- placeholder = { terminalDefault }
564- spellcheck = { false }
565- autocorrect = "off"
566- autocomplete = "off"
567- autocapitalize = "off"
568- aria-label = { language . t ( "settings.general.row.terminalFont.title" ) }
569- style = { { "font-family" : terminalFontFamily ( settings . appearance . terminalFont ( ) ) } }
570- />
571- </ div >
572- </ SettingsRowV2 >
573- </ SettingsListV2 >
574- </ div >
575- )
576-
577394 const NotificationsSection = ( ) => (
578395 < div class = "settings-v2-section" >
579396 < h3 class = "settings-v2-section-title" > { language . t ( "settings.general.section.notifications" ) } </ h3 >
@@ -757,8 +574,6 @@ export const SettingsGeneralV2: Component = () => {
757574 < div class = "settings-v2-tab-body" >
758575 < GeneralSection />
759576
760- < AppearanceSection />
761-
762577 < NotificationsSection />
763578
764579 < SoundsSection />
0 commit comments