Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(plugins): 防止市场卡片元数据异常换行 (#432)
xxxcc39afc9bd67c8
diff --git a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsxindex a1095065ea..e532d3423d 100644--- a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx+++ b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx@@ -932,7 +932,7 @@ export function GhostPluginPage() {);}-function MarketPluginCard({+export function MarketPluginCard({item,busy,onSelect,@@ -972,18 +972,24 @@ function MarketPluginCard({{item.name}</span></span>- <span className="mt-1 flex min-w-0 items-center gap-1.5 text-11 text-[var(--text-tertiary)]">- <span>+ <span className="mt-1 flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap text-11 text-[var(--text-tertiary)]">+ <span className="shrink-0">{t(`settings.ghosts.page.origin.${pluginPresentationOrigin(item)}`)}</span>- <span aria-hidden="true">·</span>- <span>v{item.version}</span>- <span aria-hidden="true">·</span>- <span className="truncate font-mono">{item.ghostId}</span>+ <span className="shrink-0" aria-hidden="true">+ ·+ </span>+ <span className="shrink-0">v{item.version}</span>+ <span className="shrink-0" aria-hidden="true">+ ·+ </span>+ <span className="min-w-0 truncate font-mono">{item.ghostId}</span>{item.author ? (<>- <span aria-hidden="true">·</span>- <span className="truncate">{item.author}</span>+ <span className="shrink-0" aria-hidden="true">+ ·+ </span>+ <span className="min-w-0 truncate">{item.author}</span></>) : null}</span>diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsxindex 205327a5e2..0e5bf0627e 100644--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx@@ -1,5 +1,5 @@/**- * Regression coverage for installed Plugin card actions.+ * Regression coverage for Plugin card actions and compact marketplace metadata.* [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md* @vitest-environment jsdom*/@@ -20,8 +20,9 @@ vi.mock('@/components/ui/tooltip', () => ({),}));-import { GhostPluginCard, InstalledGhostShortcut } from '../GhostPluginPage';+import { GhostPluginCard, InstalledGhostShortcut, MarketPluginCard } from '../GhostPluginPage';import type { GhostPluginListItem } from '../lib/ghostPluginViewModel';+import type { PluginMarketItem } from '../../../../shared/pluginMarket';const installedPlugin: GhostPluginListItem = {id: 'filo-google',@@ -32,6 +33,23 @@ const installedPlugin: GhostPluginListItem = {canUse: true,};+const marketPlugin: PluginMarketItem = {+ pluginId: 'release-google-calendar',+ ghostId: 'google-calendar',+ name: 'Google Calendar',+ description: 'Connect Google Calendar',+ author: 'Cindy',+ scope: 'public',+ organizationId: null,+ defaultInstall: false,+ releaseId: 'release-1',+ version: '1.3.11',+ publishedAt: '2026-07-25T00:00:00.000Z',+ icon: null,+ installState: 'not-installed',+ enabled: null,+};+describe('GhostPluginCard', () => {it('shows the installed shortcut name through the shared Tooltip', () => {const onSelect = vi.fn();@@ -166,4 +184,25 @@ describe('GhostPluginCard', () => {expect(fallbackIcon).toBeTruthy();expect(fallbackIcon?.parentElement?.className).toContain('var(--surface-elevated)');});++ it('keeps fixed market metadata on one line while truncating long identities', () => {+ render(+ <MarketPluginCard+ item={marketPlugin}+ busy={false}+ onSelect={vi.fn()}+ onIconLoadError={vi.fn()}+ />,+ );++ const origin = screen.getByText('settings.ghosts.page.origin.public');+ const metadata = origin.parentElement;+ expect(metadata?.className).toContain('whitespace-nowrap');+ expect(metadata?.className).toContain('overflow-hidden');+ expect(origin.className).toContain('shrink-0');+ expect(screen.getByText('v1.3.11').className).toContain('shrink-0');+ expect(screen.getByText('google-calendar').className).toContain('truncate');+ expect(screen.getByText('google-calendar').className).toContain('min-w-0');+ expect(screen.getByText('Cindy').className).toContain('truncate');+ });});