feat(sidebar): add repo-grouped session navigation with live status (#361)

* feat(sidebar): add repo-grouped session navigation with live status

- Add a searchable, collapsible session tree to the desktop sidebar, grouped by repository with pinned and time-bucketed ordering.
- Track per-session busy, retry, and compact status in a shared store fed by the SSE event stream and scoped by directory.
- Extract shared navigation components reused by the desktop tree and the mobile repo quick-switch sheet.
- Show a Git tab and hide Schedules inside a repo on the mobile tab bar; add Repos and Assistant entries to the session More drawer.
- Replace the CommitsTab local relative-time formatter with a shared formatShortRelativeTime util.

* refactor(sidebar): unify session status tracking and navigation helpers

* feat(sidebar): add collapsible sessions and menu sections

* fix(sessions): keep specific live status over snapshot busy
This commit is contained in:
Chris Scott authored and GitHub committed 2026-09-26 21:50:23 -04:00
1 parent 1389e8e59c
commit 015a44a5f3
45 files changed
+3347 -763

No files matched your search

+30 -20
View File
@@ -2,32 +2,42 @@ import { useState, useCallback } from 'react'
const STORAGE_KEY = 'oc:sidebar:collapsed'
export function useSidebarCollapsed(): [boolean, () => void] {
const [collapsed, setCollapsed] = useState(() => {
if (typeof window === 'undefined') {
return false
}
const stored = localStorage.getItem(STORAGE_KEY)
if (stored === null) {
return false
}
try {
const parsed = JSON.parse(stored)
return typeof parsed === 'boolean' ? parsed : false
} catch {
return false
}
})
function readStoredBoolean(key: string, fallback: boolean): boolean {
if (typeof window === 'undefined') {
return fallback
}
const stored = localStorage.getItem(key)
if (stored === null) {
return fallback
}
try {
const parsed = JSON.parse(stored)
return typeof parsed === 'boolean' ? parsed : fallback
} catch {
return fallback
}
}
function usePersistentBoolean(key: string, fallback: boolean): [boolean, () => void] {
const [value, setValue] = useState(() => readStoredBoolean(key, fallback))
const toggle = useCallback(() => {
setCollapsed((prev: boolean) => {
setValue((prev: boolean) => {
const newValue = !prev
if (typeof window !== 'undefined') {
localStorage.setItem(STORAGE_KEY, JSON.stringify(newValue))
localStorage.setItem(key, JSON.stringify(newValue))
}
return newValue
})
}, [])
}, [key])
return [collapsed, toggle]
return [value, toggle]
}
export function useSidebarCollapsed(): [boolean, () => void] {
return usePersistentBoolean(STORAGE_KEY, false)
}
export function useSidebarSectionCollapsed(section: string): [boolean, () => void] {
return usePersistentBoolean(`${STORAGE_KEY}:${section}`, false)
}