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): 混排组头传入真实 sortByLabel

KingSystemHaiGof7083c295d55
diff --git a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
index d114ead237..b6563ec987 100644
--- a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
+++ b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
@@ -77,15 +77,19 @@ describe('Mixed main list (sidebar-redesign D 期)', () => {
expect(sidebarSource).toContain('onStatusChange={filter.setStatus}');
});
- it('keeps DialogueStatusMenu status-only for AT and shows a keyboard focus ring', () => {
- expect(dialogueStatusMenuSource).toContain("'ccAgent.sidebar.dialogueStatusFilterAria'");
- expect(dialogueStatusMenuSource).not.toContain('sortByLabel');
+ it('passes a real sortByLabel into mixed-list AT and shows a keyboard focus ring', () => {
+ expect(dialogueStatusMenuSource).toContain("'ccAgent.sidebar.dialogueSettingsAria'");
+ expect(dialogueStatusMenuSource).toContain('sortBy: sortByLabel ?? statusLabel');
expect(dialogueStatusMenuSource).toContain('focus-visible:ring-[var(--focus-ring)]');
- expect(projectsSectionSource).not.toContain('sortByLabel');
+ expect(projectsSectionSource).toContain(
+ 'sortByLabel={t(`ccAgent.sidebar.filterSortBy.${filter.sortBy}`)}',
+ );
expect(projectsSectionSource).not.toContain(
'buttonClassName="size-5 hover:bg-sidebar-item-hover hover:text-foreground focus:outline-none"',
);
- expect(sidebarSource).not.toContain('sortByLabel={t(`ccAgent.sidebar.dialogueSort.${dialogueSortBy}`)}');
+ expect(sidebarSource).toContain(
+ 'sortByLabel={t(`ccAgent.sidebar.dialogueSort.${dialogueSortBy}`)}',
+ );
});
it('drops the removed date-grouped section entirely', () => {
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
index 6d29925e18..2ee7e8e9dc 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
@@ -4371,6 +4371,7 @@ function RailPanels({
<DialogueStatusMenu
status={status}
onStatusChange={onStatusChange}
+ sortByLabel={t(`ccAgent.sidebar.dialogueSort.${dialogueSortBy}`)}
buttonClassName="h-6 w-6 -my-1 text-[var(--text-tertiary)] hover:text-[var(--text-secondary)]"
iconSize={14}
/>
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 8f64493d45..f23e864c93 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
@@ -5,8 +5,8 @@
* filter.status / setStatus,把「活跃 / 已归档 / 全部」放到混排「对话」组头
* 和折叠 rail 对话面板上,避免入口只活在未挂载的 DialogueSection 里。
*
- * 本菜单只有状态选项、没有排序项,可访问名称只用状态,不把状态文案填进
- * `dialogueSettingsAria` 的 {{sortBy}} 占位符。
+ * 菜单本身只有状态选项。可访问名称仍走 `dialogueSettingsAria`,展开态与
+ * 折叠 rail 各自传入真实 `sortByLabel`,避免状态文案填进 {{sortBy}}。
*/
import { Check, SlidersHorizontal } from 'lucide-react';
@@ -38,12 +38,15 @@ const STATUS_BUTTON_FOCUS =
export function DialogueStatusMenu({
status,
onStatusChange,
+ sortByLabel,
buttonClassName,
iconSize = 14,
stopRowToggle = false,
}: {
status: FilterStatus;
onStatusChange: (status: FilterStatus) => void;
+ /** 与 i18n `dialogueSettingsAria` 的 {{sortBy}} 对齐;省略时复用状态文案。 */
+ sortByLabel?: string;
buttonClassName?: string;
iconSize?: number;
/** 组头整行可点折叠时,阻止菜单点击冒泡成收起/展开。 */
@@ -64,8 +67,9 @@ export function DialogueStatusMenu({
<Tip text={t('ccAgent.sidebar.dialogueSettings')} side="bottom">
<button
type="button"
- aria-label={t('ccAgent.sidebar.dialogueStatusFilterAria', {
+ aria-label={t('ccAgent.sidebar.dialogueSettingsAria', {
status: statusLabel,
+ sortBy: sortByLabel ?? statusLabel,
})}
onClick={stop}
onPointerDown={stop}
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 7a5c5e15ef..26eea1cd91 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
@@ -965,6 +965,7 @@ export function ProjectsSection({
sessionVariant={mainSessionVariant}
status={filter.status}
onStatusChange={filter.setStatus}
+ sortByLabel={t(`ccAgent.sidebar.filterSortBy.${filter.sortBy}`)}
/>
);
}
@@ -1254,6 +1255,8 @@ function SessionGroupNode({
/** 仅对话组传入:把活跃/已归档/全部入口放到组头,与全局 filter.status 同步。 */
status?: UseSidebarFilterReturn['status'];
onStatusChange?: UseSidebarFilterReturn['setStatus'];
+ /** 混排组头 AT 的真实排序文案,对应 filter.sortBy / filterSortBy。 */
+ sortByLabel?: string;
}) {
const { t } = useTranslation();
// 与 ProjectNode 同款:标题右侧 hover 渐显的展开/收起指示箭头。
@@ -1311,6 +1314,7 @@ function SessionGroupNode({
<DialogueStatusMenu
status={status}
onStatusChange={onStatusChange}
+ sortByLabel={sortByLabel}
buttonClassName="size-5 hover:bg-sidebar-item-hover hover:text-foreground"
iconSize={14}
stopRowToggle
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 3c316297c7..5f10aef31b 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -9332,7 +9332,6 @@
"noDialogues": "No sessions",
"dialogueSettings": "Organize Chat",
"dialogueSettingsAria": "Organize Chat (Status: {{status}}, Sort by: {{sortBy}})",
- "dialogueStatusFilterAria": "Filter Chat status: {{status}}",
"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.json
index 4bf0f45719..cf89ffbc90 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -9317,7 +9317,6 @@
"noDialogues": "セッションはありません",
"dialogueSettings": "会話を整理",
"dialogueSettingsAria": "会話を整理(状態:{{status}}、並び替え:{{sortBy}})",
- "dialogueStatusFilterAria": "会話の状態を絞り込む:{{status}}",
"dialogueSortHeading": "並び替え",
"dialogueSort": {
"recency": "新しい順",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index a39ef9d799..2d3e249886 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -9317,7 +9317,6 @@
"noDialogues": "세션 없음",
"dialogueSettings": "대화 정리",
"dialogueSettingsAria": "대화 정리(상태: {{status}}, 정렬: {{sortBy}})",
- "dialogueStatusFilterAria": "대화 상태 필터: {{status}}",
"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.json
index c7a6ff1cd7..afca7a2c92 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -9317,7 +9317,6 @@
"noDialogues": "暂无任务",
"dialogueSettings": "整理对话",
"dialogueSettingsAria": "整理对话(状态:{{status}},排序:{{sortBy}})",
- "dialogueStatusFilterAria": "筛选对话状态:{{status}}",
"dialogueSortHeading": "排序",
"dialogueSort": {
"recency": "最近优先",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 90750912b9..1db289b33d 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -9317,7 +9317,6 @@
"noDialogues": "暫無任務",
"dialogueSettings": "整理對話",
"dialogueSettingsAria": "整理對話(狀態:{{status}},排序:{{sortBy}})",
- "dialogueStatusFilterAria": "篩選對話狀態:{{status}}",
"dialogueSortHeading": "排序",
"dialogueSort": {
"recency": "最近優先",