Skip to content

armgit / peach

Public Imported from GitHub
0

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

fix: restore sticky entity toolbar

longmeidao974582ee2be8
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 8a0140b26..58b28ebf4 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -1240,6 +1240,12 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("updateEntityCollection(kind,name,{...filters,sort},true)")
self.assertPageContains("key==='sort'&&filters[key]==='new'")
self.assertPageContains(".entitycollectionhead .sorts")
+ self.assertPageContains(".entitycollectionhead{position:sticky;top:var(--topH);z-index:60")
+ self.assertPageContains(
+ ".tagbar.is-stuck,.count.is-stuck,.entitycollectionhead.is-stuck"
+ )
+ self.assertPageContains("['#tagbar','#count','.entitycollectionhead']")
+ self.assertPageContains("scheduleStickySurfaces();")
# 照片瀑布流没有视频排序语义,切换后直接渲染照片,不复用作品头。
self.assertPageContains("if(media==='photos'){renderPhotoWall(kind,name,filters,entityPhotos);return}")
@@ -1347,7 +1353,10 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".count{position:sticky;top:calc(var(--topH) + var(--filterH))")
self.assertPageContains("border-bottom:1px solid transparent;background:transparent")
self.assertPageContains("background:transparent;border-bottom:1px solid transparent")
- self.assertPageContains(".tagbar.is-stuck,.count.is-stuck{background:color-mix(in srgb,#020408 84%,transparent)")
+ self.assertPageContains(
+ ".tagbar.is-stuck,.count.is-stuck,.entitycollectionhead.is-stuck"
+ "{background:color-mix(in srgb,#020408 84%,transparent)"
+ )
self.assertPageContains("background:color-mix(in srgb,#020408 84%,transparent)")
self.assertPageContains("backdrop-filter:saturate(1.35) blur(16px)")
self.assertPageContains("function updateStickySurfaces()")
diff --git a/web/app.css b/web/app.css
index fa555292c..4ef8a170d 100644
--- a/web/app.css
+++ b/web/app.css
@@ -368,7 +368,9 @@ button,a,input,textarea,select,summary{touch-action:manipulation}
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--fs-xs)}.relatedperson small{color:var(--muted);font-size:var(--fs-xs)}
.relatedperson:hover .ring{box-shadow:0 0 0 1px var(--border-15)}
.entitysection{min-width:0;max-width:100%}.entitysection h3{font-size:var(--fs-sm);letter-spacing:.08em;color:var(--muted);margin:0 0 12px}
-.entitycollectionhead{display:flex;align-items:center;gap:10px;margin:0 0 12px;min-width:0}
+.entitycollectionhead{position:sticky;top:var(--topH);z-index:60;display:flex;align-items:center;gap:10px;
+ min-height:var(--sortH);margin:0 -16px 12px;padding:8px 16px;min-width:0;
+ background:transparent;border-bottom:1px solid transparent}
.entitycollectionhead h3{margin:0;flex:0 0 auto}.entitycollectionhead .javlayout{display:inline-flex;gap:2px}
/* 关注页的视频 / 图片切换;实体页按 Beeg 把单一图片按钮放进标签行。 */
.mediatabs{display:flex;gap:8px;margin:0 0 18px;border-bottom:1px solid var(--line-soft)}
@@ -634,8 +636,8 @@ main{position:relative;z-index:1;padding:14px 16px 90px}
.count.count-actions-only:empty{display:none}
.resourcesync{scroll-margin-top:calc(var(--topH) + 18px);display:grid;gap:16px}.resourcesync>h2{margin:0;font-size:var(--fs-xl)}
.resourcesyncbox,.resourcepanel{overflow:clip;border:1px solid var(--line-soft);border-radius:12px;background:var(--surface)}.resourcesyncbody{padding:24px}.resourcesyncbody h3{margin:0 0 8px;font-size:var(--fs-lg)}.resourcesyncbody p{max-width:760px;margin:0;color:var(--muted);font-size:var(--fs-sm);line-height:1.55}.resourcesyncfooter,.resourceapplyrow{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 16px;border-top:1px solid var(--line-soft);background:var(--overlay-5)}.resourcesyncfooter p,.resourceapplyrow>p{margin:0;color:var(--muted);font-size:var(--fs-xs);line-height:1.5}.resourceaction{box-sizing:border-box;height:36px;padding:0 12px;border:1px solid var(--border-15);border-radius:var(--control-radius);background:var(--surface);color:var(--ink-2);display:inline-flex;align-items:center;justify-content:center;gap:8px;flex:none;font:inherit;font-size:var(--fs-sm);font-weight:550;cursor:pointer;transition:background-color .12s,border-color .12s,color .12s}.resourceaction:hover:not(:disabled){background:var(--hover);border-color:color-mix(in srgb,var(--ink) 28%,transparent);color:var(--ink)}.resourceaction:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}.resourceaction:disabled{cursor:default;opacity:.68}.resourceaction svg{width:16px;height:16px;stroke:currentColor;fill:none}#resourceSyncResult:empty{display:none}.resourcescanning,.resourceerror{margin:0;padding:14px 16px;border:1px solid var(--line-soft);border-radius:var(--control-radius);color:var(--muted)}.resourceerror{color:var(--drop)}.resourcesources{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}.resourcesources article{display:grid;gap:4px;min-width:0;padding:16px}.resourcesources article+article{border-left:1px solid var(--line-soft)}.resourcesourcetitle{display:flex;align-items:center;justify-content:space-between;gap:12px}.resourcesourcetitle span{font-size:var(--fs-xs)}.resourcesources .online{color:var(--success)}.resourcesources .offline{color:var(--drop)}.resourcesources strong{margin-top:10px;font-size:var(--fs-2xl);font-variant-numeric:tabular-nums}.resourcesources small,.resourcecache small{color:var(--muted)}.resourcecache{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border-top:1px solid var(--line-soft);background:var(--overlay-5)}.resourcecache>div{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:baseline;gap:4px 16px;padding:16px}.resourcecache>div+div{border-left:1px solid var(--line-soft)}.resourcecache b{font-size:var(--fs-2xl);font-variant-numeric:tabular-nums}.resourcecache span{font-weight:650}.resourcecache small{grid-column:1/-1}.resourceapplyrow .resourcesyncok{color:var(--success)}.resourcedanger{color:var(--drop)}.resourcedanger:hover:not(:disabled){border-color:color-mix(in srgb,var(--drop) 42%,transparent);background:color-mix(in srgb,var(--drop) 8%,transparent);color:var(--drop)}.resourcesyncok{margin:0;color:var(--success)}
-.tagbar,.count{transition:background-color .16s ease,border-color .16s ease}
-.tagbar.is-stuck,.count.is-stuck{background:color-mix(in srgb,#020408 84%,transparent);
+.tagbar,.count,.entitycollectionhead{transition:background-color .16s ease,border-color .16s ease}
+.tagbar.is-stuck,.count.is-stuck,.entitycollectionhead.is-stuck{background:color-mix(in srgb,#020408 84%,transparent);
border-bottom-color:var(--line-soft);backdrop-filter:saturate(1.35) blur(16px);
-webkit-backdrop-filter:saturate(1.35) blur(16px)}
.count:empty{display:none}
diff --git a/web/app.js b/web/app.js
index 0d79bb3de..1b55b11b9 100644
--- a/web/app.js
+++ b/web/app.js
@@ -3553,6 +3553,7 @@ function renderEntityCollection(kind,name,items,filters,append=false){
more._observer=new IntersectionObserver(entries=>{if(entries.some(x=>x.isIntersecting))requestMore()},{rootMargin:'320px'});
more._observer.observe(more);
}
+ scheduleStickySurfaces();
}
async function updateEntityCollection(kind,name,filters,push=true){
// 标签是作品筛选,点了就回到作品视图:留在照片里既不生效,标签条也会自相矛盾。
@@ -4339,7 +4340,7 @@ $('#edge').addEventListener('mouseenter',()=>{if(Date.now()<drawerSuppressUntil)
window.__scrolling=false; let scrollT=null;
let stickyFrame=0;
function updateStickySurfaces(){
- ['#tagbar','#count'].forEach(selector=>{
+ ['#tagbar','#count','.entitycollectionhead'].forEach(selector=>{
const el=$(selector),css=el&&getComputedStyle(el),top=css?parseFloat(css.top):NaN;
const stuck=!!el&&css.position==='sticky'&&el.offsetParent!==null&&window.scrollY>0&&
Number.isFinite(top)&&el.getBoundingClientRect().top<=top+1;