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