Skip to content

fix(ui): make states and warnings readable, add rule actions - #68

Open
harryisfish wants to merge 2 commits into
mainfrom
fix/ui-ux-review-fixes
Open

harryisfish wants to merge 2 commits into
mainfrom
fix/ui-ux-review-fixes

Conversation

@harryisfish

Copy link
Copy Markdown
Contributor

背景

对界面做了一次 better-interface full 评审(只读),确认 3 项 HIGH:告警文字与选中态在浅色/深色外观下不可读;规则卡的编辑与排序只有右键菜单通路,键盘/读屏不可达;另有一批一致性缺陷。本 PR 只修 HIGH 与不改变行为契约的一致性缺陷。设置页信息架构、12px 长文案、选择器搜索、状态分级类型化留后续任务(见 .planning/ui-ux-review-fixes-2026-09-11_19-07-30/task_plan.md 非目标)。

改动

  • 新增 src/theme_ext.rs:按角色取色(warning_text / chip_bg / chip_fg / selection_border / row_hover)+ WCAG luminance / contrast_ratio,并对内置 Light/Dark 取值写 5 个对比度单测。
  • 告警文字全部改走 warning_text。原实现直接用 theme.warning(填充色):浅色下 yellow-500 落在卡片底 #f5f5f5 上约 1.8:1。
  • 徽章改中性底 + 前景字(pill 去掉颜色参数)。原实现以 theme.accent(悬停背景 token)同时当底色与文字色:浅色约 1.0:1、深色约 1.3:1,规则卡的 via 徽章因此读不出。
  • 卡片选中态改用 primary 描边,与文案「卡片边框仅表示编辑中」一致;悬停底色改用与卡片底不同的取值(浅色下 muted 与 group_box 同值,原本没有悬停反馈)。
  • 规则卡补行内「编辑 / 上移 / 下移」按钮(带可访问名),与既有「删除」并列;卡片点击打开编辑器与右键菜单保持不变。
  • 一致性:删除重复的 open-login-items 按钮与重复 id;总览删掉与 hero 重复的「状态」指标;kept → 保留;断开不再用 danger;托盘「更新配置」→「应用」。
  • AGENTS.md 补两句契约:规则卡行内按钮、UI 文字色走 theme_ext 角色。

验证

  • cargo test --lib theme_ext(5 passed,含用已知 4.74:1 对照校验 WCAG 计算)
  • cargo test(76 passed)
  • cargo check --bins
  • grep 回归:src/ui.rs 无 theme.accent、无原始 warning 文字色;open-login-items 1 处;kept 0 处;规则卡 edit-rule- / up-rule- / down-rule- 各 1 处
  • 明暗两套外观的渲染眼验(未完成:本机 release 版正在运行且窗口报告在屏外,截图不可用;配色取值已由单测覆盖)

需要确认

徽章从彩色底改成中性底(状态语义由文字承载)是本次的设计取舍;若希望保留彩色徽章,需要另选满足对比度的文字色。

## Summary
- Add `theme_ext` color roles (`warning_text`, `chip_bg`/`chip_fg`, `selection_border`, `row_hover`) with contrast tests against the shipped Light/Dark palettes. Warning text was the amber fill color (1.8:1 on the light card surface), badges used `accent` as a foreground (about 1.0:1 in Light, 1.3:1 in Dark), and card hover used a fill equal to the card surface, so hover, selection and warning copy were invisible or unreadable.
- Badges are neutral now (text carries the state); a card being edited is shown by a `primary` selection border, which matches the documented "border only means editing" behaviour.
- Every rule card carries inline 编辑 / 上移 / 下移 buttons next to 删除, so editing and reordering no longer depend on a right-click context menu and are reachable by keyboard.
- Consistency: drop the duplicate `open-login-items` button and id, drop the overview status metric that repeated the hero, translate `kept`, stop styling the reversible 断开 action as danger, name the tray item 应用.
- AGENTS.md records the rule-card buttons and the `theme_ext` color-role rule.

## Test plan
- [x] `cargo test --lib theme_ext` (5 tests: warning text reaches 4.5:1 in both appearances, badge text and selection border reach their ratios, hover separates from the card surface, and the WCAG math is checked against the known 4.74:1 pair)
- [x] `cargo test` (76 passed)
- [x] `cargo check --bins`
- [x] `grep`: no `theme.accent` left in `src/ui.rs`; no raw warning text color; one `open-login-items`; no `kept`
- [ ] Rendered check in Light and Dark (blocked: the release app is running and its window reports off-screen, so screenshots are unavailable)
@leaperone-bot

leaperone-bot commented Sep 11, 2026 •

Copy link
Copy Markdown

🤖 Leo

Code Review

⏳ 等待审查...

最后更新: 2026-09-11 13:32 · 087a307

- List the AGENTS.md contract edits in the task plan's change paths.
- Record preflight Phase 1/1.5/2 results and the main-agent review findings (0 critical/high) in progress.md.
harryisfish added a commit that referenced this pull request Sep 15, 2026
releaseIfSystemDNSIsClear already withholds a bare swallow. The probe
comment on that function keeps the polarity.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants