@@ -65,6 +65,7 @@ import parsers from "../../../../../../parsers-config.ts"
6565import { Clipboard } from "../../util/clipboard"
6666import { Toast , useToast } from "../../ui/toast"
6767import { DialogSessionRename } from "../../component/dialog-session-rename"
68+ import { useKV } from "../../context/kv.tsx"
6869
6970addDefaultParsers ( parsers . parsers )
7071
@@ -82,6 +83,7 @@ function use() {
8283export function Session ( ) {
8384 const route = useRouteData ( "session" )
8485 const sync = useSync ( )
86+ const kv = useKV ( )
8587 const { theme } = useTheme ( )
8688 const session = createMemo ( ( ) => sync . session . get ( route . sessionID ) ! )
8789 const messages = createMemo ( ( ) => sync . data . message [ route . sessionID ] ?? [ ] )
@@ -92,7 +94,7 @@ export function Session() {
9294 } )
9395
9496 const dimensions = useTerminalDimensions ( )
95- const [ sidebar , setSidebar ] = createSignal < "show" | "hide" | "auto" > ( " auto")
97+ const [ sidebar , setSidebar ] = createSignal < "show" | "hide" | "auto" > ( kv . get ( "sidebar" , " auto") )
9698 const [ conceal , setConceal ] = createSignal ( true )
9799
98100 const wide = createMemo ( ( ) => dimensions ( ) . width > 120 )
@@ -200,19 +202,18 @@ export function Session() {
200202 disabled : ! ! session ( ) ?. share ?. url ,
201203 category : "Session" ,
202204 onSelect : async ( dialog ) => {
203- await sdk . client . session . share ( {
204- path : {
205- id : route . sessionID ,
206- } ,
207- } )
205+ await sdk . client . session
206+ . share ( {
207+ path : {
208+ id : route . sessionID ,
209+ } ,
210+ } )
208211 . then ( ( res ) =>
209212 Clipboard . copy ( res . data ! . share ! . url ) . catch ( ( ) =>
210- toast . show ( { message : "Failed to copy URL to clipboard" , variant : "error" } )
211- )
212- )
213- . then ( ( ) =>
214- toast . show ( { message : "Share URL copied to clipboard!" , variant : "success" } )
213+ toast . show ( { message : "Failed to copy URL to clipboard" , variant : "error" } ) ,
214+ ) ,
215215 )
216+ . then ( ( ) => toast . show ( { message : "Share URL copied to clipboard!" , variant : "success" } ) )
216217 . catch ( ( ) => toast . show ( { message : "Failed to share session" , variant : "error" } ) )
217218 dialog . clear ( )
218219 } ,
@@ -306,6 +307,8 @@ export function Session() {
306307 if ( prev === "show" ) return "hide"
307308 return "show"
308309 } )
310+ if ( sidebar ( ) === "show" ) kv . set ( "sidebar" , "auto" )
311+ if ( sidebar ( ) === "hide" ) kv . set ( "sidebar" , "hide" )
309312 dialog . clear ( )
310313 } ,
311314 } ,
0 commit comments