Peach: Local-first video metadata scraper and media manager.
fix(web): 教程浮窗贴回右下角,不再为 Toast 和批量选择条留白
longmeidao6d58d50a6d39
diff --git a/frontend/e2e/design.test.ts b/frontend/e2e/design.test.tsindex cd11dba4d..964da9da5 100644--- a/frontend/e2e/design.test.ts+++ b/frontend/e2e/design.test.ts@@ -920,7 +920,7 @@ describe('设计决定', () => {}});- it('390px 下教程浮窗不压住 Toast 和批量选择条', { timeout: 60_000 }, async () => {+ it('390px 下教程浮窗贴着右下角,Toast 和批量选择条盖在它上面', { timeout: 60_000 }, async () => {const opened = await visit(browser, '/', MOBILE);try {await opened.page.evaluate(() => {@@ -936,32 +936,40 @@ describe('设计决定', () => {opened.page.locator('#postSetupTutorial .post-setup-notification'),]);await settle(opened.page);- /* 回执和批量条平时不在 DOM 里,用它们各自的正式类名放一份进去再量。留白按- 一枚回执算,所以演示库自己弹出来的那几枚先清掉,量的才是这条判据。+ /* 回执和批量条平时不在 DOM 里,用它们各自的正式类名放一份进去,再在各自中心点+ 取最上层元素。演示库自己弹出来的回执先清掉,栈里只剩这一枚。清空、放入和量取必须在同一次同步执行里做完:演示库刚跑完扫描,「扫描与资料采集- 已完成」的回执随状态轮询随时会到,只要它落在放入与量取之间,栈顶就被推高一枚;- 重画网格的 paintSelection 也能在这个空当里把批量条收回去。 */- const tops = await opened.page.evaluate(() => {+ 已完成」的回执随状态轮询随时会到;重画网格的 paintSelection 也能在这个空当里+ 把批量条收回去。 */+ const probe = await opened.page.evaluate(() => {const toasts = document.getElementById('toasts')!;toasts.replaceChildren();const toast = document.createElement('div');toast.className = 'toast';toast.innerHTML = '<p>已保存配置</p>';toasts.append(toast);- document.getElementById('batchbar')!.hidden = false;- const top = (selector: string) => Math.min(...[...document.querySelectorAll(selector)]- .map((node) => node.getBoundingClientRect().top));- const card = document.querySelector('#postSetupTutorial .post-setup-notification')!- .getBoundingClientRect();- return { tutorial: card.top, bottom: card.bottom, left: card.left, right: card.right,- toast: top('#toasts .toast'), dock: top('#batchbar') };+ const dock = document.getElementById('batchbar')!;+ dock.hidden = false;+ const tutorial = document.querySelector('#postSetupTutorial .post-setup-notification')!;+ const card = tutorial.getBoundingClientRect();+ const hit = (node: Element) => {+ const box = node.getBoundingClientRect();+ const x = box.left + box.width / 2;+ const y = box.top + box.height / 2;+ const top = document.elementFromPoint(x, y);+ return { overlaps: x >= card.left && x <= card.right && y >= card.top && y <= card.bottom,+ tutorialOnTop: !!top && tutorial.contains(top) };+ };+ return { top: card.top, bottom: card.bottom, left: card.left, right: card.right,+ toast: hit(toast), dock: hit(dock) };});- for (const [name, top] of [['Toast', tops.toast], ['批量选择条', tops.dock]] as const) {- assert.ok(Number.isFinite(top), `${name}没有出现在页面上`);- assert.ok(tops.bottom <= top + 1,- `教程浮窗盖住了${name}:教程下沿 ${tops.bottom},${name} 上沿 ${top}`);+ assert.ok(Math.abs(probe.bottom - (MOBILE.height - 12)) <= 1,+ `教程浮窗没有贴着右下角:下沿 ${probe.bottom},应为 ${MOBILE.height - 12}`);+ for (const [name, spot] of [['Toast', probe.toast], ['批量选择条', probe.dock]] as const) {+ assert.ok(spot.overlaps, `${name}的中心没落在教程浮窗上,这条判据没有量到重叠`);+ assert.ok(!spot.tutorialOnTop, `教程浮窗盖住了${name}`);}- assert.ok(tops.tutorial >= 0 && tops.left >= 0 && tops.right <= MOBILE.width,+ assert.ok(probe.top >= 0 && probe.left >= 0 && probe.right <= MOBILE.width,'教程浮窗越出了 390px 视口');} finally {await opened.close();diff --git a/tests/test_source_assertion_ratchet.py b/tests/test_source_assertion_ratchet.pyindex b40cfb423..5980bb4a1 100644--- a/tests/test_source_assertion_ratchet.py+++ b/tests/test_source_assertion_ratchet.py@@ -53,7 +53,7 @@ BASELINE: dict[str, int] = {"test_web_e2e.py": 2,"test_web_js.py": 1,"test_web_settings.py": 8,- "test_web_ui.py": 4574,+ "test_web_ui.py": 4572,"test_windows_update.py": 3,}diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 53adb2b5f..d183ca794 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -191,11 +191,8 @@ class WebUiSourceTests(unittest.TestCase):self.assertIn(".post-setup-task>a:hover{background:var(--hover)}", board)self.assertIn("border-radius:8px;color:var(--ink);text-decoration:none}", board)self.assertNotIn(".post-setup-task:hover{", board)- # 右下角同时住着 Toast 栈和窄屏的批量选择条,教程按它们占的高度抬起来;- # 真实几何由 `frontend/e2e/design.test.ts` 在 390×844 下量。- self.assertIn("--post-setup-reserve:82px;position:fixed;right:12px;"- "bottom:calc(12px + var(--post-setup-reserve));z-index:100", board)- self.assertIn("@media(max-width:639px){#postSetupTutorial{--post-setup-reserve:150px}}", board)+ # 教程贴右下角、压在 Toast 与批量选择条之下,由 `frontend/e2e/design.test.ts`+ # 在 390×844 下量几何与层叠。self.assertIn("width:min(400px,calc(100vw - 24px))", board)self.assertIn("pointer-events:none", board)self.assertIn(".post-setup-notification{pointer-events:auto", board)diff --git a/web/board.css b/web/board.cssindex a60b6c417..e33df55de 100644--- a/web/board.css+++ b/web/board.css@@ -1591,11 +1591,10 @@ body .followmanage .board-pagination>.geist-button{height:32px;min-height:32px;p/* 安装后教程:BoardUI NotificationViewport 把教程固定在右下角,内部任务沿用 RareUITask List 的真实状态、完成项后移与打勾,不占当前页面正文的布局空间。- 右下角不是它一个人的:Toast 栈从 22px 起往上叠,窄屏还有居中的批量选择条。教程会- 一直挂到清单做完,压上去就是把回执和批量操作盖死,所以按它们占的高度抬起来,- 最大高度同步扣掉这段留白。 */-#postSetupTutorial{--post-setup-reserve:82px;position:fixed;right:12px;bottom:calc(12px + var(--post-setup-reserve));z-index:100;display:block;width:min(400px,calc(100vw - 24px));max-height:calc(100dvh - 24px - var(--post-setup-reserve));pointer-events:none}-@media(max-width:639px){#postSetupTutorial{--post-setup-reserve:150px}}+ 右下角还住着 Toast 栈和窄屏居中的批量选择条。教程贴着角落放,不为它们留白:层级+ 100 压在批量条(180)与 Toast(`--layer-popover`)之下,重叠时它们盖在教程上面。+ Toast 几秒就消失,批量条只在选中时出现,为它们常年空出一截反倒让教程悬在半空。 */+#postSetupTutorial{position:fixed;right:12px;bottom:12px;z-index:100;display:block;width:min(400px,calc(100vw - 24px));max-height:calc(100dvh - 24px);pointer-events:none}#postSetupTutorial[hidden]{display:none}.post-setup-notification{pointer-events:auto;display:flex;flex-direction:column;max-height:inherit;overflow:hidden;border:1px solid var(--color-border-button-default);border-radius:16px;background:var(--color-background-primary-default);box-shadow:0 1px 1px light-dark(#0000000d,#00000099),0 4px 4px light-dark(#0000001a,#00000073);animation:post-setup-notification-in .15s ease-out}.post-setup-notification-head{display:grid;grid-template-columns:40px minmax(0,1fr) 32px;align-items:center;gap:12px;padding:16px}@@ -1632,7 +1631,7 @@ body .followmanage .board-pagination>.geist-button{height:32px;min-height:32px;p.post-setup-error{display:grid;grid-template-columns:20px minmax(0,1fr);gap:8px;padding:16px}.post-setup-error-actions{display:flex;gap:8px;margin-top:12px}@keyframes post-setup-notification-in{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}-@media(min-width:640px){#postSetupTutorial{right:24px;bottom:calc(24px + var(--post-setup-reserve));max-height:calc(100dvh - 48px - var(--post-setup-reserve))}}+@media(min-width:640px){#postSetupTutorial{right:24px;bottom:24px;max-height:calc(100dvh - 48px)}}@media(max-width:720px){.post-setup-task>a{min-height:58px;padding-left:10px}}@media(prefers-reduced-motion:reduce){.post-setup-notification{animation:none}.post-setup-task,.post-setup-task>a{transition:none}}/* ── Board 第三批:主按钮尺寸、配置页白底、通知与提醒、批量条、关注行图标、侧栏切换器 ── */