feat(desktop): expose data-attributes on sidebar sessions area for custom skinning

Add data-sessions-mode ('flat' | 'projects' | 'project' | 'archived' |
'search') and data-sessions-project (entered project id) to the sidebar
sessions wrapper so custom UIs can target project mode without relying
on internal class names.
This commit is contained in:
Brooklyn Nicholson 2026-08-14 01:24:02 -05:00 committed by brooklyn!
parent 2a6eef77b7
commit ad9e8c9b57
1 changed files with 19 additions and 1 deletions

View File

@ -1368,6 +1368,20 @@ export function ChatSidebar({
const showSessionSections =
showSessionSkeletons || filtersActive || sortedSessions.length > 0 || projectModel.length > 0
// The sidebar's session-area mode — exposed as data-attributes so custom
// skins can target project mode (overview vs. entered), archived, or search
// without relying on internal class names. `data-sessions-project` carries
// the entered project's id for per-project targeting.
const sessionsMode: 'archived' | 'flat' | 'project' | 'projects' | 'search' = trimmedQuery
? 'search'
: showArchived
? 'archived'
: inProject
? 'project'
: worktreeGroupingActive
? 'projects'
: 'flat'
// Each reorderable list reports its OWN new id order; persisting is a direct,
// typed write — no id-prefix sniffing to figure out which level moved.
const reorderSessions = (ids: string[]) => {
@ -1514,7 +1528,11 @@ export function ChatSidebar({
)}
{showSessionSections && (
<div className={cn('flex min-h-0 flex-1 flex-col pb-1.75', SCROLL_Y, SCROLL_GUTTER)}>
<div
className={cn('flex min-h-0 flex-1 flex-col pb-1.75', SCROLL_Y, SCROLL_GUTTER)}
data-sessions-mode={sessionsMode}
data-sessions-project={inProject ? (enteredProjectId ?? undefined) : undefined}
>
{trimmedQuery && (
<SidebarSessionsSection
activeSessionId={activeSidebarSessionId}