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): avoid wait cursor for plugin conflicts (#661)

Kmny47efed502da1
diff --git a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx
index 62a5f7100b..c692a2a60a 100644
--- a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx
+++ b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx
@@ -1118,7 +1118,12 @@ export function MarketPluginCard({
type="button"
onClick={onSelect}
disabled={busy || item.installState === 'conflict'}
- className="flex min-w-0 flex-1 items-start gap-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)] disabled:cursor-wait"
+ className={cn(
+ 'flex min-w-0 flex-1 items-start gap-4 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]',
+ item.installState === 'conflict'
+ ? 'disabled:cursor-not-allowed'
+ : 'disabled:cursor-wait',
+ )}
aria-label={item.name}
>
<GhostPluginIcon
diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx
index fe81dbe8da..710795ed89 100644
--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx
+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx
@@ -256,6 +256,36 @@ describe('GhostPluginCard', () => {
expect(screen.getByText('google-calendar').className).toContain('min-w-0');
expect(screen.getByText('Cindy').className).toContain('truncate');
});
+
+ it('distinguishes unavailable conflicts from busy market operations', () => {
+ const { rerender } = render(
+ <MarketPluginCard
+ item={{ ...marketPlugin, installState: 'conflict' }}
+ busy={false}
+ onSelect={vi.fn()}
+ onIconLoadError={vi.fn()}
+ />,
+ );
+
+ const cardBody = screen.getByRole('button', { name: 'Google Calendar' });
+ expect((cardBody as HTMLButtonElement).disabled).toBe(true);
+ expect(cardBody.className).toContain('disabled:cursor-not-allowed');
+ expect(cardBody.className).not.toContain('disabled:cursor-wait');
+
+ rerender(
+ <MarketPluginCard
+ item={marketPlugin}
+ busy
+ onSelect={vi.fn()}
+ onIconLoadError={vi.fn()}
+ />,
+ );
+
+ const busyCardBody = screen.getByRole('button', { name: 'Google Calendar' });
+ expect((busyCardBody as HTMLButtonElement).disabled).toBe(true);
+ expect(busyCardBody.className).toContain('disabled:cursor-wait');
+ expect(busyCardBody.className).not.toContain('disabled:cursor-not-allowed');
+ });
});
describe('LegacyGhostRecoveryNotice', () => {