fix(capsule): center Windows pill within shadow inset#264
fix(capsule): center Windows pill within shadow inset#264weikeyi wants to merge 3 commits intoappergb:mainfrom
Conversation
PR Reviewer Guide 🔍(Review updated until commit 351f956)Here are some key observations to aid the review process:
|
|
Persistent review updated to latest commit 9660db6 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 351f956b1e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| return { width: 176, height: 42, textWidth: 84 }; | ||
| return { width: 176, height: 42, textWidth: 84, boxSizing: 'content-box' }; |
There was a problem hiding this comment.
Keep macOS/Linux capsule in border-box sizing
Returning boxSizing: 'content-box' for non-Windows capsules changes the rendered pill width on macOS/Linux because Capsule.tsx applies width, padding: '0 8px', and a border while the app’s global CSS currently enforces * { box-sizing: border-box; } (in src/styles/tokens.css). This regression makes the pill visibly wider than the 176px metric and can misalign spacing/badge positioning compared with the pre-change geometry. Use border-box here (or adjust width constants) to preserve existing layout.
Useful? React with 👍 / 👎.
|
Persistent review updated to latest commit 351f956 |
|
请修复这些P2的严重问题 |
User description
摘要
Part of #244.
这个 PR 收敛 Windows 录音胶囊的 host / pill 几何关系:让 pill 在 host 内水平居中,并把左右阴影 inset 从隐含布局改成显式模型,降低 Windows 端阴影裁切和偏位风险。
修复 / 新增 / 改进
flex-end偏右摆放,改为在 host 内水平居中capsuleLayout中显式建模horizontalInsetpill.width + horizontalInset * 2推导,保留当前220px外层范围兼容
PR Type
Bug fix, Enhancement, Tests
Description
Center Windows pill using
justify-content: centerinstead offlex-endto fix shadow clipping and button offsetIntroduce explicit
horizontalInsetin host metrics for Windows (12px) and derive host width from pill width + insetsAdd
boxSizing: 'border-box'to pill and host to ensure proper width calculation for shadow roomImprove text and center content width handling with
width: '100%',maxWidth, andminWidth: 0Add unit tests for new metrics to prevent future regressions
Diagram Walkthrough
File Walkthrough
lib.rs
Derive Windows capsule host width from pill width and insetsopenless-all/app/src-tauri/src/lib.rs
horizontal inset (12px) for clarity and shadow room
capsuleLayout.ts
Model horizontal shadow insets and box-sizing in capsule layoutopenless-all/app/src/lib/capsuleLayout.ts
CapsulePillMetricsandCapsuleHostMetricsinterfaces withboxSizingandhorizontalInsetboxSizing: 'border-box'insets, and return
horizontalInsetandboxSizingCapsule.tsx
Center pill and fix width handling for Windows shadow insetopenless-all/app/src/components/Capsule.tsx
flex-endtocenterto centerpill
paddingLeftandpaddingRightusing host horizontal insetboxSizingon pill and host containerswidth: '100%',maxWidth,minWidth: 0to prevent overflow and misalignmentcapsuleLayout.test.ts
Add unit tests for capsule host metrics and box-sizingopenless-all/app/src/lib/capsuleLayout.test.ts
getCapsuleHostMetricsfor Windows (regular andtranslation) and macOS
from pill width
boxSizingas 'content-box'