Peach: Local-first video metadata scraper and media manager.
feat(web): 关注管理页正名,骨架照它自己的两栏三块画
longmeidao90e3f53a642b
diff --git a/tests/test_follow_web.py b/tests/test_follow_web.pyindex bd65b0828..56846745f 100644--- a/tests/test_follow_web.py+++ b/tests/test_follow_web.py@@ -1407,11 +1407,11 @@ class FollowWebSourceTests(unittest.TestCase):# 不再是 navTo/navOn 各写一条 `k==='follow'` 分支。self.assertPageContains("{match:'/follow',nav:'follow',title:'关注',refresh:'skip',")self.assertPageContains("open:(params,push)=>openFollow(push),reload:()=>openFollow(false)},")- # 两个数组现在同名,字面量断言分不出是哪一个:- # 管理区这一项得在 MANAGE_SECTIONS 里找,否则它被删了测试照样绿。+ # 管理区这一项得在 MANAGE_SECTIONS 里找,否则它被删了测试照样绿。名字也不再+ # 跟左栏那条相同:左栏的「关注」是看更新,这里的「关注管理」是 /follow-manage。manage = self.page[self.page.index("const MANAGE_SECTIONS=["):]manage = manage[:manage.index("];")]- self.assertIn("['follow','关注','rss']", manage)+ self.assertIn("['follow','关注管理','rss']", manage)self.assertPageContains('<symbol id="i-rss"')# 管理区身份同理:`section` 写在路由表上,`openManage('follow')` 按它查表。self.assertPageContains("{match:'/follow-manage',section:'follow',title:'关注管理',refresh:'skip',")diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 45cfdafa0..2cfc7516e 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -1513,6 +1513,24 @@ class WebUiSourceTests(unittest.TestCase):"const MANAGE_MENU_SECTIONS=['stats','taste','cleanup','follow'];")self.assertPageContains("manageMenuSections().map(([k,label,ic])=>")+ def test_the_follow_management_section_is_named_after_the_page_it_opens(self):+ """管理区那一项叫「关注管理」:它开的是 /follow-manage,不是关注更新流。++ 叫「关注」时,管理菜单点进去是加来源、看凭据、移除来源那一屏,页标题也+ 写着「关注」——两个不同的页面在界面上共用一个名字。侧栏可选图标本来就+ 已经叫「关注管理」,身份注册表跟它对齐后不再各写一份文案。+ """+ sections = self.page.split("const MANAGE_SECTIONS=[", 1)[1].split("];", 1)[0]+ self.assertIn("['follow','关注管理','rss'],", sections)+ self.assertNotIn(+ "['follow','关注','rss'],", sections,+ "顶层 EDGE_ICONS 里的「关注」是更新流,管理区这一项不能跟它同名")+ self.assertPageContains("key==='follow'?['follow-manage',label,ic]")+ self.assertPageLacks("key==='follow'?['follow-manage','关注管理',ic]")+ # 页标题取的就是这份注册表;关注更新流的 h2 是它自己的,仍叫「关注」。+ self.assertPageContains("if(entry)el.textContent=pageLabel||entry[1]")+ self.assertPageContains('<div class="followhead"><h2 class="pagetitle">关注</h2></div>')+def test_data_management_is_the_single_entry_for_tidying_the_library(self):"""复核、回收站、高清版和链接管理、资源同步都归到数据管理这一页。@@ -2593,6 +2611,35 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains(".cleanup-skeleton>div{grid-template-columns:minmax(0,1fr);gap:16px}")self.assertPageContains(".cleanup-skeleton .skeletoncard em{width:100%;height:var(--fieldset-bar-h)")+ def test_follow_manage_skeleton_matches_its_two_column_sections(self):+ """关注管理的骨架是三个大区,不是六张 16:9 卡片。++ 六张卡的网格说的是 feed 那种一屏同质内容(关注更新流、回收站);关注管理+ 是「添加关注 + 关注列表 + 凭据」两栏三块,六张卡加载完整屏换掉,等于先给+ 了一个假的结构预告。块数因此要可配,并跟着 .followmanage 的断点塌成一列。+ """+ self.assertCode(+ "'/follow-manage':()=>`<div class=\"follow\">${pageSkeletonHtml('正在读取关注管理',")+ self.assertPageContains("{cards:true,count:3,className:'followmanage-skeleton'})}</div>`,")+ self.assertPageContains(+ "const pageSkeletonHtml=(label,{cards=false,className='',variant='',count}={})=>")+ self.assertPageContains("skeletonHtml(label,{variant:variant||(cards?'cards':'panel'),className,")+ self.assertPageContains(+ "export function skeletonHtml(label='正在读取内容',{className='',variant='panel',count=6}={})")+ self.assertPageContains("?Array.from({length:Math.max(1,count)},")+ # 版式:两栏对上 .followmanage 的 `minmax(0,1fr) 320px`,同一个断点塌成一列。+ self.assertPageContains(+ ".followmanage-skeleton>div{grid-template-columns:minmax(0,1fr) 320px;gap:16px;align-items:start}")+ self.assertPageContains(".followmanage-skeleton .skeletoncard:nth-child(3){grid-area:1/2}")+ self.assertPageContains(+ "@media (max-width:1080px){.followmanage-skeleton>div{grid-template-columns:minmax(0,1fr)}")+ self.assertPageContains(".followmanage-skeleton .skeletoncard:nth-child(n){grid-area:auto}")+ # 头部条是框体不是待填内容:跟 .fsechead 一样 56px,不参与呼吸。+ self.assertPageContains(".followmanage-skeleton .skeletoncard i{aspect-ratio:auto;height:56px")+ self.assertPageContains("border-bottom:1px solid var(--border-10);animation:none}")+ # 关注更新流仍是同质卡片流,它那张骨架不受影响。+ self.assertPageContains("pageSkeletonHtml(label,{cards:true,className:'follow-content-skeleton'})")+def test_loading_actions_are_inert_and_dimmed_without_losing_focus(self):"""用户触发的等待态统一走 Geist loading button,而不是各页自造半套状态。"""self.assertPageContains("control.setAttribute('aria-busy','true')")diff --git a/web/app.css b/web/app.cssindex 36cb309cd..02f3370cc 100644--- a/web/app.css+++ b/web/app.css@@ -569,6 +569,25 @@ body.photolight-open{overflow:hidden}.cleanup-skeleton .skeletoncard b{width:26%;height:16px;margin:12px 20px 20px}.cleanup-skeleton .skeletoncard em{width:100%;height:var(--fieldset-bar-h);margin:0;border-radius:0;border-top:1px solid var(--border-10);background:var(--overlay-5);animation:none}+/* 关注管理是「左栏两块 + 右栏凭据」的两栏行政界面:骨架照 .fsec 的轮廓画,+ 一块对一块、断点跟着 .followmanage 一起塌成一列。头部条是框体不是待填内容,+ 跟 .fsechead 同高同底色,不参与呼吸。 */+.followmanage-skeleton>div{grid-template-columns:minmax(0,1fr) 320px;gap:16px;align-items:start}+.followmanage-skeleton .skeletoncard{gap:0;overflow:hidden;border:1px solid var(--border-10);+ border-radius:var(--surface-radius);background:var(--surface)}+.followmanage-skeleton .skeletoncard i{aspect-ratio:auto;height:56px;border-radius:0;+ background:var(--overlay-5);border-bottom:1px solid var(--border-10);animation:none}+.followmanage-skeleton .skeletoncard b{width:auto;margin:16px 16px 0}+.followmanage-skeleton .skeletoncard em{width:42%;height:14px;margin:12px 16px 16px}+.followmanage-skeleton .skeletoncard:nth-child(1){grid-area:1/1}+.followmanage-skeleton .skeletoncard:nth-child(1) b{height:76px}+.followmanage-skeleton .skeletoncard:nth-child(2){grid-area:2/1}+.followmanage-skeleton .skeletoncard:nth-child(2) b{height:300px}+.followmanage-skeleton .skeletoncard:nth-child(3){grid-area:1/2}+.followmanage-skeleton .skeletoncard:nth-child(3) b{height:180px}+/* 塌成一列时要压掉上面那三条显式定位,特异性必须与它们持平,所以仍写 nth-child。 */+@media (max-width:1080px){.followmanage-skeleton>div{grid-template-columns:minmax(0,1fr)}+ .followmanage-skeleton .skeletoncard:nth-child(n){grid-area:auto}}.skeleton-dashboard>div{gap:16px}.skeletondashhero,.skeletondashpanel{display:grid;min-width:0;overflow:hidden;border:1px solid var(--line-soft);border-radius:var(--floating-radius);background:var(--surface)}diff --git a/web/app.js b/web/app.jsindex 0783f9856..98da8225a 100644--- a/web/app.js+++ b/web/app.js@@ -123,8 +123,9 @@ const ROUTES=[const registerRoute=spec=>{ROUTES.push(spec);return spec};window.peachRegisterRoute=registerRoute;-const pageSkeletonHtml=(label,{cards=false,className='',variant=''}={})=>- skeletonHtml(label,{variant:variant||(cards?'cards':'panel'),className});+const pageSkeletonHtml=(label,{cards=false,className='',variant='',count}={})=>+ skeletonHtml(label,{variant:variant||(cards?'cards':'panel'),className,+ ...(count?{count}:{})});const followSkeletonHtml=(label='正在读取关注内容')=>`<div class="follow"><div class="followhead"><h2 class="pagetitle">关注</h2></div>${pageSkeletonHtml(label,{cards:true,className:'follow-content-skeleton'})}</div>`;@@ -151,7 +152,10 @@ const MANAGEMENT_PLACEHOLDERS={'/review':()=>pageSkeletonHtml('正在读取复核队列',{cards:true}),'/quality-goals':()=>pageSkeletonHtml('正在读取高清版目标',{cards:true}),'/playlists':()=>pageSkeletonHtml('正在读取播放列表',{cards:true}),- '/follow-manage':()=>`<div class="follow">${pageSkeletonHtml('正在读取关注管理',{cards:true})}</div>`,+ // 关注管理是三个大区(添加关注、关注列表、凭据),不是一屏同质卡片:+ // 骨架照 .fsec 的轮廓画三块,六张 16:9 占位说的是另一个页面的结构。+ '/follow-manage':()=>`<div class="follow">${pageSkeletonHtml('正在读取关注管理',+ {cards:true,count:3,className:'followmanage-skeleton'})}</div>`,};const managementPlaceholder=path=>(MANAGEMENT_PLACEHOLDERS[path]||(()=>pageSkeletonHtml('正在读取页面')))();@@ -5228,7 +5232,9 @@ const MANAGE_SECTIONS=[['review','人工复核','square-check-big'],['cleanup','数据管理','hard-drive'],['trash','回收站','trash'],- ['follow','关注','rss'],+ // 这一项的页面是 /follow-manage(加来源、看凭据、移除来源),不是关注更新流+ // `/follow`。两处都叫「关注」时,管理菜单和页标题都在说一个它去不到的地方。+ ['follow','关注管理','rss'],['quality','高清版','sparkles'],];/* 管理菜单只留四项。人工复核、回收站、高清版都是「收拾库里已有的东西」,@@ -5237,7 +5243,7 @@ const MANAGE_SECTIONS=[const MANAGE_MENU_SECTIONS=['stats','taste','cleanup','follow'];const manageMenuSections=()=>MANAGE_SECTIONS.filter(([key])=>MANAGE_MENU_SECTIONS.includes(key));const OPTIONAL_EDGE_ICONS=MANAGE_SECTIONS.map(([key,label,ic])=>- key==='follow'?['follow-manage','关注管理',ic]+ key==='follow'?['follow-manage',label,ic]:key==='cleanup'?['data-cleanup',label,ic]:[key,label,ic]);const NAV_CATALOG=[...EDGE_ICONS,...OPTIONAL_EDGE_ICONS];const DIRECT_MANAGE_NAV={stats:'stats',review:'review','data-cleanup':'cleanup',trash:'trash','follow-manage':'follow',quality:'quality'};diff --git a/web/js/ui-components.js b/web/js/ui-components.jsindex 0bb504bbb..ecf1ac975 100644--- a/web/js/ui-components.js+++ b/web/js/ui-components.js@@ -93,10 +93,13 @@ export function loadingDotsHtml(label='正在处理', {className=''}={}){}/** Geist Skeleton: reserve a large content region while its structure is loading. */-export function skeletonHtml(label='正在读取内容',{className='',variant='panel'}={}){+/* `count` 只对 cards 生效:块数是骨架说出口的结构预告,六块对上的是海报网格,+ 而行政界面往往只有两三个大区。多画的块加载完就消失,那不是占位是误报。 */+export function skeletonHtml(label='正在读取内容',{className='',variant='panel',count=6}={}){const kind=new Set(['panel','cards','dashboard']).has(variant)?variant:'panel';const body=kind==='cards'- ?Array.from({length:6},()=>`<span class="skeletoncard"><i></i><b></b><em></em></span>`).join('')+ ?Array.from({length:Math.max(1,count)},+ ()=>`<span class="skeletoncard"><i></i><b></b><em></em></span>`).join(''):kind==='dashboard'?`<span class="skeletondashhero"><i></i><b></b></span><span class="skeletondashpanel"><i></i><b></b><em></em></span>