33 * icon, then one status dot per session, still navigable. Archived sessions
44 * drop to a collapsed section at the bottom of the expanded view. */
55import { createEffect , createMemo , createSignal , For , onCleanup , Show } from "solid-js"
6- import { A } from "@solidjs/router"
6+ import { A , useLocation } from "@solidjs/router"
77import { es , type SessionSearchResult } from "../api"
88import { sessionHref , useDashboard , type DotState , type SessionRow } from "../state"
99import { leftOpen , leftWidth , toggleLeft } from "../ui"
@@ -67,6 +67,17 @@ export default function Sidebar() {
6767 // carry their host and open on that host's own tab; a host that stops answering keeps its last
6868 // rows, dimmed and disabled, never emptied or merged into this host's.
6969 const hosted = ( ) => work . feeds ( ) . length > 0
70+ // The open session's host-qualified key. The same session ID can exist on Local and on another host, so the
71+ // path alone cannot say which row is open; `?host=` (absent or "local": this page's Core) decides, as the
72+ // session page does.
73+ const location = useLocation ( )
74+ const openKey = createMemo ( ( ) => {
75+ const match = / ^ \/ s e s s i o n \/ ( [ ^ / ] + ) / . exec ( location . pathname )
76+ if ( ! match ) return undefined
77+ const host = location . query . host
78+ return hostRowKey ( { id : decodeURIComponent ( match [ 1 ] ) , host : typeof host === "string" && host && host !== "local" ? host : undefined } )
79+ } )
80+ const isOpen = ( s : SessionRow ) => openKey ( ) === hostRowKey ( s )
7081 // Unified Work: this machine and every other Work host, all shown by default. Hiding a host is a per-page
7182 // choice stored as the hidden set, so a host added later is shown; Personal pages have no Work strip.
7283 const ownHost = ( ) => host ( ) ?. work . find ( ( item ) => item . id === host ( ) ?. id ) ?? { id : host ( ) ?. id ?? "local" , label : "Local" }
@@ -282,31 +293,33 @@ export default function Sidebar() {
282293 if ( s . host ) return hostItem ( s )
283294 const dot = createMemo ( ( ) => dotFor ( s ) )
284295 return cls === "archived" ? (
285- < A
296+ < a
286297 href = { sessionHref ( s . id , s . directory ) }
287- activeClass = "active"
288298 class = "nav-item archived"
299+ classList = { { active : isOpen ( s ) } }
300+ aria-current = { isOpen ( s ) ? "page" : undefined }
289301 { ...peekAttrs ( s ) }
290302 >
291303 < StatusDot state = { dot ( ) } label = { dotText ( s , dot ( ) ) } />
292304 < span class = "nav-title" dir = "auto" > { s . title || s . id } </ span >
293305 { /* All scope: the project lives in the hover/focus card; screen readers still hear it here. */ }
294306 < Show when = { allProjects ( ) && s . project } > < span class = "sr-only" > , { s . project } </ span > </ Show >
295- </ A >
307+ </ a >
296308 ) : (
297309 < div class = "session-entry" { ...peekAttrs ( s ) } >
298- < A
310+ < a
299311 ref = { ( el ) => observeSession ( el , s . id ) }
300312 href = { sessionHref ( s . id , s . directory ) }
301- activeClass = "active"
302313 class = "nav-item"
314+ classList = { { active : isOpen ( s ) } }
315+ aria-current = { isOpen ( s ) ? "page" : undefined }
303316 >
304317 < StatusDot state = { dot ( ) } label = { dotText ( s , dot ( ) ) } />
305318 < Show when = { hosted ( ) } > < HostGlyph host = "local" /> </ Show >
306319 < span class = "nav-title" dir = "auto" > { s . title || s . id } </ span >
307320 < Show when = { allProjects ( ) && s . project } > < span class = "sr-only" > , { s . project } </ span > </ Show >
308321 < Show when = { hosted ( ) } > < span class = "sr-only" > , on Local</ span > </ Show >
309- </ A >
322+ </ a >
310323 < button type = "button" class = "pin-action" classList = { { pinned : isPinned ( s ) } }
311324 aria-label = { `${ isPinned ( s ) ? "Unpin" : "Pin" } ${ s . title || s . id } ` }
312325 title = { `${ isPinned ( s ) ? "Unpin" : "Pin" } ${ s . title || s . id } ` }
@@ -324,7 +337,8 @@ export default function Sidebar() {
324337 const name = ( ) => `${ s . title || s . id } , on ${ label ( ) } ${ down ( ) ? ", unavailable" : "" } `
325338 return (
326339 < div class = "session-entry host-entry" classList = { { unavailable : down ( ) } } >
327- < a href = { feed ? hostSessionHref ( feed . host , s ) : undefined } class = "nav-item" aria-label = { name ( ) } aria-disabled = { down ( ) || undefined }
340+ < a href = { feed ? hostSessionHref ( feed . host , s ) : undefined } class = "nav-item" classList = { { active : isOpen ( s ) } }
341+ aria-current = { isOpen ( s ) ? "page" : undefined } aria-label = { name ( ) } aria-disabled = { down ( ) || undefined }
328342 title = { down ( ) ? `${ label ( ) } · unreachable since ${ clock ( feed ?. state ( ) . since ?? Date . now ( ) ) } ; last-known list, actions disabled` : `${ s . title || s . id } — on ${ label ( ) } ` }
329343 data-host-key = { hostRowKey ( s ) } onClick = { ( event ) => { if ( down ( ) ) event . preventDefault ( ) } } >
330344 < StatusDot state = { dot ( ) } label = { `${ label ( ) } : ${ dot ( ) } ` } />
@@ -356,7 +370,8 @@ export default function Sidebar() {
356370 if ( s . host ) {
357371 const feed = feedOf ( s )
358372 return < div class = "mini-session" classList = { { unavailable : feed ?. state ( ) . status === "unavailable" } } >
359- < a href = { feed ? hostSessionHref ( feed . host , s ) : undefined } class = "mini-item" title = { `${ s . title } — on ${ feed ?. host . label ?? s . host } ` }
373+ < a href = { feed ? hostSessionHref ( feed . host , s ) : undefined } class = "mini-item" classList = { { active : isOpen ( s ) } }
374+ aria-current = { isOpen ( s ) ? "page" : undefined } title = { `${ s . title } — on ${ feed ?. host . label ?? s . host } ` }
360375 aria-label = { `${ s . title || s . id } , on ${ feed ?. host . label ?? s . host } ` } >
361376 < StatusDot state = { work . dot ( s ) } />
362377 </ a >
@@ -365,11 +380,11 @@ export default function Sidebar() {
365380 const dot = createMemo ( ( ) => dotFor ( s ) )
366381 return (
367382 < div class = "mini-session" { ...peekAttrs ( s ) } >
368- < A ref = { ( el ) => observeSession ( el , s . id ) } href = { sessionHref ( s . id , s . directory ) }
369- activeClass = "active" class = "mini-item"
383+ < a ref = { ( el ) => observeSession ( el , s . id ) } href = { sessionHref ( s . id , s . directory ) }
384+ class = "mini-item" classList = { { active : isOpen ( s ) } } aria-current = { isOpen ( s ) ? "page" : undefined }
370385 title = { `${ s . title } (${ dotText ( s , dot ( ) ) } )${ allProjects ( ) ? ` · ${ s . project } ` : "" } ` } >
371386 < StatusDot state = { dot ( ) } label = { `${ s . title || s . id } : ${ dotText ( s , dot ( ) ) } ` } />
372- </ A >
387+ </ a >
373388 < button type = "button" class = "mini-pin" classList = { { pinned : isPinned ( s ) } }
374389 aria-label = { `${ isPinned ( s ) ? "Unpin" : "Pin" } ${ s . title || s . id } ` }
375390 title = { `${ isPinned ( s ) ? "Unpin" : "Pin" } ${ s . title || s . id } ` }
0 commit comments