Skip to content

armgit / peach

Public Imported from GitHub
0

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

fix(web): 配置骨架复用正文与分组间距

longmeidao937a86e8086e
diff --git a/frontend/test/feedback.test.ts b/frontend/test/feedback.test.ts
index d41bc5cc2..b7963181e 100644
--- a/frontend/test/feedback.test.ts
+++ b/frontend/test/feedback.test.ts
@@ -2,7 +2,7 @@ import {describe,expect,it} from 'vitest';
// @ts-expect-error 使用浏览器正式模块验证共享契约。
import {requestErrorMessage} from '../../web/js/core.js';
// @ts-expect-error 使用浏览器正式控件验证输出。
-import {noteHtml,projectBannerHtml,gaugeHtml,progressHtml} from '../../web/js/ui-components.js';
+import {noteHtml,projectBannerHtml,gaugeHtml,progressHtml,configurationSkeletonHtml} from '../../web/js/ui-components.js';
describe('中文错误反馈',()=>{
it.each(['Failed to fetch','NetworkError when attempting to fetch resource.','Load failed'])('网络异常 %s 给出连接检查方法',message=>{
@@ -16,6 +16,17 @@ describe('中文错误反馈',()=>{
});
});
describe('持久提示控件',()=>{
+ it('配置骨架标题和卡片共用真实页面网格与正文底栏',()=>{
+ const host=document.createElement('div');host.innerHTML=configurationSkeletonHtml();
+ const page=host.querySelector('.configpage')!;
+ expect(page.querySelectorAll(':scope > .configgroup')).toHaveLength(4);
+ expect(page.querySelectorAll(':scope > .configfieldset')).toHaveLength(8);
+ for(const card of page.querySelectorAll('.configfieldset')){
+ expect(card.querySelector(':scope > .geist-fieldset-content')).not.toBeNull();
+ expect(card.querySelector(':scope > .geist-fieldset-footer')).not.toBeNull();
+ }
+ expect(host.children).toHaveLength(1);
+ });
it.each([[79,'normal'],[80,'warning'],[94,'warning'],[95,'error']])('容量 %s 使用一致阈值', (value,level)=>{
const host=document.createElement('div');host.innerHTML=gaugeHtml('空间使用率',value,100,{usage:true});
expect(host.querySelector('.geist-gauge')?.getAttribute('data-level')).toBe(level);
diff --git a/web/css/09-skeleton.css b/web/css/09-skeleton.css
index 089851e1a..c928e7b26 100644
--- a/web/css/09-skeleton.css
+++ b/web/css/09-skeleton.css
@@ -164,5 +164,7 @@ body.refreshing #tiers .av .nm{width:52px;margin:0 auto;border-radius:var(--cont
body.refreshing #tiers .brandpill{border-color:transparent}
.stats-lede-skeleton{display:block;width:min(380px,75%);height:22px;margin-bottom:16px}
-.config-skeleton-card{border:1px solid var(--line);border-radius:var(--surface-radius);margin-bottom:16px;overflow:hidden}
-.config-skeleton-card>div{padding:24px;display:grid;gap:16px}.config-skeleton-card .skeleton{display:block;height:20px;width:60%}.config-skeleton-card .skeleton:first-child{height:24px;width:35%}.config-skeleton-card .skeleton:last-child{height:38px;width:100%}.config-skeleton-card footer{border-top:1px solid var(--line);padding:12px 24px;display:flex;justify-content:flex-end}.config-skeleton-card footer .skeleton:last-child{width:100px;height:38px}
+.config-skeleton-card .skeleton{display:block;height:20px;width:60%}
+.config-skeleton-card .geist-fieldset-content>.skeleton:first-child{height:24px;width:35%}
+.config-skeleton-card .geist-fieldset-content>.skeleton:last-child{height:var(--control-h);width:100%}
+.config-skeleton-card .geist-fieldset-footer>.skeleton{width:100px;height:var(--control-h)}
diff --git a/web/js/ui-components.js b/web/js/ui-components.js
index e10696e5a..579d4e9aa 100644
--- a/web/js/ui-components.js
+++ b/web/js/ui-components.js
@@ -29,7 +29,7 @@ export function gaugeHtml(label,value,max=100,{usage=false,compact=false}={}){
export function configurationSkeletonHtml(){
const groups=[['通用',1],['媒体',2],['网络与访问',2],['更新与维护',3]];
- return `<div class="configpage" data-skeleton="configuration" role="status" aria-label="正在读取配置"><span class="sr-only">正在读取配置</span><div aria-hidden="true">${groups.map(([label,count])=>`<h2 class="configgroup">${label}</h2>${Array.from({length:count},()=>`<div class="config-skeleton-card"><div><span class="skeleton"></span><span class="skeleton"></span><span class="skeleton"></span></div><footer><span class="skeleton"></span></footer></div>`).join('')}`).join('')}</div></div>`;
+ return `<div class="configpage" data-skeleton="configuration" role="status" aria-label="正在读取配置">${groups.map(([label,count])=>`<h2 class="configgroup" aria-hidden="true">${label}</h2>${Array.from({length:count},()=>`<div class="configfieldset config-skeleton-card" aria-hidden="true"><div class="geist-fieldset-content"><span class="skeleton"></span><span class="skeleton"></span><span class="skeleton"></span></div><footer class="geist-fieldset-footer"><span class="skeleton"></span></footer></div>`).join('')}`).join('')}</div>`;
}
/**