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): 修复侧边栏账号信息框折叠态溢出和测试断层

Shinku6e7e70bca7bf
diff --git a/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts b/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts
index 7c11adc341..1ed1c40aa4 100644
--- a/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts
+++ b/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts
@@ -350,7 +350,7 @@ describe('NewMakerDraftRoute CREATE AGENT visual contract', () => {
expect(vendorIconSource).toContain('text-[hsl(var(--sidebar-muted))]');
expect(userInfoSectionSource).toContain(
- 'rounded-full border border-[var(--sidebar-user-card-border)]',
+ 'border border-[var(--sidebar-user-card-border)]',
);
expect(userInfoSectionSource).toContain('bg-[var(--sidebar-user-card-bg)]');
expect(userInfoSectionSource).toContain('text-[var(--sidebar-user-card-text)]');
diff --git a/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts b/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
index c1521abcfb..a83cad5716 100644
--- a/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
+++ b/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts
@@ -102,12 +102,12 @@ describe('UserInfoSection — 未登录态头像兜底', () => {
// 取首字会渲染成「未」/「N」这类无意义字符,所以这里必须走图标分支。
expect(source).toContain('const showNotSignedInGlyph = !user && isLocal;');
// 折叠 rail(36px 圆)与展开胶囊(40px 圆)两处兜底都要接上
- expect(source).toMatch(
- /showNotSignedInGlyph \? \(\s*\n\s*<UserRound aria-hidden="true" size=\{18\}/,
- );
- expect(source).toMatch(
- /showNotSignedInGlyph \? \(\s*\n\s*<UserRound aria-hidden="true" size=\{18\}/,
- );
+ const matchCount = (
+ source.match(
+ /showNotSignedInGlyph \? \(\s*\n\s*<UserRound aria-hidden="true" size=\{18\}/g,
+ ) ?? []
+ ).length;
+ expect(matchCount).toBe(2);
});
it('已登录用户仍使用姓名首字兜底', () => {
@@ -123,7 +123,7 @@ describe('UserInfoSection — mobile download entry', () => {
expect(source).toContain(
"import { Flame, Shield, Smartphone, UserRound } from 'lucide-react';",
);
- expect(source).toMatch(/'mobile-download-btn',\s*\n\s*'flex h-9 w-9/);
+ expect(source).toMatch(/mobile-download-btn',\s*\n\s*'flex shrink-0.*\n.*isCollapsed \? 'h-8 w-8' : 'h-9 w-9'/);
expect(source).toContain('<Smartphone className="h-5 w-5" aria-hidden="true" />');
});
@@ -143,7 +143,7 @@ describe('UserInfoSection — mobile download entry', () => {
it('keeps the same entry and dialog available in the collapsed sidebar', () => {
expect(source).toContain(
- 'className="mt-auto flex h-[66px] flex-col items-center justify-center gap-1 px-3"',
+ 'className="mt-auto flex h-[72px] flex-col items-center justify-center gap-1 px-3"',
);
expect(source).toContain('{mobileDownloadEntry}');
});
diff --git a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
index 692e7aed69..536c7f1672 100644
--- a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
+++ b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx
@@ -95,7 +95,8 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
aria-label={t('sidebar.user.downloadMobile')}
className={cn(
'mobile-download-btn',
- 'flex h-9 w-9 shrink-0 items-center justify-center',
+ 'flex shrink-0 items-center justify-center',
+ isCollapsed ? 'h-8 w-8' : 'h-9 w-9',
'text-[var(--sidebar-user-card-text)] transition-colors hover:bg-sidebar-item-hover',
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]',
)}
@@ -107,7 +108,7 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
if (isCollapsed) {
return (
<>
- <div className="mt-auto flex h-[66px] flex-col items-center justify-center gap-1 px-3">
+ <div className="mt-auto flex h-[72px] flex-col items-center justify-center gap-1 px-3">
<button
onClick={handleClick}
role="link"
@@ -171,7 +172,7 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec
<div className="mt-auto pt-1">
{/* 胶囊整体承载 hover(方案 D):玻璃底色加深一档;悬停右侧操作按钮时用
:has() 把胶囊底色还原,只让当前按钮高亮,避免双层叠色。
- 横向填满容器、向下填满、圆角矩形(不用直角)。 */}
+ 横向填满容器、向下填满、直角矩形(去掉圆角)。 */}
<div
className={cn(
'flex h-12 items-center border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)] pl-3 pr-1.5',