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

+3 -2
View File
@@ -104,11 +104,12 @@ export function BottomSheet({
export interface BottomSheetHeaderProps {
title?: string
children?: React.ReactNode
className?: string
}
export function BottomSheetHeader({ title, children }: BottomSheetHeaderProps) {
export function BottomSheetHeader({ title, children, className }: BottomSheetHeaderProps) {
return (
<div className="flex-shrink-0 border-b border-border bg-background px-4 py-3">
<div className={cn('flex-shrink-0 border-b border-border bg-background px-4 py-3', className)}>
{title && (
<h2 className="text-lg font-semibold text-foreground">{title}</h2>
)}
+53 -1
View File
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest'
import { render, screen, fireEvent } from '@testing-library/react'
import { Sidebar, SidebarSection, SidebarItem, SidebarCollapseToggle } from './sidebar'
import { Sidebar, SidebarCollapsibleSection, SidebarSection, SidebarItem, SidebarCollapseToggle } from './sidebar'
import { TooltipProvider } from './tooltip'
import { Folder } from 'lucide-react'
@@ -58,6 +58,58 @@ describe('SidebarSection', () => {
})
})
describe('SidebarCollapsibleSection', () => {
it('renders label and children when expanded', () => {
render(
<SidebarCollapsibleSection label="Sessions" collapsed={false} onToggle={vi.fn()}>
<div>Content</div>
</SidebarCollapsibleSection>
)
expect(screen.getByRole('button', { name: 'Sessions' })).toHaveAttribute('aria-expanded', 'true')
expect(screen.getByText('Content')).toBeInTheDocument()
})
it('hides children when collapsed', () => {
render(
<SidebarCollapsibleSection label="Sessions" collapsed={true} onToggle={vi.fn()}>
<div>Content</div>
</SidebarCollapsibleSection>
)
expect(screen.getByRole('button', { name: 'Sessions' })).toHaveAttribute('aria-expanded', 'false')
expect(screen.queryByText('Content')).not.toBeInTheDocument()
})
it('calls onToggle when the header is clicked', () => {
const handleToggle = vi.fn()
render(
<SidebarCollapsibleSection label="Menu" collapsed={false} onToggle={handleToggle}>
<div>Content</div>
</SidebarCollapsibleSection>
)
fireEvent.click(screen.getByRole('button', { name: 'Menu' }))
expect(handleToggle).toHaveBeenCalledTimes(1)
})
it('applies contentClassName to the content wrapper', () => {
render(
<SidebarCollapsibleSection
label="Menu"
collapsed={false}
onToggle={vi.fn()}
contentClassName="overflow-y-auto"
>
<div>Content</div>
</SidebarCollapsibleSection>
)
expect(screen.getByText('Content').parentElement).toHaveClass('overflow-y-auto')
})
})
describe('SidebarItem', () => {
it('fires onClick when clicked', () => {
const handleClick = vi.fn()
+42 -1
View File
@@ -1,5 +1,6 @@
import { useId } from 'react'
import type { LucideIcon } from 'lucide-react'
import { ChevronLeft, ChevronRight } from 'lucide-react'
import { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react'
import { cn } from '@/lib/utils'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
@@ -56,6 +57,46 @@ export function SidebarSection({ label, collapsed, children }: SidebarSectionPro
)
}
export interface SidebarCollapsibleSectionProps {
label: string
collapsed: boolean
onToggle: () => void
className?: string
contentClassName?: string
children: React.ReactNode
}
export function SidebarCollapsibleSection({
label,
collapsed,
onToggle,
className,
contentClassName,
children,
}: SidebarCollapsibleSectionProps) {
const contentId = useId()
return (
<div className={cn('flex min-h-0 flex-col', className)}>
<button
type="button"
onClick={onToggle}
aria-expanded={!collapsed}
aria-controls={contentId}
className="flex w-full items-center justify-between gap-2 px-3 py-1.5 text-xs font-medium uppercase tracking-wider text-muted-foreground transition-colors hover:text-foreground"
>
<span className="truncate">{label}</span>
<ChevronDown className={cn('h-3.5 w-3.5 shrink-0 transition-transform', collapsed && '-rotate-90')} />
</button>
{!collapsed && (
<div id={contentId} className={cn('flex min-h-0 flex-1 flex-col', contentClassName)}>
{children}
</div>
)}
</div>
)
}
export interface SidebarItemProps {
icon: LucideIcon
label: string