@@ -6,7 +6,6 @@ import { Switch } from "@opencode-ai/ui/v2/switch-v2"
66import { TextInputV2 } from "@opencode-ai/ui/v2/text-input-v2"
77import { useTheme , type ColorScheme } from "@opencode-ai/ui/theme/context"
88import { useDialog } from "@opencode-ai/ui/context/dialog"
9- import { useParams } from "@solidjs/router"
109import { useLanguage } from "@/context/language"
1110import { usePermission } from "@/context/permission"
1211import { usePlatform } from "@/context/platform"
@@ -25,7 +24,6 @@ import {
2524 terminalInput ,
2625 useSettings ,
2726} from "@/context/settings"
28- import { decode64 } from "@/utils/base64"
2927import { playSoundById , SOUND_OPTIONS } from "@/utils/sound"
3028import { Link } from "../link"
3129import { SettingsListV2 } from "./parts/list"
@@ -82,50 +80,46 @@ const playDemoSound = (id: string | undefined) => {
8280 } , 100 )
8381}
8482
85- export const SettingsGeneralV2 : Component = ( ) => {
83+ export const SettingsGeneralV2 : Component < {
84+ sessionID ?: string
85+ } > = ( props ) => {
8686 const theme = useTheme ( )
8787 const language = useLanguage ( )
8888 const permission = usePermission ( )
8989 const platform = usePlatform ( )
9090 const dialog = useDialog ( )
91- const params = useParams ( )
9291 const settings = useSettings ( )
92+ const serverSync = useServerSync ( )
93+ const serverSdk = useServerSDK ( )
9394 const mobile = createMediaQuery ( "(max-width: 767px)" )
9495
9596 const updater = useUpdaterAction ( )
9697
97- const dir = createMemo ( ( ) => decode64 ( params . dir ) )
98+ const dir = createMemo ( ( ) => {
99+ if ( ! props . sessionID ) return undefined
100+ return serverSync ( ) . session . lineage . peek ( props . sessionID ) ?. session . directory
101+ } )
98102 const accepting = createMemo ( ( ) => {
99103 const value = dir ( )
100- if ( ! value ) return false
101- if ( ! params . id ) return permission . isAutoAcceptingDirectory ( value )
102- return permission . isAutoAccepting ( params . id , value )
104+ if ( ! value || ! props . sessionID ) return false
105+ return permission . isAutoAccepting ( props . sessionID , value )
103106 } )
104107
105108 const toggleAccept = ( checked : boolean ) => {
106109 const value = dir ( )
107- if ( ! value ) return
108-
109- if ( ! params . id ) {
110- if ( permission . isAutoAcceptingDirectory ( value ) === checked ) return
111- permission . toggleAutoAcceptDirectory ( value )
112- return
113- }
110+ if ( ! value || ! props . sessionID ) return
114111
115112 if ( checked ) {
116- permission . enableAutoAccept ( params . id , value )
113+ permission . enableAutoAccept ( props . sessionID , value )
117114 return
118115 }
119116
120- permission . disableAutoAccept ( params . id , value )
117+ permission . disableAutoAccept ( props . sessionID , value )
121118 }
122119 const desktop = createMemo ( ( ) => platform . platform === "desktop" )
123120
124121 const themeOptions = createMemo < ThemeOption [ ] > ( ( ) => theme . ids ( ) . map ( ( id ) => ( { id, name : theme . name ( id ) } ) ) )
125122
126- const serverSync = useServerSync ( )
127- const serverSdk = useServerSDK ( )
128-
129123 const [ shells ] = createResource (
130124 ( ) =>
131125 serverSdk ( )
0 commit comments