Skip to content

fix(ui): 侧栏用户头像首字母溢出日食珠 — orb 回 in-flow、首字母 absolute 居中#148

Merged
sweetcornna merged 1 commit into
mainfrom
fix/ui-sidebar-avatar-initial
Jul 18, 2026
Merged

fix(ui): 侧栏用户头像首字母溢出日食珠 — orb 回 in-flow、首字母 absolute 居中#148
sweetcornna merged 1 commit into
mainfrom
fix/ui-sidebar-avatar-initial

Conversation

@sweetcornna

Copy link
Copy Markdown
Owner

问题

左下角用户 chip 的头像首字母(如 "C")溢出日食珠(PresenceOrb),被挤到珠子右边。

根因

ui/components/layout/sidebar.tsx 里首字母容器给 orb 加了无前缀的 absolute inset-0,但 .presence-orbui/app/globals.css ~L435,定义在 utilities 层之后)自身设了 position: relative; flex: none;,盖掉了无前缀的 absolute(只有 !h-7 !w-7! 前缀幸存)。于是珠子回到 in-flow,与首字母 span 并排,把首字母挤出珠子。

修法

让 orb 留在 in-flow 填满 28px 容器,把首字母 span 改成 absolute inset-0 居中覆盖:

  • orb: absolute inset-0 !h-7 !w-7!h-7 !w-7
  • 首字母 span: relative …absolute inset-0 flex items-center justify-center …
  • 不动 globals.css.presence-orbrelative 要锚定自身 bloom/伪元素)。
  • 首字母取值逻辑 (user ?? "a").slice(0, 1).toUpperCase() 原样保留。

复核

其他 PresenceOrb 调用点(brand-mark / message-bubble / chat-area / empty-state / not-found / login / onboard)都是自闭合、珠子上不叠定位子元素,也不给 orb 加 absolute,不受影响。

回归测试

sidebar.test.tsx 新增用例:给首字母 span 加 data-testid="nav-user-initial",断言其 className 含 absolute + inset-0、显示大写首字母,且 .presence-orb 的 className 不含 absolute

验证

cd ui && pnpm test(vitest 全量):155 个测试文件全绿,1188 passed / 2 skipped。设计语言守卫(tailwind.config.test.ts / globals-glass-vars.test.ts)与 sidebar 套件均通过。

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added codex:needs-review A Codex review is needed for the current PR head. codex:review-requested A Codex review was requested or should be running automatically. status: 🔁 re-review loop A fresh Codex review was requested after the latest change or comment. codex:reviewed Codex posted a review result or thumbs-up after the latest request. status: 👀 ready for maintainer look No automation blocker is known; a maintainer should inspect the current result. and removed codex:review-requested A Codex review was requested or should be running automatically. codex:needs-review A Codex review is needed for the current PR head. status: 🔁 re-review loop A fresh Codex review was requested after the latest change or comment. labels Jul 18, 2026
@sweetcornna
sweetcornna merged commit 3fe2d62 into main Jul 18, 2026
8 of 9 checks passed
@sweetcornna
sweetcornna deleted the fix/ui-sidebar-avatar-initial branch July 18, 2026 17:09
@github-actions github-actions Bot added the status: ✅ merge-ready Evidence and review are clear; normal merge gates may proceed. label Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex:reviewed Codex posted a review result or thumbs-up after the latest request. status: ✅ merge-ready Evidence and review are clear; normal merge gates may proceed. status: 👀 ready for maintainer look No automation blocker is known; a maintainer should inspect the current result.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant