Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(sidebar): 状态筛选入口覆盖未分组/空列表并加大命中区

KingSystemHaiGo11e062048939
diff --git a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
index b6563ec987..5a27327623 100644
--- a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
+++ b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
@@ -32,6 +32,11 @@ const dialogueStatusMenuSource = readFileSync(
'utf8',
);
+const mainListScopeHeaderSource = readFileSync(
+ resolve(__dirname, '..', 'features', 'cc-agent', 'sidebar', 'MainListScopeHeader.tsx'),
+ 'utf8',
+);
+
const mainListModelSource = readFileSync(
resolve(__dirname, '..', 'features', 'cc-agent', 'lib', 'mainListModel.ts'),
'utf8',
@@ -62,13 +67,17 @@ describe('Mixed main list (sidebar-redesign D 期)', () => {
it('exposes a Dialogue-owned status filter on live dialogue surfaces, not only DialogueSection', () => {
// 展开态主列表已混排,不再挂 <DialogueSection>;全局 Status 仍在 SidebarFilterPopover。
- // #1875 需要对话区可见入口:混排「对话」组头 + 折叠 rail 对话面板复用同一份 filter.status。
+ // #1875 需要对话区可见入口:恒在范围标题(未分组 / 空列表) + 混排「对话」组头
+ // + 折叠 rail 对话面板复用同一份 filter.status。
expect(dialogueStatusMenuSource).toContain('DIALOGUE_STATUS_OPTIONS');
expect(dialogueStatusMenuSource).toContain('onStatusChange');
expect(dialogueStatusMenuSource).toContain("'ccAgent.sidebar.filterStatusHeading'");
expect(dialogueStatusMenuSource).toContain("'ccAgent.sidebar.filterStatus.active'");
expect(dialogueStatusMenuSource).toContain("'ccAgent.sidebar.filterStatus.archived'");
expect(dialogueStatusMenuSource).toContain("'ccAgent.sidebar.filterStatus.all'");
+ expect(mainListScopeHeaderSource).toContain('<DialogueStatusMenu');
+ expect(mainListScopeHeaderSource).toContain('status={filter.status}');
+ expect(mainListScopeHeaderSource).toContain('onStatusChange={filter.setStatus}');
expect(projectsSectionSource).toContain('<DialogueStatusMenu');
expect(projectsSectionSource).toContain('status={filter.status}');
expect(projectsSectionSource).toContain('onStatusChange={filter.setStatus}');
@@ -81,11 +90,23 @@ describe('Mixed main list (sidebar-redesign D 期)', () => {
expect(dialogueStatusMenuSource).toContain("'ccAgent.sidebar.dialogueSettingsAria'");
expect(dialogueStatusMenuSource).toContain('sortBy: sortByLabel ?? statusLabel');
expect(dialogueStatusMenuSource).toContain('focus-visible:ring-[var(--focus-ring)]');
+ expect(mainListScopeHeaderSource).toContain(
+ 'sortByLabel={t(`ccAgent.sidebar.filterSortBy.${filter.sortBy}`)}',
+ );
expect(projectsSectionSource).toContain(
'sortByLabel={t(`ccAgent.sidebar.filterSortBy.${filter.sortBy}`)}',
);
+ expect(dialogueStatusMenuSource).toContain(
+ "'flex shrink-0 items-center justify-center rounded-full'",
+ );
+ expect(mainListScopeHeaderSource).toContain(
+ 'buttonClassName="size-6 hover:bg-sidebar-item-hover hover:text-foreground"',
+ );
+ expect(projectsSectionSource).toContain(
+ 'buttonClassName="size-6 hover:bg-sidebar-item-hover hover:text-foreground"',
+ );
expect(projectsSectionSource).not.toContain(
- 'buttonClassName="size-5 hover:bg-sidebar-item-hover hover:text-foreground focus:outline-none"',
+ 'buttonClassName="size-5 hover:bg-sidebar-item-hover hover:text-foreground"',
);
expect(sidebarSource).toContain(
'sortByLabel={t(`ccAgent.sidebar.dialogueSort.${dialogueSortBy}`)}',
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx
index f5c248d9d2..1ead034511 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/MainListScopeHeader.tsx
@@ -8,11 +8,13 @@
*/
import { useState, type ReactNode } from 'react';
import type { LucideIcon } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
import { cn } from '@/lib/utils';
import { Tip } from '@/components/ui/tooltip';
import { MachineSwitcherMenu } from './MachineSwitcherMenu';
import { SidebarFilterPopover } from './SidebarFilterPopover';
+import { DialogueStatusMenu } from './sections/DialogueStatusMenu';
import type { ProjectNode as ProjectNodeData } from '../lib/projectGrouping';
import type { UseSidebarFilterReturn } from '../hooks/useSidebarFilter';
@@ -47,6 +49,7 @@ export function MainListScopeHeader({
disabled: boolean;
} | null;
}): ReactNode {
+ const { t } = useTranslation();
const [displaySettingsOpen, setDisplaySettingsOpen] = useState(false);
return (
<div className="group/sidebar-header flex h-6 items-center justify-between pr-0 pl-6">
@@ -73,6 +76,13 @@ export function MainListScopeHeader({
</button>
</Tip>
) : null}
+ <DialogueStatusMenu
+ status={filter.status}
+ onStatusChange={filter.setStatus}
+ sortByLabel={t(`ccAgent.sidebar.filterSortBy.${filter.sortBy}`)}
+ buttonClassName="size-6 hover:bg-sidebar-item-hover hover:text-foreground"
+ iconSize={14}
+ />
<SidebarFilterPopover
filter={filter}
allKnownProjects={allKnownProjects}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueStatusMenu.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueStatusMenu.tsx
index f23e864c93..599be9d2cf 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueStatusMenu.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueStatusMenu.tsx
@@ -2,8 +2,9 @@
* DialogueStatusMenu — 对话区可见的状态筛选入口。
*
* 全局 Status 仍由 SidebarFilterPopover 持有;本组件复用同一份
- * filter.status / setStatus,把「活跃 / 已归档 / 全部」放到混排「对话」组头
- * 和折叠 rail 对话面板上,避免入口只活在未挂载的 DialogueSection 里。
+ * filter.status / setStatus,把「活跃 / 已归档 / 全部」放到恒在的范围标题
+ * (MainListScopeHeader,覆盖未分组与空列表)、混排「对话」组头和折叠 rail
+ * 对话面板上,避免入口只活在未挂载的 DialogueSection 里。
*
* 菜单本身只有状态选项。可访问名称仍走 `dialogueSettingsAria`,展开态与
* 折叠 rail 各自传入真实 `sortByLabel`,避免状态文案填进 {{sortBy}}。
@@ -75,7 +76,7 @@ export function DialogueStatusMenu({
onPointerDown={stop}
onKeyDown={stop}
className={cn(
- 'flex shrink-0 items-center justify-center rounded-md',
+ 'flex shrink-0 items-center justify-center rounded-full',
'text-[var(--sidebar-list-muted)]',
'transition-colors hover:text-[var(--sidebar-nav-text)]',
STATUS_BUTTON_FOCUS,
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
index 26eea1cd91..cdfa088bc8 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
@@ -1315,7 +1315,7 @@ function SessionGroupNode({
status={status}
onStatusChange={onStatusChange}
sortByLabel={sortByLabel}
- buttonClassName="size-5 hover:bg-sidebar-item-hover hover:text-foreground"
+ buttonClassName="size-6 hover:bg-sidebar-item-hover hover:text-foreground"
iconSize={14}
stopRowToggle
/>