diff --git a/apps/desktop/src/app/chat/sidebar/chrome.tsx b/apps/desktop/src/app/chat/sidebar/chrome.tsx new file mode 100644 index 00000000000..45b20ce13dd --- /dev/null +++ b/apps/desktop/src/app/chat/sidebar/chrome.tsx @@ -0,0 +1,158 @@ +import type * as React from 'react' + +import { Codicon } from '@/components/ui/codicon' +import { cn } from '@/lib/utils' + +// Shared, content-agnostic sidebar chrome — used by both the flat session +// sections and the project/workspace tree, so it lives outside either to keep +// imports one-directional (no index <-> projects cycle). + +/** `loaded/total` when there's more on the server, else just the loaded count. */ +export const countLabel = (loaded: number, total: number): string => + total > loaded ? `${loaded}/${total}` : String(loaded) + +/** The muted count chip next to a section/workspace label. */ +export function SidebarCount({ children }: { children: React.ReactNode }) { + return {children} +} + +// ── Row geometry (session row is canonical — everything composes these) ───── +// +// Height lives ONLY on SidebarRowShell (min-h-[1.625rem]). Inset children +// stretch to fill the cell and center content internally — never items-center +// on the shell grid, or short clusters (projects) float 1–2px off sessions. + +const rowMinH = 'min-h-[1.625rem]' +const rowPadX = 'pl-2 pr-1' +const rowGap = 'gap-1.5' +const rowLead = 'grid size-3.5 shrink-0 place-items-center' +const rowInset = cn(rowPadX, rowGap, 'flex h-full min-w-0 items-center self-stretch py-0.5') +const rowLabel = 'min-w-0 truncate text-[0.8125rem] leading-none text-(--ui-text-secondary)' + +/** Codicon size in sidebar row leads — matches the file tree (`tree.tsx`). */ +export const SIDEBAR_LEAD_ICON_SIZE = '0.875rem' as const + +/** Vertical stack of rows (gap-px, single column). */ +export function SidebarRowStack({ className, ...props }: React.ComponentProps<'div'>) { + return
+} + +/** Nested rows (session previews, worktree bodies). */ +export function SidebarRowNest({ className, ...props }: React.ComponentProps<'div'>) { + return