Skip to content

播放条左下三枚键的读数收成网易云式角标:挂在图形右上角外侧、不占布局 - #736

Merged
ShellMonster merged 2 commits into
mainfrom
work/count-badges
Nov 3, 2026
Merged

ShellMonster merged 2 commits into
mainfrom
work/count-badges

Conversation

@ShellMonster

@ShellMonster ShellMonster commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

User description

改了什么

播放条左下那三枚键(赞 / 收藏 / 评论)的读数,从「图形 18 │ 缝 2 │ 数字」横排收成网易云式角标:数字折成固定 10 号的小字,骑在图形盒子的右上角外侧——数字的左缘贴着图形的右肩、上缘贴着图形的上沿,不压住图标本体,图形完整露出。

形态

  • 挂点:Attach(AnchorTopRight, AnchorTopLeft)——角标的左上角钉在图形盒子(18×18)的右上角,再 Right(1.5) 往左收进图形右缘一点、Top(2.5) 往下压到上沿。数字像挂在图形右肩上的小尾巴。
  • 角标是绝对定位(不占布局),PassThrough() 不登记命中——底下的按钮照点、悬停照常。
  • 字号钉死 10(不跟系统文本缩放走)、颜色 TextMuted、上限 24.5、左对齐、单行 + 省略号。

覆盖的键

原来 countKeyRow 管的三枚全收:赞(like.go,它那两层背景 + 拇指是绝对定位的,角标走同一份 countBadge)、收藏、评论(comments_entry.go,走 countKeyIcon)。

宽度账

角标不占布局 ⇒ 三枚键各回到 32(图形 18 + 两侧各 7,和没有数字时一模一样),第三段从 165.5 缩回 128,左列保底 272——那 37.5 像素让给了进度条(900 宽的窗口上左列右端离滑块的余量从 5.20 回到 42.7)。数字探出图形右缘的那一段叠在右侧空白间距上,不进任何一列的宽度账。

铁律没破

「+」是这一族的语义(至少这么多),截断先切末尾、它总是第一个没——所以字号钉死、上限钉死、MinWidth = MaxWidth 双钉(attach 按父盒子 18 给可用宽,不钉会把「1亿+」截成「1亿…」)。当前折法最宽的「99k+」24.49 ≤ 24.5,一档都不截。

验证

  • 单测 TestTheThreeCountsSitAsBadgesOnTheIconsTopRight:角标上缘贴图形上沿(±nudge)、左缘落在图形右肩([图形中点, 图形右缘])、主体在图形右缘以右——三枚键全过。TestTheCountDoesNotSqueezeTheTitleOrTheSlider 重写成「带不带数字,键都是 32、标题和进度条一个字都不让」。
  • E2E TestThePlayBarCountsSitAsBadges(BIU_RUN_MYGO_E2E=1,internal/e2e/):真窗口 capture 回来的 PNG 上按像素断——图形右肩那一带(图形右缘往右、贴上沿)有数字墨迹,而且左端骑在肩上(横排版的缝是空的,这里有墨)。无障碍树上按钮是 leafRole、角标文本收进按钮的名字里(「赞 9k+」),所以像素层断的是画面事实。
  • 全量:go build -trimpath -p 4 ./... && go vet -trimpath -p 4 ./... && go test -p 4 $(go list ./... | grep -v '/internal/ui$') 过;internal/ui 里 TestThePlayBarCoverIsRoundedSix 是基线上就挂的既有失败(与本票无关,git stash 验证过)。

无绑票。


CodeAnt-AI Description

Move playback counts to compact badges above and right of their icons

What Changed

  • Like, favorite, and comment counts now appear in small badges at the icons’ upper-right edges without covering them.
  • Badges no longer widen their buttons, leaving more space between the action row and the progress bar.
  • Badges don't intercept clicks, so the buttons beneath them remain clickable.

Impact

