fix(ui): 侧栏用户头像首字母溢出日食珠 — orb 回 in-flow、首字母 absolute 居中#148
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
左下角用户 chip 的头像首字母(如 "C")溢出日食珠(PresenceOrb),被挤到珠子右边。
根因
ui/components/layout/sidebar.tsx里首字母容器给 orb 加了无前缀的absolute inset-0,但.presence-orb(ui/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居中覆盖:absolute inset-0 !h-7 !w-7→!h-7 !w-7relative …→absolute inset-0 flex items-center justify-center …globals.css(.presence-orb的relative要锚定自身 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 套件均通过。