Peach: Local-first video metadata scraper and media manager.
fix(detail): align title actions and metadata icons
longmeidao7213edbcd95b
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 1b30fd726..523b163b6 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -1832,8 +1832,19 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains('data-review-open-item="${row.asset_id}"')self.assertPageContains("openItem(+button.dataset.reviewOpenItem)")- def test_jav_release_date_is_visible_in_detail(self):- self.assertPageContains("发行 ${esc(it.release_date)}")+ def test_detail_title_keeps_source_and_file_actions_inline(self):+ self.assertPageContains('<div class="detailtitle">${srcBadge(it.location,it.cost,\'srcbig\')}')+ self.assertPageContains('<div class="stitle">${esc(it.name)}</div>')+ self.assertPageContains('<div class="srctools detailtitletools">${sourceToolButtons(it.id)}</div>')+ self.assertPageContains(".detailtitle{display:grid;grid-template-columns:auto minmax(0,1fr) auto")++ def test_detail_metadata_uses_icons_instead_of_release_copy(self):+ self.assertPageContains('<span class="detailmetaitem">${icon(\'monitor\')}')+ self.assertPageContains('<span class="detailmetaitem">${icon(\'hard-drive\')}')+ self.assertPageContains('<span class="detailmetaitem">${icon(\'calendar\')}')+ self.assertPageContains('id="i-monitor"')+ self.assertPageContains('id="i-calendar"')+ self.assertPageLacks("发行 ${esc(it.release_date)}")def test_duplicates_page_is_a_management_section(self):self.assertPageContains("['dupes','重复文件','hard-drive']")@@ -2210,7 +2221,7 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains('data-reveal="${id}"')self.assertPageContains('data-sync="${id}"')# 在线资产是 URL,没有本地文件可定位。- self.assertPageContains("it.location==='online'?'':sourceTools(it.id)")+ self.assertPageContains("it.location==='online'?'':`<div class=\"srctools detailtitletools\">${sourceToolButtons(it.id)}</div>`")def test_resource_sync_is_embedded_in_stats_and_keeps_offline_sources_safe(self):self.assertPageContains("${resourceSyncMarkup()}")diff --git a/web/app.css b/web/app.cssindex c6acf0064..815bf071c 100644--- a/web/app.css+++ b/web/app.css@@ -1171,6 +1171,8 @@ body.index-open #tiers,body.index-open #tagbar{display:none}.sidecontent{box-sizing:border-box;width:100%;height:100%;max-height:76vh;padding:18px;display:flex;gap:0;flex-direction:column;overflow-y:auto;overflow-x:hidden}.stitle{font-size:var(--fs-lg);line-height:1.4;word-break:break-all;margin-bottom:8px}+.detailtitle{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:start;gap:8px;margin-bottom:10px}+.detailtitle>.srcbig{margin-top:2px}.detailtitle .stitle{min-width:0;margin:0}/* 源文件管理:定位 + 目录对账。图标必须显式写 stroke/fill,Lucide 是描边路径,缺了就被按默认 fill:black 画成黑块(详见 .photonav 那一段的同类修复)。 */.srctools{display:flex;align-items:center;gap:6px;margin:0 0 10px;flex-wrap:wrap}@@ -1181,9 +1183,13 @@ body.index-open #tiers,body.index-open #tagbar{display:none}.srctools button:hover{border-color:var(--tungsten);color:var(--ink)}.srctools button:disabled{opacity:.45;cursor:default}.srcstate{font-size:var(--fs-xs);color:var(--muted);min-width:0;flex:1 1 100%}+.detailtitletools{margin:0;flex-wrap:nowrap}.detailtitlestate{display:block;margin:-4px 0 10px}+.detailtitlestate:empty{display:none}.photohead .srctools{margin:0 0 0 auto}.photohead .srcstate{flex:none}.smeta{display:flex;gap:9px;flex-wrap:wrap;color:var(--muted);margin-bottom:18px}+.detailmetaitem{display:inline-flex;align-items:center;gap:5px}.detailmetaitem svg{width:15px;height:15px;+ flex:none;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.stags{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:7px;margin:0 0 18px}.detailtag{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:var(--tag-radius);background:color-mix(in srgb,var(--surface) 82%,var(--ground));overflow:hidden;min-height:30px}diff --git a/web/app.js b/web/app.jsindex 093f0658b..f50402823 100644--- a/web/app.js+++ b/web/app.js@@ -3814,12 +3814,13 @@ async function syncMissing(id,status,done){}catch(e){status.textContent=sourceHint(e.message)}}-/* 两个按钮 + 一行状态。状态用 aria-live,屏幕阅读器和肉眼看到的是同一句。 */-const sourceTools=id=>`<div class="srctools">+/* 两个动作在照片详情里和作品标题旁复用;状态位置由各自表面决定。 */+const sourceToolButtons=id=>`<button type="button" data-reveal="${id}" title="在文件管理器里打开源文件所在目录"aria-label="定位源文件">${icon('folder-open')}</button><button type="button" data-sync="${id}" title="核对该目录:磁盘上已删除的,移入 Peach 回收站"- aria-label="同步删除">${icon('refresh-cw')}</button>+ aria-label="同步删除">${icon('refresh-cw')}</button>`;+const sourceTools=id=>`<div class="srctools">${sourceToolButtons(id)}<span class="srcstate" aria-live="polite"></span></div>`;function wireSourceTools(root,done){@@ -4814,12 +4815,14 @@ async function openItem(id,push=true,queueContext=null,anchor=null){:`<video id="vid" class="video-js vjs-big-play-centered" controls playsinline preload="metadata"></video>`}</div>${queueContext?queueHtml(queueContext,it.id):''}<div class="side"><div class="sidecontent">- <div class="stitle">${esc(it.name)}</div>- ${it.location==='online'?'':sourceTools(it.id)}- <div class="smeta mono">${srcBadge(it.location,it.cost,'srcbig')}- <span style="align-self:center">${it.width||'?'}×${it.height||'?'}</span>- <span style="align-self:center">${fmtSize(it.size||0)}</span>- ${it.release_date?`<span style="align-self:center">发行 ${esc(it.release_date)}</span>`:''}</div>+ <div class="detailtitle">${srcBadge(it.location,it.cost,'srcbig')}+ <div class="stitle">${esc(it.name)}</div>+ ${it.location==='online'?'':`<div class="srctools detailtitletools">${sourceToolButtons(it.id)}</div>`}</div>+ ${it.location==='online'?'':`<span class="srcstate detailtitlestate" aria-live="polite"></span>`}+ <div class="smeta mono">+ <span class="detailmetaitem">${icon('monitor')}<span>${it.width||'?'}×${it.height||'?'}</span></span>+ <span class="detailmetaitem">${icon('hard-drive')}<span>${fmtSize(it.size||0)}</span></span>+ ${it.release_date?`<span class="detailmetaitem">${icon('calendar')}<span>${esc(it.release_date)}</span></span>`:''}</div><div class="detailidentity">${identityRows||`<div class="identityrow"><span></span><span class="ilabel">归属</span><span>${esc(who)}</span></div>`}</div><div class="stags" id="detailTags"></div><div class="trace"><div class="lab mono"><span>离开位置</span><span id="ratioTxt">0%</span></div>diff --git a/web/index.html b/web/index.htmlindex c1afce7d5..daff9c981 100644--- a/web/index.html+++ b/web/index.html@@ -29,6 +29,7 @@<symbol id="i-list-filter" viewBox="0 0 24 24"><path d="M2 5h20" /><path d="M6 12h12" /><path d="M9 19h6" /></symbol><symbol id="i-chart" viewBox="0 0 24 24"><path d="M5 21v-6" /><path d="M12 21V3" /><path d="M19 21V9" /></symbol><symbol id="i-settings" viewBox="0 0 24 24"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" /><circle cx="12" cy="12" r="3" /></symbol>+ <symbol id="i-monitor" viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2" /><path d="M8 21h8" /><path d="M12 17v4" /></symbol><symbol id="i-monitor-cog" viewBox="0 0 24 24"><path d="M12 17v4" /><path d="m14.305 7.53.923-.382" /><path d="m15.228 4.852-.923-.383" /><path d="m16.852 3.228-.383-.924" /><path d="m16.852 8.772-.383.923" /><path d="m19.148 3.228.383-.924" /><path d="m19.53 9.696-.382-.924" /><path d="m20.772 4.852.924-.383" /><path d="m20.772 7.148.924.383" /><path d="M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7" /><path d="M8 21h8" /><circle cx="18" cy="6" r="3" /></symbol><symbol id="i-gauge" viewBox="0 0 24 24"><path d="m12 14 4-4" /><path d="M3.34 19a10 10 0 1 1 17.32 0" /></symbol><symbol id="i-theater-enter" viewBox="0 0 24 24"><rect x="2" y="3" width="20" height="18" rx="1.5"/><path d="M2 16h20M8.5 7 5.5 10l3 3M15.5 7l3 3-3 3"/></symbol>@@ -69,6 +70,7 @@<symbol id="i-database" viewBox="0 0 24 24"><ellipse cx="12" cy="5" rx="9" ry="3" /><path d="M3 5V19A9 3 0 0 0 21 19V5" /><path d="M3 12A9 3 0 0 0 21 12" /></symbol><symbol id="i-play" viewBox="0 0 24 24"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" /></symbol><symbol id="i-clock" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /><path d="M12 6v6l4 2" /></symbol>+ <symbol id="i-calendar" viewBox="0 0 24 24"><path d="M8 2v3" /><path d="M16 2v3" /><rect x="3" y="3" width="18" height="18" rx="2" /><path d="M3 9h18" /></symbol><symbol id="i-external-link" viewBox="0 0 24 24"><path d="M15 3h6v6" /><path d="M10 14 21 3" /><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" /></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-sperm" viewBox="0 0 24 24"><path d="M18.2574 3.04039C16.6079 3.3153 15.3153 4.60785 15.0404 6.25731C14.9261 6.94343 15.1179 7.59015 15.5007 8.08229L15.1947 8.49031C14.8361 8.96852 14.2732 9.24995 13.6754 9.24995H12.8524C10.9372 9.24995 9.58486 11.1262 10.1905 12.9431L10.3037 13.2827C10.5666 14.0715 9.88821 14.8537 9.07014 14.705C7.36157 14.3943 5.83623 15.8176 6.02801 17.5435L6.05171 17.7569C6.12353 18.4033 5.68919 18.9973 5.05144 19.1248L4.35291 19.2645C3.94674 19.3458 3.68333 19.7409 3.76456 20.147C3.8458 20.5532 4.24092 20.8166 4.64709 20.7354L5.34562 20.5957C6.74631 20.3155 7.70028 19.0109 7.54253 17.5912L7.51883 17.3779C7.43795 16.65 8.08124 16.0497 8.80181 16.1808C10.7416 16.5334 12.3502 14.6787 11.7267 12.8083L11.6135 12.4688C11.3317 11.6232 11.9611 10.75 12.8524 10.75H13.6754C14.7453 10.75 15.7528 10.2462 16.3947 9.39031L16.7517 8.9143C17.0623 8.99708 17.3975 9.01704 17.7426 8.95951C19.3921 8.6846 20.6847 7.39205 20.9596 5.7426C21.2244 4.15334 19.8466 2.77552 18.2574 3.04039Z" fill="currentColor"/><path d="M11.0548 3.32416C10.1507 3.47484 9.41308 4.15197 9.17192 5.03625C9.06125 5.44203 9.13468 5.83765 9.32677 6.15771L8.8594 6.85877C8.69647 7.10316 8.42219 7.24995 8.12847 7.24995H7.75C6.64543 7.24995 5.75 8.14538 5.75 9.24995C5.75 9.52609 5.52614 9.74995 5.25 9.74995C4.14543 9.74995 3.25 10.6454 3.25 11.75V12C3.25 12.4142 3.58579 12.75 4 12.75C4.41421 12.75 4.75 12.4142 4.75 12V11.75C4.75 11.4738 4.97386 11.25 5.25 11.25C6.35457 11.25 7.25 10.3545 7.25 9.24995C7.25 8.97381 7.47386 8.74995 7.75 8.74995H8.12847C8.92372 8.74995 9.66635 8.35251 10.1075 7.69082L10.6492 6.87823C10.7526 6.87326 10.8578 6.85692 10.9637 6.82804C11.848 6.58687 12.5251 5.84929 12.6758 4.94518C12.8347 3.9918 12.0081 3.16526 11.0548 3.32416Z" fill="currentColor"/><path d="M18.1471 11.3088C17.2045 11.4659 16.4659 12.2045 16.3088 13.147C16.2724 13.3658 16.2904 13.5775 16.3514 13.7709L15.0321 15.31C14.7928 15.5892 14.4434 15.75 14.0756 15.75C13.1529 15.75 12.2912 16.2111 11.7793 16.9789L11.7373 17.0419C11.4196 17.5185 11.25 18.0785 11.25 18.6513V19C11.25 19.4142 11.5858 19.75 12 19.75C12.4142 19.75 12.75 19.4142 12.75 19V18.6513C12.75 18.3747 12.8319 18.1042 12.9854 17.874L13.0274 17.8109C13.261 17.4605 13.6544 17.25 14.0756 17.25C14.8813 17.25 15.6467 16.8979 16.171 16.2862L17.5255 14.706C17.6318 14.7141 17.7415 14.7097 17.8529 14.6911C18.7955 14.534 19.5341 13.7954 19.6912 12.8529C19.8425 11.9447 19.0552 11.1574 18.1471 11.3088Z" fill="currentColor"/></symbol>