diff --git a/DESIGN.md b/DESIGN.md index a18e7d8e..8dc932a8 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -451,7 +451,7 @@ opacity:0),悬停才显形——已喜欢那颗常亮的心悬停时不挪 | 页面 | 要点 | | --- | --- | -| 搜索结果 | 有匹配用户时,页头展示最多 8 个相关 UP 主,头像 72、项宽 116、缝 16,使用用户搜索返回的头像和认证类型;点击进入 UP 主空间,「查看全部」切到 UP 主标签。用户预览失败时可重试,空结果沿用「搜索结果」+「关键词」页头,均不阻塞歌曲和视频结果。`pud.Tabs` 歌曲 / 视频 / UP 主(计数只在该档拉过之后有);工具条 = 排序图标 + `SelectBox` 弹层 + 右端主色小号「播放全部」;UP 主是两列 `UCard`(缝 16,无关注键);空状态「没有找到相关歌曲 / 视频 / UP 主」+「清空搜索」 | +| 搜索结果 | 有匹配用户时,在搜索词行右侧放「查看全部」,下面展示最多 8 个相关 UP 主,头像 72、项宽 116、缝 16,使用用户搜索返回的头像和认证类型;点击进入 UP 主空间,「查看全部」切到 UP 主标签。用户预览失败时可重试,空结果沿用「搜索结果」+「关键词」页头,均不阻塞歌曲和视频结果。`pud.Tabs` 歌曲 / 视频 / UP 主(计数只在该档拉过之后有);工具条 = 排序图标 + `SelectBox` 弹层 + 右端主色小号「播放全部」;UP 主是两列 `UCard`(缝 16,无关注键);空状态「没有找到相关歌曲 / 视频 / UP 主」+「清空搜索」 | | 稍后再看 | 导语「先存下来,等有空的时候再听。」;操作 = 主色「播放全部」+ 幽灵「删除已看完的 N」(走确认弹窗);没有筛选条 | | 历史记录 | 无表头、按日分组:组头「今天 / 昨天 / M 月 D 日」宋体 20 + 「N 首」12 等宽 text-3,上 32 下 8;工具条 = `MiniSearch`(180) + `DropButton`「日历 + 范围 + 下箭头」弹层(今天 / 最近 7 / 14 / 30 天 / 不按日期筛 + 开始 / 结束两个输入 + 应用) | | 本地音乐 | 导语「N 个文件 · 支持 FLAC、MP3……」;拖入区 = 1px 虚线 `line-strong`、圆角 12、内边距 24、离上 24、48 圆形图标位 + 16 粗 / 13 text-2 两行 + 「选择文件夹」;页头 / 拖入区 / 表头放进列表 `Lead`,整页一起滚;行菜单末尾「在访达里显示」「删除文件」 | diff --git a/internal/ui/search_creators.go b/internal/ui/search_creators.go index 51774f52..49b8c9bc 100644 --- a/internal/ui/search_creators.go +++ b/internal/ui/search_creators.go @@ -164,9 +164,9 @@ func (s *Shell) searchCreatorLead(keyword string, tab int) *list.Lead { Label: "搜索结果页头", Height: func() float32 { if tab == searchTabUser { - return 300 + return 252 } - return 340 + return 292 }, Draw: func(c *ui.Context) { s.viewSearchLead(c, keyword, tab) @@ -175,13 +175,12 @@ func (s *Shell) searchCreatorLead(keyword string, tab int) *list.Lead { } func (s *Shell) viewSearchLead(c *ui.Context, keyword string, tab int) { - winW, _ := c.Size() ty := tok.Of(c.Theme()) p := &s.search.creators - pud.PageHeadFnEyebrow(c, func() { - typo.EyebrowText(c, "搜索「"+keyword+"」").SingleLine().Ellipsis("…") - }, "相关 UP 主", winW, nil, func() { + ui.Row(c).FillWidth().AlignItems(ui.Center). + Padding(space.Px24, space.None, space.Px8, space.None).Children(func() { + typo.EyebrowText(c, "搜索「"+keyword+"」").SingleLine().Ellipsis("…").Grow(1) if ui.ButtonBase(c).Label("查看全部 UP 主").Padding(space.Px8).Children(func() { ui.Text(c, "查看全部 ›").TextColor(ty.Text2) }).Clicked() { diff --git a/internal/ui/search_creators_test.go b/internal/ui/search_creators_test.go index fa49da71..9627474d 100644 --- a/internal/ui/search_creators_test.go +++ b/internal/ui/search_creators_test.go @@ -26,7 +26,7 @@ func TestSearchCreatorsAreClickable(t *testing.T) { s.search.creators.fetch = func(context.Context, string) ([]app.SearchItem, error) { return []app.SearchItem{creatorItem("42", "测试UP", "", bili.VerificationPersonal), creatorItem("43", "另一个UP", "", bili.VerificationOrganization)}, nil } - waitFrames(t, tt, "相关UP主", func() bool { return tt.HasText("测试UP") && tt.HasText("另一个UP") }) + waitFrames(t, tt, "搜索结果 UP 主", func() bool { return tt.HasText("测试UP") && tt.HasText("另一个UP") }) if err := tt.Click("打开 测试UP 的空间"); err != nil { t.Fatal(err) } @@ -186,9 +186,7 @@ func TestSearchCreatorViewAllOpensUserTab(t *testing.T) { } } -// TestSearchCreatorHeaderKeepsPageGeometry locks that the creator preview does not -// move the page: the eyebrow keeps the page-head offset and the tabs stay put when -// the preview lands (they used to jump ~50px and the header dropped its 24px pad). +// TestSearchCreatorHeaderKeepsPageGeometry locks the search row and tabs when the creator preview lands. func TestSearchCreatorHeaderKeepsPageGeometry(t *testing.T) { s, tt := newSearchPage(t, "音乐", newSearchStub(24, 24)) entered, release := make(chan struct{}), make(chan struct{}) @@ -215,16 +213,26 @@ func TestSearchCreatorHeaderKeepsPageGeometry(t *testing.T) { if !ok { t.Fatalf("预览还在路上时没有 Tab:%q", tt.Texts()) } + actionBefore, ok := tt.Find("查看全部 UP 主") + if !ok { + t.Fatalf("预览还在路上时没有查看全部操作:%q", tt.Texts()) + } close(release) waitFrames(t, tt, "示例UP出现", func() bool { return tt.HasText("示例UP") }) headAfter, _ := tt.Find("搜索「音乐」") tabAfter, _ := tt.Find("UP 主") + actionAfter, _ := tt.Find("查看全部 UP 主") if headBefore.Y != headAfter.Y { - t.Errorf("页头小标的 y 从 %.1f 跳到 %.1f", headBefore.Y, headAfter.Y) + t.Errorf("搜索词行的 y 从 %.1f 跳到 %.1f", headBefore.Y, headAfter.Y) + } + if beforeCenter, actionCenter := headBefore.Y+headBefore.H/2, actionBefore.Y+actionBefore.H/2; abs32(beforeCenter-actionCenter) > 12 { + t.Errorf("查看全部没有和搜索词同行:中心 y=%.1f / %.1f", beforeCenter, actionCenter) + } + if afterCenter, actionCenter := headAfter.Y+headAfter.H/2, actionAfter.Y+actionAfter.H/2; abs32(afterCenter-actionCenter) > 12 { + t.Errorf("结果回来后查看全部没有和搜索词同行:中心 y=%.1f / %.1f", afterCenter, actionCenter) } // 留 4px 余量:骨架里名字那一块固定高,真名字的行盒按字体度量算(差 2px 上下, - // 其它 rail 骨架也一样)。这里锁的是页头几何和那一排的高度都被占住了——改之前 - // Tab 一下挪约 50px。 + // 其它 rail 骨架也一样)。 if jump := tabAfter.Y - tabBefore.Y; jump > 4 || jump < -4 { t.Errorf("Tab 的 y 从 %.1f 跳到 %.1f", tabBefore.Y, tabAfter.Y) } diff --git a/internal/ui/widgets/pud/overlay.go b/internal/ui/widgets/pud/overlay.go index ae1f3184..3f05923c 100644 --- a/internal/ui/widgets/pud/overlay.go +++ b/internal/ui/widgets/pud/overlay.go @@ -19,8 +19,8 @@ import ( func PopPanel(c *ui.Context, key string) ui.Element { p := pal(c) e := ui.Column(c).Key(key).MinWidth(tok.PopMinW).Padding(space.Px8).Radius(tok.R12). - Background(p.Surface).Border(1, p.Line).Transition(motion.PopIn) - return shadow.Pop(e, c.Theme()) + Background(p.Surface).Border(1, p.Line.Alpha(0.7)).Transition(motion.PopIn) + return shadow.PopQuiet(e, c.Theme()) } // PopStyle 给一块**别处建好的面板**(框架 `PopoverBase` 递进回调的那一块)上 `.pop` 的外观:surface 底、 diff --git a/internal/ui/widgets/shadow/shadow.go b/internal/ui/widgets/shadow/shadow.go index 62f604a6..26a30131 100644 --- a/internal/ui/widgets/shadow/shadow.go +++ b/internal/ui/widgets/shadow/shadow.go @@ -105,6 +105,16 @@ func Pop(e ui.Element, t *ui.Theme) ui.Element { Shadow(0, 2, 8, 0, ui.RGBA(20, 22, 26, 0.08)) } +// PopQuiet 是轻量下拉菜单的影。它保留浮层层级,但不把小菜单画成一张大卡片。 +func PopQuiet(e ui.Element, t *ui.Theme) ui.Element { + if t.Dark { + return e.Shadow(0, 10, 28, 0, ui.RGBA(0, 0, 0, 0.4)). + Shadow(0, 2, 6, 0, ui.RGBA(0, 0, 0, 0.28)) + } + return e.Shadow(0, 10, 28, 0, ui.RGBA(20, 22, 26, 0.12)). + Shadow(0, 2, 6, 0, ui.RGBA(20, 22, 26, 0.06)) +} + // LargeCover 是「深夜唱片行」的 `--shadow-cover`(原型 index.html 89 / 112 行, // `.cover.lg`):「今日一张」那张大封面。 //