The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(conversations): add thread list component
Steven Enamakel64bcb64ec6c2
diff --git a/app/src/features/conversations/threadList/ThreadList.tsx b/app/src/features/conversations/threadList/ThreadList.tsxindex 61be7816b4..79ac8101c2 100644--- a/app/src/features/conversations/threadList/ThreadList.tsx+++ b/app/src/features/conversations/threadList/ThreadList.tsx@@ -89,6 +89,128 @@ export function ThreadList({// Recomputed per render on purpose: a list left open overnight should move// yesterday's rows out of "Today" on the next update without a timer.const groups = groupThreads(visibleThreads, new Date(), isPinned);+ const renderRow = (thread: Thread) => {+ const running = Boolean(isThreadRunning?.(thread.id));+ const unread = !running && Boolean(unreadThreadIds?.has(thread.id));+ const pinned = isPinned(thread);+ return (+ <div+ key={thread.id}+ data-testid={`thread-row-${thread.id}`}+ // The working folder rides on the row as a native tooltip rather than a+ // second line, so the list keeps one `h-8` rhythm.+ title={+ thread.actionDir+ ? t('chat.sidebar.workingFolder').replace('{folder}', folderBasename(thread.actionDir))+ : undefined+ }+ data-analytics-id="chat-sidebar-thread-row"+ role="button"+ tabIndex={0}+ onClick={() => onSelectThread(thread.id)}+ onKeyDown={e => {+ if (e.target !== e.currentTarget) return;+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ onSelectThread(thread.id);+ }+ }}+ // A rounded pill per row, separated by spacing rather than+ // hairlines — six dividers in a short list read as a table, not a+ // list of destinations. Alpha fills so the row lifts identically+ // whether the list is projected into the (translucent) app sidebar+ // or rendered inside the opaque chat aside.+ // Fixed `h-8` matching SidebarNav's rows: the hover-revealed+ // actions are taller than the title's line box, so a padding-sized+ // row would grow 4px the moment the pointer entered it and the+ // whole list would shift under the cursor.+ className={`group flex h-8 w-full flex-none cursor-pointer items-center rounded-md px-3 text-left transition-colors ${+ selectedThreadId === thread.id+ ? 'bg-surface/70'+ : 'hover:bg-surface/40 dark:hover:bg-surface/60'+ }`}>+ <div className="flex w-full min-w-0 items-center gap-1.5">+ {editingThreadId === thread.id ? (+ <input+ ref={editTitleInputRef}+ value={editTitleValue}+ onClick={e => e.stopPropagation()}+ onChange={e => onEditTitleValueChange(e.target.value)}+ onKeyDown={e => {+ e.stopPropagation();+ // Ignore the Enter that confirms an IME composition+ // candidate (CJK input) so it doesn't prematurely commit.+ if (isImeCompositionKeyEvent(e)) return;+ if (e.key === 'Enter') {+ e.preventDefault();+ onCommitTitle(thread.id);+ } else if (e.key === 'Escape') {+ // Escape is an explicit cancel — suppress the commit the+ // ensuing blur would otherwise fire.+ onCancelEditTitle();+ }+ }}+ onBlur={() => onBlurTitle(thread.id)}+ aria-label={t('chat.editThreadTitle')}+ data-testid={`thread-title-input-${thread.id}`}+ className="h-5 min-w-0 flex-1 border-b border-primary-400 bg-transparent py-0 text-xs font-medium leading-none text-content-secondary outline-hidden"+ autoFocus+ />+ ) : (+ <p+ data-running={isThreadRunning?.(thread.id) ? 'true' : undefined}+ aria-busy={isThreadRunning?.(thread.id) || undefined}+ className={`truncate flex-1 text-[14px] ${+ selectedThreadId === thread.id+ ? 'font-semibold text-content'+ : 'text-content-muted'+ } ${running ? 'shimmer motion-reduce:animate-none' : ''}`}>+ {resolveTitle(thread.id)}+ </p>+ )}+ <button+ type="button"+ data-analytics-id="chat-sidebar-edit-thread-title"+ onClick={e => {+ e.stopPropagation();+ onStartEditTitle(thread.id);+ }}+ aria-label={t('chat.editThreadTitle')}+ title={t('chat.editThreadTitle')}+ // `hidden`, not `opacity-0`: the title gets the full row width+ // until hover reveals the trailing actions.+ className="hidden h-5 w-5 flex-none items-center justify-center rounded text-content-faint transition-colors hover:bg-surface/60 hover:text-primary-500 group-hover:inline-flex">+ <svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth={2}+ d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"+ />+ </svg>+ </button>+ <button+ type="button"+ data-analytics-id="chat-sidebar-delete-thread"+ onClick={e => {+ e.stopPropagation();+ onRequestDelete(thread);+ }}+ className="hidden h-5 w-5 flex-none items-center justify-center rounded text-content-faint transition-colors hover:bg-surface/60 hover:text-coral-500 group-hover:inline-flex"+ title={t('chat.deleteThread')}>+ <svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth={2}+ d="M6 18L18 6M6 6l12 12"+ />+ </svg>+ </button>+ </div>+ </div>+ );+ };return (// Card background / rounded corners come from TwoPanelLayout's pane styling.<div className="h-full flex flex-col">@@ -217,116 +339,27 @@ export function ThreadList({<div className="flex flex-1 flex-col gap-0.5 overflow-y-auto px-2 pb-3 [scrollbar-gutter:stable_both-edges] [scrollbar-width:thin]">{threads.length === 0 ? (<p className="px-4 py-6 text-xs text-content-faint text-center">{t('chat.noThreads')}</p>+ ) : groups.length === 0 ? (+ <p+ data-testid="thread-search-empty"+ className="px-4 py-6 text-xs text-content-faint text-center">+ {t('chat.sidebar.noMatches')}+ </p>) : (- threads.map(thread => (- <div- key={thread.id}- data-testid={`thread-row-${thread.id}`}- data-analytics-id="chat-sidebar-thread-row"- role="button"- tabIndex={0}- onClick={() => onSelectThread(thread.id)}- onKeyDown={e => {- if (e.target !== e.currentTarget) return;- if (e.key === 'Enter' || e.key === ' ') {- e.preventDefault();- onSelectThread(thread.id);- }- }}- // A rounded pill per row, separated by spacing rather than- // hairlines — six dividers in a short list read as a table, not a- // list of destinations. Alpha fills so the row lifts identically- // whether the list is projected into the (translucent) app sidebar- // or rendered inside the opaque chat aside.- // Fixed `h-8` matching SidebarNav's rows: the hover-revealed- // actions are taller than the title's line box, so a padding-sized- // row would grow 4px the moment the pointer entered it and the- // whole list would shift under the cursor.- className={`group flex h-8 w-full flex-none cursor-pointer items-center rounded-md px-3 text-left transition-colors ${- selectedThreadId === thread.id- ? 'bg-surface/70'- : 'hover:bg-surface/40 dark:hover:bg-surface/60'- }`}>- <div className="flex w-full min-w-0 items-center gap-1.5">- {editingThreadId === thread.id ? (- <input- ref={editTitleInputRef}- value={editTitleValue}- onClick={e => e.stopPropagation()}- onChange={e => onEditTitleValueChange(e.target.value)}- onKeyDown={e => {- e.stopPropagation();- // Ignore the Enter that confirms an IME composition- // candidate (CJK input) so it doesn't prematurely commit.- if (isImeCompositionKeyEvent(e)) return;- if (e.key === 'Enter') {- e.preventDefault();- onCommitTitle(thread.id);- } else if (e.key === 'Escape') {- // Escape is an explicit cancel — suppress the commit the- // ensuing blur would otherwise fire.- onCancelEditTitle();- }- }}- onBlur={() => onBlurTitle(thread.id)}- aria-label={t('chat.editThreadTitle')}- data-testid={`thread-title-input-${thread.id}`}- className="h-5 min-w-0 flex-1 border-b border-primary-400 bg-transparent py-0 text-xs font-medium leading-none text-content-secondary outline-hidden"- autoFocus- />- ) : (- <p- data-running={isThreadRunning?.(thread.id) ? 'true' : undefined}- aria-busy={isThreadRunning?.(thread.id) || undefined}- className={`truncate flex-1 text-[14px] ${- selectedThreadId === thread.id- ? 'font-semibold text-content'- : 'text-content-muted'- } ${isThreadRunning?.(thread.id) ? 'shimmer motion-reduce:animate-none' : ''}`}>- {resolveTitle(thread.id)}- </p>- )}- <button- type="button"- data-analytics-id="chat-sidebar-edit-thread-title"- onClick={e => {- e.stopPropagation();- onStartEditTitle(thread.id);- }}- aria-label={t('chat.editThreadTitle')}- title={t('chat.editThreadTitle')}- // `hidden`, not `opacity-0`: the title gets the full row width- // until hover reveals the trailing actions.- className="hidden h-5 w-5 flex-none items-center justify-center rounded text-content-faint transition-colors hover:bg-surface/60 hover:text-primary-500 group-hover:inline-flex">- <svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path- strokeLinecap="round"- strokeLinejoin="round"- strokeWidth={2}- d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"- />- </svg>- </button>- <button- type="button"- data-analytics-id="chat-sidebar-delete-thread"- onClick={e => {- e.stopPropagation();- onRequestDelete(thread);- }}- className="hidden h-5 w-5 flex-none items-center justify-center rounded text-content-faint transition-colors hover:bg-surface/60 hover:text-coral-500 group-hover:inline-flex"- title={t('chat.deleteThread')}>- <svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">- <path- strokeLinecap="round"- strokeLinejoin="round"- strokeWidth={2}- d="M6 18L18 6M6 6l12 12"- />- </svg>- </button>- </div>- </div>+ // Each section is a labelled group so screen readers announce+ // "Today, list" etc. The header is a plain muted caption, not a+ // control: sections are not collapsible, so they should not look it.+ groups.map(group => (+ <section+ key={group.key}+ data-testid={`thread-group-${group.key}`}+ aria-label={t(GROUP_LABEL_KEYS[group.key])}+ className="flex flex-col gap-0.5">+ <h3 className="px-3 pb-0.5 pt-2 text-[11px] font-medium uppercase tracking-wide text-content-faint first:pt-0">+ {t(GROUP_LABEL_KEYS[group.key])}+ </h3>+ {group.threads.map(renderRow)}+ </section>)))}</div>