Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(sidebar): add status filter entry to Dialogue section
KingSystemHaiGoc99fb1cc28d1
diff --git a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.tsindex 8d5fa225f8..7398de53df 100644--- a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts+++ b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts@@ -126,6 +126,20 @@ describe('Dialogue sidebar section', () => {expect(dialogueSectionSource).not.toMatch(/localStorage/);});+ it('exposes a Dialogue-owned status filter that drives the shared sidebar status', () => {+ // 入口复用全局 SidebarFilter 的 Status 语义(active/archived/all)与 i18n 文案,+ // 不另造一套归档视图,避免 Dialogue 与 Projects 两个区状态不同步。+ expect(dialogueSectionSource).toContain('DIALOGUE_STATUS_OPTIONS');+ expect(dialogueSectionSource).toContain('onStatusChange');+ expect(dialogueSectionSource).toContain("'ccAgent.sidebar.filterStatusHeading'");+ expect(dialogueSectionSource).toContain("'ccAgent.sidebar.filterStatus.active'");+ expect(dialogueSectionSource).toContain("'ccAgent.sidebar.filterStatus.archived'");+ expect(dialogueSectionSource).toContain("'ccAgent.sidebar.filterStatus.all'");+ // Dialogue 区的筛选入口驱动全局 filter.status,与 Projects 区共享同一状态源。+ expect(sidebarSource).toContain('status={filter.status}');+ expect(sidebarSource).toContain('onStatusChange={filter.setStatus}');+ });+it('exposes Dialogue-owned create and section collapse controls', () => {expect(dialogueSectionSource).toContain('onCreateDialogue');expect(dialogueSectionSource).toContain('SquarePen');diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsxindex fc87741274..5d9fa58d20 100644--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx@@ -3083,6 +3083,8 @@ function ExpandedView({onCreateDialogue={handleCreateDialogue}sortBy={dialogueSortBy}onSortByChange={setDialogueSortBy}+ status={filter.status}+ onStatusChange={filter.setStatus}/></>)}diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueSection.tsxindex 32ee5e5b9d..019af5e0f1 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueSection.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueSection.tsx@@ -27,6 +27,7 @@ import {import { sessionActivityMs } from '../../lib/dateSessionGrouping';import { SectionCollapse } from '../SectionCollapse';import { getDialogueCollapseLimit } from '../../lib/sidebarCollapseConfig';+import type { FilterStatus } from '../../hooks/useSidebarFilter';import { SessionEntryList } from '../SessionEntryList';import type { SessionClickHandler } from '../SessionItem';import type {@@ -55,6 +56,16 @@ const DIALOGUE_SORT_OPTIONS: ReadonlyArray<{{ value: 'title', labelKey: 'ccAgent.sidebar.dialogueSort.title' },];+/** 状态筛选选项复用 SidebarFilterPopover 的全局 Status 语义(active/archived/all)。 */+const DIALOGUE_STATUS_OPTIONS: ReadonlyArray<{+ value: FilterStatus;+ labelKey: string;+}> = [+ { value: 'active', labelKey: 'ccAgent.sidebar.filterStatus.active' },+ { value: 'archived', labelKey: 'ccAgent.sidebar.filterStatus.archived' },+ { value: 'all', labelKey: 'ccAgent.sidebar.filterStatus.all' },+];+const HEADER_HOVER_ACTION_CLASS = cn('pointer-events-none opacity-0 transition-opacity duration-150','group-hover/sidebar-header:pointer-events-auto group-hover/sidebar-header:opacity-100',@@ -87,6 +98,10 @@ export interface DialogueSectionProps {* 排序(否则折叠后面板前 N 条与展开态刚排好的顺序不一致,codex review)。 */sortBy: DialogueSortBy;onSortByChange: (value: DialogueSortBy) => void;+ /** 状态筛选受控化:复用全局 SidebarFilter 的 status 语义,入口驱动同一份筛选+ * 状态,避免 Dialogue 区与 Projects 区维护两套不同步的归档视图。 */+ status: FilterStatus;+ onStatusChange: (status: FilterStatus) => void;}function statusRank(session: Session): number {@@ -132,6 +147,8 @@ export function DialogueSection({onCreateDialogue,sortBy,onSortByChange,+ status,+ onStatusChange,}: DialogueSectionProps) {const { t } = useTranslation();const [collapsed, setCollapsed] = useState(false);@@ -143,6 +160,10 @@ export function DialogueSection({DIALOGUE_SORT_OPTIONS.find((option) => option.value === sortBy)?.labelKey ??'ccAgent.sidebar.dialogueSort.recency',);+ const statusLabel = t(+ DIALOGUE_STATUS_OPTIONS.find((option) => option.value === status)?.labelKey ??+ 'ccAgent.sidebar.filterStatus.active',+ );const ToggleIcon = collapsed ? ChevronRight : ChevronDown;const toggleLabel = collapsed? t('ccAgent.sidebar.dialoguesToggleExpand')@@ -186,7 +207,10 @@ export function DialogueSection({<Tip text={t('ccAgent.sidebar.dialogueSettings')} side="bottom"><buttontype="button"- aria-label={t('ccAgent.sidebar.dialogueSettingsAria', { sortBy: sortByLabel })}+ aria-label={t('ccAgent.sidebar.dialogueSettingsAria', {+ status: statusLabel,+ sortBy: sortByLabel,+ })}className={cn('flex h-7 w-7 items-center justify-center rounded-md','text-[var(--sidebar-list-muted)]',@@ -206,6 +230,38 @@ export function DialogueSection({<div className="px-2 py-1.5 text-xs font-medium text-[var(--cmd-palette-item-meta)]">{t('ccAgent.sidebar.dialogueSettings')}</div>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger className={MENU_ROW_CLASS}>+ <span className="truncate">{t('ccAgent.sidebar.filterStatusHeading')}</span>+ <span className="ml-auto max-w-[80px] truncate text-right text-[var(--cmd-palette-item-meta)]">+ {statusLabel}+ </span>+ <ChevronRight+ size={14}+ className="shrink-0 text-[var(--cmd-palette-item-meta)]"+ />+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent+ sideOffset={8}+ className={cn(MENU_SUB_CONTENT_CLASS, 'w-[180px]')}+ >+ {DIALOGUE_STATUS_OPTIONS.map((option) => (+ <DropdownMenuItem+ key={option.value}+ onSelect={() => onStatusChange(option.value)}+ className={MENU_ITEM_CLASS}+ >+ <span className="truncate">{t(option.labelKey)}</span>+ {status === option.value && (+ <Check+ size={15}+ className="ml-auto shrink-0 text-[var(--msg-assistant-text)]"+ />+ )}+ </DropdownMenuItem>+ ))}+ </DropdownMenuSubContent>+ </DropdownMenuSub><DropdownMenuSub><DropdownMenuSubTrigger className={MENU_ROW_CLASS}><span className="truncate">{t('ccAgent.sidebar.dialogueSortHeading')}</span>diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 80516d4d23..919ce4b3d0 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -6572,7 +6572,7 @@"loadingDialogues": "Loading…","noDialogues": "No sessions","dialogueSettings": "Organize Chat",- "dialogueSettingsAria": "Organize Chat (Sort by: {{sortBy}})",+ "dialogueSettingsAria": "Organize Chat (Status: {{status}}, Sort by: {{sortBy}})","dialogueSortHeading": "Sort by","dialogueSort": {"recency": "Recent first",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 7552f0bdf9..1fe3147242 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -6560,7 +6560,7 @@"loadingDialogues": "読み込み中…","noDialogues": "セッションはありません","dialogueSettings": "会話を整理",- "dialogueSettingsAria": "会話を整理(並び替え:{{sortBy}})",+ "dialogueSettingsAria": "会話を整理(状態:{{status}}、並び替え:{{sortBy}})","dialogueSortHeading": "並び替え","dialogueSort": {"recency": "新しい順",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex fd246553ad..d339b54fc8 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -6560,7 +6560,7 @@"loadingDialogues": "불러오는 중…","noDialogues": "세션 없음","dialogueSettings": "대화 정리",- "dialogueSettingsAria": "대화 정리(정렬: {{sortBy}})",+ "dialogueSettingsAria": "대화 정리(상태: {{status}}, 정렬: {{sortBy}})","dialogueSortHeading": "정렬","dialogueSort": {"recency": "최근순",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 6c0f2ad5bd..14c5f48c46 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -6560,7 +6560,7 @@"loadingDialogues": "加载中…","noDialogues": "暂无任务","dialogueSettings": "整理对话",- "dialogueSettingsAria": "整理对话(排序:{{sortBy}})",+ "dialogueSettingsAria": "整理对话(状态:{{status}},排序:{{sortBy}})","dialogueSortHeading": "排序","dialogueSort": {"recency": "最近优先",