Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(ui): 视频网格去外框,Instagram 用品牌圆盘,媒体库菜单不压侧栏

longmeidaofd6098a6ec71
diff --git a/docs/BOARD_UI.md b/docs/BOARD_UI.md
index 45d98cd61..508a4eda8 100644
--- a/docs/BOARD_UI.md
+++ b/docs/BOARD_UI.md
@@ -187,6 +187,9 @@ Radial Chart Card、Bar List Card、Heatmap 与 Sankey 的 Pro 源码**未取得
| 通知状态圆 | Notification 用 lucide 图标 | 警告态换 `circle-alert`(自绘 `i-alert` 在 20px 下只剩一个点);Note 与上下留 12px |
| 复核页悬浮 | 无对应 | 标签条留在原地,工具条自己悬浮;分组条贴在它下面时两条合成一个玻璃框(上 20 0 0 / 下 0 0 20 20) |
| 批量条 | 无对应 | Board 的 `inline-flex` 曾压过 `[hidden]`,从垃圾页回首页会多出三个键;「移入回收站」用 error 按钮同一条红色渐变,首页与垃圾页文案统一 |
+| 媒体库菜单 | 侧向弹出的菜单贴在侧栏右缘外 8px | 收起时触发钮只有 32px,菜单从侧栏右缘起算,不再压到侧栏上 |
+| 视频网格 | bar-list-card 之外无对应 | 去掉网格外面那一圈框,卡片直接摆在页面上 |
+| 社媒标记 | 无对应 | Instagram 与 X 同一只墨色圆盘,字形取 Phosphor instagram-logo |
| 侧栏切换器 | 32px 圆头像 + 名字 + 双向箭头,`gap-2`,悬停在按钮外 6/5px 处描 2px 圆环;收起键只有 20px 高的图标、无底 | 数据库标识放进 32px `tertiary` 圆盘,悬停与展开态同一圈线;收起键展开时 20×20 靠右,收起时 36×20 在标识上方,相隔 10px,头部 62px 与上游同高 |
## 验证记录
diff --git a/scripts/vendor_web_dependencies.mjs b/scripts/vendor_web_dependencies.mjs
index 223c863f5..dddb3ae5c 100644
--- a/scripts/vendor_web_dependencies.mjs
+++ b/scripts/vendor_web_dependencies.mjs
@@ -133,6 +133,7 @@ const lucideIcons = new Map([
const handDrawnIcons = new Set([
"shuffle", // 两条带 pathLength 的动画路径由 Peach 维护。
"alert", "pics", "jav", "theater-enter", "theater-exit", "brand-x",
+ "brand-instagram", // 字形来自 Phosphor regular instagram-logo(MIT),套进与 brand-x 同一只墨色圆盘。
// 「换一批」:Lucide shuffle 的线条拆成 strand-a/strand-b 两条 path 供忙态逐条画出,
// 上游一刷新就会把两条并回五条,所以由手工维护。
"shuffle",
diff --git a/tests/test_web_js.py b/tests/test_web_js.py
index e32c88f20..2268029f8 100644
--- a/tests/test_web_js.py
+++ b/tests/test_web_js.py
@@ -283,6 +283,8 @@ class WebJsBehaviourTests(unittest.TestCase):
("core.js", "brandIcon", ["https://x.com/remu"], "brand-x"),
("core.js", "brandIcon", ["https://www.twitter.com/remu"], "brand-x"),
("core.js", "brandIcon", ["https://mobile.x.com/remu"], "brand-x"),
+ # Instagram 的 favicon 同样取不到,给它自己的标记。
+ ("core.js", "brandIcon", ["https://www.instagram.com/arina_hashimoto1215"], "brand-instagram"),
# 只认后缀边界:`notx.com` 不是 `x.com` 的子域。
("core.js", "brandIcon", ["https://notx.com/remu"], ""),
("core.js", "brandIcon", ["https://example.com/a"], ""),
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 477816696..bf5184277 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -681,24 +681,18 @@ class WebUiSourceTests(unittest.TestCase):
# 没有 JS 会挂 .act,留着只会让人以为选中态有两套写法。
self.assertPageLacks(".pill.act{")
- def test_the_video_area_is_one_frame_and_the_portrait_strip_shares_its_face(self):
- """框画在网格上,卡片本身不带框;竖屏带和框、和卡片同一张面。
+ def test_the_video_area_has_no_frame_and_the_portrait_strip_shares_the_card_face(self):
+ """视频网格不画框:卡片直接摆在页面上,竖屏带和卡片同一张面。
- 一张卡一个框会在一屏里画出几十条互相平行的细线,读起来是表格不是图墙。
- 垃圾复核用的是同一个 `#grid`,但它那张卡自己就是一块 `--ground` 的面,
- 外面再套一层同色的框只会把卡吃掉——所以这条按内容认,不按页面认。
+ 网格外面那一圈 `--field-ring` 框只是把一屏卡片再圈一次,用户点名去掉;
+ 卡片本身也不带框。
"""
- self.assertPageContains(".grid:has(>.card:not(.junkcard)),.grid:has(>.catalog-skeleton){")
+ self.assertPageLacks(".grid:has(>.card:not(.junkcard))")
css = stylesheet_source()
- start = css.index(".grid:has(>.card:not(.junkcard))")
- frame = css[start:css.index("}", start)]
- for piece in ("background:var(--ground)", "border:1px solid var(--field-ring)",
- "border-radius:var(--floating-radius)"):
- self.assertIn(piece, frame, "视频区是一整块面")
start = css.index(chr(10) + ".card{")
card = css[start:css.index("}", start)]
- self.assertNotIn("background:", card, "卡片不自带填色,框由网格出")
- self.assertNotIn("border:", card, "卡片不自带描边,框由网格出")
+ self.assertNotIn("background:", card, "卡片不自带填色")
+ self.assertNotIn("border:", card, "卡片不自带描边")
start = css.index(chr(10) + ".shorts-inline{")
strip = css[start:css.index("}", start)]
self.assertIn("background:var(--ground)", strip, "竖屏带和视频段同一张面")
@@ -1928,6 +1922,11 @@ class WebUiSourceTests(unittest.TestCase):
'mask="url(#brand-x-knockout)"/>')
self.assertPageContains(
'transform="translate(12 12) scale(.5) translate(-12 -12)"')
+ # Instagram 同一只圆盘:Phosphor 的 256 视口字形按 24×.5/256 缩进去。
+ self.assertPageContains('<symbol id="i-brand-instagram" viewBox="0 0 24 24">')
+ self.assertPageContains(
+ 'transform="translate(12 12) scale(.046875) translate(-128 -128)"')
+ self.assertPageContains("[['instagram.com'],'brand-instagram']")
self.assertPageLacks('fill="#000" stroke="none"', "品牌标记不写死板子的颜色")
self.assertPageContains(
'.entitylinkicon.brand svg{width:100%;height:100%;stroke:none;filter:none}')
diff --git a/web/css/12-cards.css b/web/css/12-cards.css
index 1a717074c..c2d092014 100644
--- a/web/css/12-cards.css
+++ b/web/css/12-cards.css
@@ -94,12 +94,6 @@ body.refreshing #batchAction svg,
剪开,上下两半于是各自成为一张独立的卡。`#grid` 本身只是这叠卡的容器,不再是网格。 */
.gridstack{display:flex;flex-direction:column;gap:16px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--tile),1fr));gap:16px 8px}
-/* 视频区是一整块面,框画在网格上,卡片本身不填色也不描边——一张卡一个框会在一屏里
- 画出几十条互相平行的细线,读起来是表格不是图墙。垃圾复核用的是同一个 #grid,
- 但它那张卡自己就是一块 --ground 的面,外面再套一层同色的框只会把卡吃掉,
- 所以按内容认,不按页面认。 */
-.grid:has(>.card:not(.junkcard)),.grid:has(>.catalog-skeleton){
- padding:16px;border:1px solid var(--field-ring);border-radius:var(--floating-radius);background:var(--ground)}
.card{cursor:pointer;display:flex;flex-direction:column;gap:8px;min-width:0;
position:relative;transition:transform .18s ease,filter .18s ease;transform-origin:center}
/* 叠层往上溢出到行间距里,卡片本体不为它留白。留白的写法(padding-top:7px)会把
diff --git a/web/index.html b/web/index.html
index a93fe3cd9..06866c3ac 100644
--- a/web/index.html
+++ b/web/index.html
@@ -170,6 +170,7 @@
`test_every_sprite_symbol_has_a_declared_owner` 按它清点每一枚的归属,
借来命名一个内部遮罩会被当成一枚没人认领的图标。 -->
<symbol id="i-brand-x" viewBox="0 0 24 24"><mask id="brand-x-knockout"><rect width="24" height="24" fill="#fff"/><path fill="#000" transform="translate(12 12) scale(.5) translate(-12 -12)" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></mask><circle cx="12" cy="12" r="12" fill="currentColor" stroke="none" mask="url(#brand-x-knockout)"/></symbol>
+ <symbol id="i-brand-instagram" viewBox="0 0 24 24"><mask id="brand-instagram-knockout"><rect width="24" height="24" fill="#fff"/><path fill="#000" transform="translate(12 12) scale(.046875) translate(-128 -128)" d="M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160ZM176,24H80A56.06,56.06,0,0,0,24,80v96a56.06,56.06,0,0,0,56,56h96a56.06,56.06,0,0,0,56-56V80A56.06,56.06,0,0,0,176,24Zm40,152a40,40,0,0,1-40,40H80a40,40,0,0,1-40-40V80A40,40,0,0,1,80,40h96a40,40,0,0,1,40,40ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z"/></mask><circle cx="12" cy="12" r="12" fill="currentColor" stroke="none" mask="url(#brand-instagram-knockout)"/></symbol>
<symbol id="i-bookmark-plus" viewBox="0 0 24 24"><path d="M12 7v6" /><path d="M15 10H9" /><path d="M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z" /></symbol>
<symbol id="i-bookmark" viewBox="0 0 24 24"><path d="M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z" /></symbol>
<symbol id="i-gallery-vertical-end" viewBox="0 0 24 24"><path d="M7 2h10" /><path d="M5 6h14" /><rect width="18" height="12" x="3" y="10" rx="2" /></symbol>
diff --git a/web/js/core.js b/web/js/core.js
index 0350ad89f..6191de2b4 100644
--- a/web/js/core.js
+++ b/web/js/core.js
@@ -95,8 +95,9 @@ const linkMarkUrl=link=>`/link-mark?id=${encodeURIComponent(link.link_id ?? '')}
favicon 是别人服务器上的一张小位图:X 直接挡掉爬取(资料页那个空白白圆就是它),
取到的也多是 16×16,放进 32 px 的圆里必然糊。内联 SVG 没有这两个问题,还省一次
跨站请求。只覆盖真正占量的主机——416 条社媒链接里 372 条是 x.com/twitter.com;
+ Instagram 的 favicon 同样被挡,资料页上只剩一只地球,所以也给它一枚;
其余继续走 favicon,不为个位数的链接各配一个图标。 */
-const BRAND_ICONS=[[['x.com','twitter.com'],'brand-x']];
+const BRAND_ICONS=[[['x.com','twitter.com'],'brand-x'],[['instagram.com'],'brand-instagram']];
const brandIcon=url=>{try{
const host=new URL(url).hostname.replace(/^www\./,'').toLowerCase();
return BRAND_ICONS.find(([hosts])=>hosts.some(d=>host===d||host.endsWith('.'+d)))?.[1]||'';
diff --git a/web/js/ui-components.js b/web/js/ui-components.js
index 3741e07d3..182630ccf 100644
--- a/web/js/ui-components.js
+++ b/web/js/ui-components.js
@@ -575,7 +575,9 @@ export function wireAnchoredMenu(mount,toggle,menu,{side=false}={}){
if(side&&innerWidth>=640){
menu.dataset.placement='right';
menu.style.maxHeight=Math.max(0,innerHeight-32)+'px';
- menu.style.left=Math.max(16,Math.min(anchor.right+8,innerWidth-width-16))+'px';
+ // 从挂载容器和触发钮两者更靠右的那条边起算:收起的侧栏里触发钮只有 32px 宽,按钮右缘加 8 还落在侧栏里面。
+ const edge=Math.max(anchor.right,mount.getBoundingClientRect().right);
+ menu.style.left=Math.max(16,Math.min(edge+8,innerWidth-width-16))+'px';
menu.style.top=Math.max(16,Math.min(anchor.top,innerHeight-menu.offsetHeight-16))+'px';return;
}
const top=viewportTop(),under=innerHeight-8-anchor.bottom-8,over=anchor.top-8-top;