✅ Clearer count placement
✅ More clearance before the progress bar
✅ Clickable playback buttons

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #d1571 Incremental review completed 15eeaf4 Nov 02, 2026 · 14:45 14:45
✅  #85649 Reviewed your PR 70e0b06 Nov 02, 2026 · 13:28 13:37

@codeant-ai

codeant-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:XL This PR changes 500-999 lines, ignoring generated files label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

PudMusic UI 截图

截图测试已通过。

截图来自项目现有的 MyGo UI 测试渲染器,使用本地 fixture,不启动真实登录态。

// 给可用宽,而 `fitWidth` 取 `min(内容, 可用)`——不钉 MinWidth 的话,
// 角标那一格被夹成 18,「1亿+」(23.61)就被截成「1亿…」,**那个「+」
// 没了**(它是这一族的语义)。钉到 24.5 = 上限那一档,一格都不截。
MinWidth(playbarBadgeMaxW).MaxWidth(playbarBadgeMaxW).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: With 99k+, the 24.5px badge spans about 9px into the next button’s icon box, so its text collides with that icon instead of staying beside its own.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Css layout issue

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** internal/ui/playbar_counts.go
**Line:** 297:297
**Comment:**
	*Css Layout Issue: With `99k+`, the 24.5px badge spans about 9px into the next button’s icon box, so its text collides with that icon instead of staying beside its own.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Nitpicks

1 code suggestion

1. In dark themes, TextMuted is lighter than the bar background, so this test counts no badge pixels and fails despite correct rendering.

Incorrect condition logic · internal/e2e/counts_test.go:304

@codeant-ai

codeant-ai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt PR Risk

🟡  Medium Risk

  • The PR needs attention before merging.
  • The 22.5-DIP badge extends beyond the 3-DIP gap into the next button’s icon area, so count text can overlap the artwork.

Assessed commit: 15eeaf4782c3

改之前那三枚键(赞 / 收藏 / 评论)是「图形 18 │ 缝 2 │ 数字」横排:
数字占一格,带数字的那一枚键因此宽 44.5,第三段比没有数字时宽出
37.5——900 宽的窗口上左列右端离进度条滑块只剩 5.20 像素。

现在改成角标:数字折成固定 9 号的小字(list.CountText 那一套折法,
约是图标高的 1/3、和图标的视觉重量拉得开),Attach(AnchorTopRight,
AnchorTopLeft) 把角标的左上角钉在图形盒子的右上角——左缘贴图形
右缘、上缘贴图形上沿,数字整个在图形右上外侧、不压图标本体也不
内收。角标是绝对定位、不占布局、PassThrough 不登记命中——三枚键
各回到 32 宽(图形 18 + 两侧各 7),第三段从 165.5 缩回 137(四枚
32 + 三道 3 的键间缝——角标探出之后叠在缝上,没缝三枚带数的键糊
成一串),净让 28.5 给了进度条。

约束照旧:「+」是这一族的语义(至少这么多),所以字号钉死在 9
(系统文本放大 115% 就会截掉它)、上限钉在 22.5(刚好装下最宽的
「99k+」≈22.0)、MinWidth=MaxWidth 双钉(attach 按父盒子 18 给可用
宽,不钉的话那一格被夹成 18,「1亿+」的「+」就没了)、TextMuted
色、MaxLines(1) + Ellipsis 兜底(当前折法一档都用不上截断)。

E2E(internal/e2e/counts_test.go)走真窗口的无障碍树 + capture:
三枚键的名字里带数(赞 9k+ / 收藏 2k+ / 评论 1k+),而画面上图形
右缘贴边那一带和右上外侧那一带都有墨迹——横排版(数字中线 ≈
键中心、左缘在缝后)和内收版(左缘在图形上)都红。
@ShellMonster
ShellMonster merged commit 725b582 into main Nov 3, 2026
2 of 3 checks passed
@ShellMonster
ShellMonster deleted the work/count-badges branch November 3, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant