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(desktop): refine plugin panel restore row

DavidShenbfa194a5c340
diff --git a/apps/desktop/src/renderer/cindy-brain/GhostPanelRestoreEntry.tsx b/apps/desktop/src/renderer/cindy-brain/GhostPanelRestoreEntry.tsx
index 26aa2382e2..8cb457005c 100644
--- a/apps/desktop/src/renderer/cindy-brain/GhostPanelRestoreEntry.tsx
+++ b/apps/desktop/src/renderer/cindy-brain/GhostPanelRestoreEntry.tsx
@@ -50,15 +50,24 @@ export function GhostPanelRestoreEntry({
const single = minimized.length === 1 ? minimized[0] : null;
const label = single
? t('ghostPanelRestore.single', { name: panelName(single) })
- : t('ghostPanelRestore.multiple', { count: minimized.length });
+ : t('ghostPanelRestore.multiple');
+ const ariaLabel = single
+ ? label
+ : t('ghostPanelRestore.multipleAria', { count: minimized.length });
const content = (
<>
<GhostEntryIcon ghost={single ?? undefined} size={variant === 'rail' ? 18 : 15} />
{variant === 'row' ? (
<>
- <span className="min-w-0 flex-1 truncate leading-none">{label}</span>
+ <span
+ data-testid="ghost-panel-restore-label"
+ className="min-w-0 flex-1 truncate text-left leading-none"
+ >
+ {label}
+ </span>
{minimized.length > 1 ? (
<span
+ data-testid="ghost-panel-restore-count"
aria-hidden
className="flex h-4 min-w-4 items-center justify-center rounded-full bg-[var(--surface-chip)] px-1 text-10 font-medium leading-none text-[var(--text-secondary)]"
>
@@ -82,7 +91,7 @@ export function GhostPanelRestoreEntry({
<button
type="button"
data-testid="ghost-panel-restore-entry"
- aria-label={label}
+ aria-label={ariaLabel}
title={label}
onClick={() => restoreGhostPanel(single.manifest.id)}
className={className}
@@ -98,7 +107,7 @@ export function GhostPanelRestoreEntry({
<button
type="button"
data-testid="ghost-panel-restore-entry"
- aria-label={label}
+ aria-label={ariaLabel}
title={label}
className={cn('relative', className)}
>
diff --git a/apps/desktop/src/renderer/cindy-brain/__tests__/GhostPanelRestoreEntry.test.tsx b/apps/desktop/src/renderer/cindy-brain/__tests__/GhostPanelRestoreEntry.test.tsx
index 0a01311c20..be4d6fc163 100644
--- a/apps/desktop/src/renderer/cindy-brain/__tests__/GhostPanelRestoreEntry.test.tsx
+++ b/apps/desktop/src/renderer/cindy-brain/__tests__/GhostPanelRestoreEntry.test.tsx
@@ -88,7 +88,13 @@ describe('GhostPanelRestoreEntry', () => {
render(<GhostPanelRestoreEntry variant="row" />);
const trigger = screen.getByTestId('ghost-panel-restore-entry');
- expect(trigger.textContent).toContain('2');
+ expect(screen.getByTestId('ghost-panel-restore-label').textContent).toBe(
+ 'ghostPanelRestore.multiple',
+ );
+ expect(screen.getByTestId('ghost-panel-restore-label').className).toContain('text-left');
+ expect(screen.getByTestId('ghost-panel-restore-count').textContent).toBe('2');
+ expect(trigger.getAttribute('title')).toBe('ghostPanelRestore.multiple');
+ expect(trigger.getAttribute('aria-label')).toContain('"count":2');
fireEvent.pointerDown(trigger, { button: 0, ctrlKey: false });
fireEvent.click(screen.getByText('a 面板'));
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 1a472f35a1..3cea8fb323 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -4573,7 +4573,8 @@
},
"ghostPanelRestore": {
"single": "Restore {{name}}",
- "multiple": "Restore plugin panels ({{count}})"
+ "multiple": "Minimized plugin panels",
+ "multipleAria": "{{count}} plugin panels minimized. Choose a panel to restore"
},
"rightSidebar": {
"ariaLabel": "Right sidebar",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index c0f2e174f0..7e3f1d3c42 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -4571,7 +4571,8 @@
},
"ghostPanelRestore": {
"single": "{{name}}を復元",
- "multiple": "プラグインパネルを復元({{count}})"
+ "multiple": "最小化したプラグインパネル",
+ "multipleAria": "{{count}}個のプラグインパネルが最小化されています。復元するパネルを選択"
},
"rightSidebar": {
"ariaLabel": "右サイドバー",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 3bf60f250d..b84a27f97d 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -4571,7 +4571,8 @@
},
"ghostPanelRestore": {
"single": "{{name}} 복원",
- "multiple": "플러그인 패널 복원({{count}})"
+ "multiple": "최소화된 플러그인 패널",
+ "multipleAria": "플러그인 패널 {{count}}개가 최소화되었습니다. 복원할 패널 선택"
},
"rightSidebar": {
"ariaLabel": "오른쪽 사이드바",
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 aed1f210df..b13f26f3fc 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -4571,7 +4571,8 @@
},
"ghostPanelRestore": {
"single": "恢复 {{name}}",
- "multiple": "恢复插件面板({{count}})"
+ "multiple": "已收起的插件面板",
+ "multipleAria": "已收起 {{count}} 个插件面板,点击选择要恢复的面板"
},
"rightSidebar": {
"ariaLabel": "右侧边栏",
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 2957fc4d5a..dc593d62a0 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -4571,7 +4571,8 @@
},
"ghostPanelRestore": {
"single": "恢復 {{name}}",
- "multiple": "恢復插件面板({{count}})"
+ "multiple": "已收起的插件面板",
+ "multipleAria": "已收起 {{count}} 個插件面板,點擊選擇要恢復的面板"
},
"rightSidebar": {
"ariaLabel": "右側邊欄",