Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
Revert "refactor(desktop): 调整侧边栏底部账号信息框样式"
Lizi282d4c258f2d
diff --git a/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts b/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.tsindex d86755852f..2f4e31b57d 100644--- a/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts+++ b/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts@@ -352,7 +352,7 @@ describe('NewMakerDraftRoute CREATE AGENT visual contract', () => {expect(vendorIconSource).toContain('text-[hsl(var(--sidebar-muted))]');expect(userInfoSectionSource).toContain(- 'border border-[var(--sidebar-user-card-border)]',+ 'rounded-full 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.tsindex 9f45dec944..4a08b95277 100644--- a/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts+++ b/apps/desktop/src/renderer/__tests__/userInfoSectionHover.test.ts@@ -32,12 +32,12 @@ const locale = JSON.parse(readFileSync(localePath, 'utf8')) as {describe('UserInfoSection — outer wrapper takes over full-row hover', () => {it('outer div keeps the sidebar footer slot', () => {- expect(source).toContain('mt-auto pt-1');+ expect(source).toContain('mt-auto px-3 pb-3 pt-2');});- it('visible user card uses the tokenized capsule style with 12px container radius', () => {+ it('visible user card uses the rounded tokenized capsule style', () => {expect(source).toContain(- 'flex h-12 items-center rounded-xl border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)] pl-3 pr-1.5',+ 'flex h-10 items-center rounded-full border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)] px-[7px]',);});@@ -101,13 +101,13 @@ describe('UserInfoSection — 未登录态头像兜底', () => {// 状态名四语各不相同(未登录 / Not signed in / 未ログイン / 로그인하지 않음),// 取首字会渲染成「未」/「N」这类无意义字符,所以这里必须走图标分支。expect(source).toContain('const showNotSignedInGlyph = !user && isLocal;');- // 折叠 rail(36px 圆)与展开胶囊(40px 圆)两处兜底都要接上- const matchCount = (- source.match(- /showNotSignedInGlyph \? \(\s*\n\s*<UserRound aria-hidden="true" size=\{18\}/g,- ) ?? []- ).length;- expect(matchCount).toBe(2);+ // 折叠 rail(36px 圆)与展开胶囊(27px 圆)两处兜底都要接上+ 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=\{15\}/,+ );});it('已登录用户仍使用姓名首字兜底', () => {@@ -119,12 +119,13 @@ describe('UserInfoSection — 未登录态头像兜底', () => {});describe('UserInfoSection — mobile download entry', () => {- it('uses the local Lucide Smartphone icon in a matching action button', () => {+ it('uses the local Lucide Smartphone icon in a matching 22x22 capsule action', () => {expect(source).toContain("import { Flame, Shield, Smartphone, UserRound } from 'lucide-react';",);- expect(source).toMatch(/mobile-download-btn',\s*\r?\n\s*'flex shrink-0[\s\S]*isCollapsed \? 'h-8 w-8' : 'h-9 w-9'/);- expect(source).toContain('<Smartphone className="h-5 w-5" aria-hidden="true" />');+ expect(source).toMatch(/'mobile-download-btn',\s*\n\s*'flex h-\[22px\] w-\[22px\]/);+ expect(source).toContain("!isCollapsed && 'mr-1'");+ expect(source).toContain('<Smartphone className="h-3 w-3" aria-hidden="true" />');});it('suppresses capsule hover while the mobile button owns the hover state', () => {@@ -143,7 +144,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-[76px] flex-col items-center justify-center gap-1 px-3"',+ 'className="mt-auto flex h-[66px] flex-col items-center justify-center gap-1 px-3"',);expect(source).toContain('{mobileDownloadEntry}');});@@ -185,7 +186,7 @@ describe('UserInfoSection — inner main button no longer owns hover background'describe('UserInfoSection — Flame button carries .flame-btn marker class', () => {it("Flame button className list includes 'flame-btn' as the first entry", () => {// 关键: 外层 div 的 has-[.flame-btn:hover] 选择器必须能钩到这个 class- expect(source).toMatch(/'flame-btn',\s*\n\s*'flex h-9 w-9/);+ expect(source).toMatch(/'flame-btn',\s*\n\s*'flex h-\[22px\] w-\[22px\]/);});it('Flame button retains its own hover:bg-sidebar-item-hover (capsule highlight when hovered)', () => {@@ -193,9 +194,12 @@ describe('UserInfoSection — Flame button carries .flame-btn marker class', ()expect(source).toMatch(/'transition-colors hover:bg-sidebar-item-hover'/);});- it('Flame button keeps correct size and rounded-full inside the account capsule', () => {+ it('Flame button keeps rounded-full + 22x22 size inside the account capsule', () => {+ expect(source).toContain(+ 'flex h-[22px] w-[22px] shrink-0 items-center justify-center rounded-full',+ );expect(source).toContain(- 'flex h-9 w-9 shrink-0 items-center justify-center rounded-full',+ 'border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)]',);});});diff --git a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsxindex b53fbfaa68..1e07e012aa 100644--- a/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx+++ b/apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx@@ -95,20 +95,21 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSecaria-label={t('sidebar.user.downloadMobile')}className={cn('mobile-download-btn',- 'flex shrink-0 items-center justify-center rounded-full',- isCollapsed ? 'h-8 w-8' : 'h-9 w-9',+ 'flex h-[22px] w-[22px] shrink-0 items-center justify-center rounded-full',+ !isCollapsed && 'mr-1',+ 'border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)]','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)]',)}>- <Smartphone className="h-5 w-5" aria-hidden="true" />+ <Smartphone className="h-3 w-3" aria-hidden="true" /></button>);if (isCollapsed) {return (<>- <div className="mt-auto flex h-[76px] flex-col items-center justify-center gap-1 px-3">+ <div className="mt-auto flex h-[66px] flex-col items-center justify-center gap-1 px-3"><buttononClick={handleClick}role="link"@@ -169,13 +170,12 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec}return (- <div className="mt-auto pt-1">+ <div className="mt-auto px-3 pb-3 pt-2">{/* 胶囊整体承载 hover(方案 D):玻璃底色加深一档;悬停右侧操作按钮时用- :has() 把胶囊底色还原,只让当前按钮高亮,避免双层叠色。- 横向填满容器、向下填满、12px 容器圆角(rounded-xl)。 */}+ :has() 把胶囊底色还原,只让当前按钮高亮,避免双层叠色。 */}<divclassName={cn(- 'flex h-12 items-center rounded-xl border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)] pl-3 pr-1.5',+ 'flex h-10 items-center rounded-full border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)] px-[7px]','transition-colors hover:bg-[var(--sidebar-user-card-bg-hover)]','has-[.flame-btn:hover]:bg-[var(--sidebar-user-card-bg)]','has-[.mobile-download-btn:hover]:bg-[var(--sidebar-user-card-bg)]',@@ -189,25 +189,25 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec>{/* Avatar — admin 用户加 1.5px 反色描边 + 右下角盾牌角标 */}<div- className="relative h-10 w-10 shrink-0"+ className="relative h-[27px] w-[27px] shrink-0"title={isCanary ? t('sidebar.user.canaryBadge') : undefined}>{user?.avatar && !avatarError ? (<imgsrc={user.avatar}alt={displayName}- className={cn('h-10 w-10 rounded-full object-cover')}+ className={cn('h-[27px] w-[27px] rounded-full object-cover')}onError={() => setAvatarError(true)}/>) : (<divclassName={cn(- 'flex h-10 w-10 items-center justify-center rounded-full',- 'border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)] text-16 font-medium text-[var(--sidebar-user-card-text)]',+ 'flex h-[27px] w-[27px] items-center justify-center rounded-full',+ 'border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)] text-14 font-medium text-[var(--sidebar-user-card-text)]',)}>{showNotSignedInGlyph ? (- <UserRound aria-hidden="true" size={18} strokeWidth={1.75} />+ <UserRound aria-hidden="true" size={15} strokeWidth={1.75} />) : (initial)}@@ -273,7 +273,8 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec}className={cn('flame-btn',- 'flex h-9 w-9 shrink-0 items-center justify-center rounded-full',+ 'flex h-[22px] w-[22px] shrink-0 items-center justify-center rounded-full',+ 'border border-[var(--sidebar-user-card-border)] bg-[var(--sidebar-user-card-bg)]','transition-colors hover:bg-sidebar-item-hover','transition-opacity duration-200 ease-in-out','opacity-100',@@ -281,7 +282,7 @@ export function UserInfoSection({ isCollapsed, onOpenUpdateNotice }: UserInfoSec><FlameclassName={cn(- 'h-5 w-5',+ 'h-3 w-3',isFlameReopen? 'fill-current text-[var(--sidebar-user-card-text)]': 'text-[var(--sidebar-user-card-text)]',