Peach: Local-first video metadata scraper and media manager.
fix(web): 对齐自定义来源空列表卡片
longmeidao480c4548cd24
diff --git a/docs/REUSE.md b/docs/REUSE.mdindex 97f488329..9c78f403b 100644--- a/docs/REUSE.md+++ b/docs/REUSE.md@@ -88,7 +88,7 @@ JAV 作品详情与馆藏视频共用 `IdentityCell` 的头像、标识和首字卡片多选由 `MediaCard`、`FollowCard` 的 `selectMode` 统一控制:保留选择入口,单项保存、已看、忽略、稍后看、预览跳转和回收站操作不挂载;退出多选恢复单项操作。首页、实体页、关注与回收站沿用同一组组件。-配置页中的来源凭据复用 `Section`、`Stack` 与 `SettingsSectionLabel`;独立凭据页面保留自己的面板层级。自定义来源表单和卸载开关只使用一层正文间距,操作区复用 `Footer`。PikPak 直接显示账号表单,两种登录动作同排。在线、离线等连接状态复用 BoardUI `StatusDot`;权限、任务和凭据结果复用 `Chip`。作品资料站点标识经 `/site-mark` 读取本地缓存,资源搜索帮助直达 [详细配置说明](RESOURCE_SEARCH.md)。不新增运行时依赖,不修改凭据内容或 ledger。+配置页中的来源凭据复用 `Section`、`Stack` 与 `SettingsSectionLabel`;独立凭据页面保留自己的面板层级。自定义来源表单和卸载开关只使用一层正文间距,列表与表单操作区复用 `Footer`;空来源列表的添加入口放在 `Stack` 正文中。PikPak 直接显示账号表单,两种登录动作同排。在线、离线等连接状态复用 BoardUI `StatusDot`;权限、任务和凭据结果复用 `Chip`。作品资料站点标识经 `/site-mark` 读取本地缓存,资源搜索帮助直达 [详细配置说明](RESOURCE_SEARCH.md)。不新增运行时依赖,不修改凭据内容或 ledger。账号归属复用 `review_decision`、`creator_collection_base`、`write_owned_fields` 和全库归属审计。明确拒绝的资产与账号组合在自动摄取时跳过;用户写入保留复核入口。网黄博主只命中可信个人、内容创作者或发布账号断言,未分类账号保留全部名册入口。`attach_avatar_availability` 集中处理资料页、索引、搜索与统计的作品头像:发布账号缺少本人或出演职业证据时作品帧照常兜底,另标 `avatar_stand_in`,已安装图片独立保留。个人博主的补头像复用 `avatar_cover_face.face_square`、`readable_cut` 与 ADR-0074 的 `agreeing` 两部互证,画面取自接触印相九格(ADR-0099)。来源核查清单、逐关系回执和备份存于 `peach-data/review/`。diff --git a/frontend/e2e/source-credentials-layout.test.ts b/frontend/e2e/source-credentials-layout.test.tsindex e519d602e..c83474504 100644--- a/frontend/e2e/source-credentials-layout.test.ts+++ b/frontend/e2e/source-credentials-layout.test.ts@@ -24,9 +24,28 @@ describe('来源链接与凭据布局', () => {});try {await page.reload();+ const region = page.getByRole('region', { name: '自定义元数据来源', exact: true });+ const add = region.getByRole('button', { name: '添加来源', exact: true });+ const assertClosedCard = async () => {+ await add.waitFor(); await settle(page);+ const geometry = await add.evaluate(button => {+ const row = button.parentElement!;+ const card = button.closest('section')!.lastElementChild!;+ return { divider: parseFloat(getComputedStyle(row).borderTopWidth),+ radius: parseFloat(getComputedStyle(card).borderTopLeftRadius),+ top: button.getBoundingClientRect().top - card.getBoundingClientRect().top };+ });+ assert.equal(geometry.divider, 0, JSON.stringify(geometry));+ assert.ok(geometry.radius > 0 && geometry.top >= 12 && geometry.top <= 18, JSON.stringify(geometry));+ };+ await assertClosedCard();await page.getByRole('button', { name: '添加来源', exact: true }).click();const form = page.getByRole('form', { name: '元数据来源配置', exact: true });- const region = page.getByRole('region', { name: '自定义元数据来源', exact: true });+ await form.getByRole('button', { name: '取消', exact: true }).click();+ await form.waitFor({ state: 'detached' });+ await assertClosedCard();+ await region.screenshot({ path: `../build/agent-verification/browser/custom-source-closed-${viewport.name}.png` });+ await add.click();const editorGeometry = await region.evaluate(node => {const card = node.lastElementChild!.getBoundingClientRect();const input = node.querySelector('form label')!.getBoundingClientRect();@@ -52,6 +71,7 @@ describe('来源链接与凭据布局', () => {await form.waitFor({ state: 'detached' });await page.getByText('公开演示元数据 · 已停用', { exact: true }).waitFor();assert.equal(items.length, 1);+ assert.equal(await add.evaluate(button => parseFloat(getComputedStyle(button.parentElement!).borderTopWidth)), 1);assert.deepEqual(opened.problems, []);} finally { await opened.close(); }});diff --git a/frontend/src/react/scraping/custom-sources.tsx b/frontend/src/react/scraping/custom-sources.tsxindex 930ea9615..d79135239 100644--- a/frontend/src/react/scraping/custom-sources.tsx+++ b/frontend/src/react/scraping/custom-sources.tsx@@ -24,8 +24,10 @@ export function CustomSources({ receipt }: { receipt(message: string): void }) {const query = useQuery({ queryKey: KEY, queryFn: ({ signal }) => fetchCustomSources(signal) });const action = useAction();const changed = (result: { items: Source[] }) => queryClient.setQueryData(KEY, result);+ const hasContent = Boolean(query.isPending || query.error || query.data?.items.length || action.error);+ const add = <Button variant="secondary" onClick={() => setEditing(blank())}>添加来源</Button>;return <Section title="自定义元数据来源">- {query.isPending || query.error || query.data?.items.length || action.error ? <Stack>+ {hasContent ? <Stack>{query.isPending ? <div aria-busy="true" data-skeleton="" aria-label="读取自定义来源" /> : null}{query.error ? <ErrorText>{errorMessage(query.error)}</ErrorText> : null}{query.data?.items.map((source) => <div key={source.id} className="flex flex-wrap items-center gap-3">@@ -42,7 +44,7 @@ export function CustomSources({ receipt }: { receipt(message: string): void }) {</div>)}{action.error ? <ErrorText>{action.error}</ErrorText> : null}</Stack> : null}- {!editing ? <Footer><Button variant="secondary" onClick={() => setEditing(blank())}>添加来源</Button></Footer> : null}+ {!editing ? hasContent ? <Footer>{add}</Footer> : <Stack><div className="flex justify-end">{add}</div></Stack> : null}{editing ? <SourceForm key={editing.id || 'new'} initial={editing} cancel={() => setEditing(null)}saved={(result) => { changed(result); setEditing(null); receipt('已保存来源') }} /> : null}</Section>;diff --git a/web/dist/peach-app.js b/web/dist/peach-app.jsindex cdde430bd..643e31e3d 100644--- a/web/dist/peach-app.js+++ b/web/dist/peach-app.js@@ -67681,11 +67681,15 @@ function rNe({ receipt: e }) {let [t, n] = (0, S.useState)(null), r = pt({queryKey: sW,queryFn: ({ signal: e }) => cW(e)- }), i = hA(), a = (e) => W.setQueryData(sW, e);+ }), i = hA(), a = (e) => W.setQueryData(sW, e), o = !!(r.isPending || r.error || r.data?.items.length || i.error), s = /* @__PURE__ */ (0, C.jsx)(K, {+ variant: "secondary",+ onClick: () => n(nNe()),+ children: "添加来源"+ });return /* @__PURE__ */ (0, C.jsxs)(xA, {title: "自定义元数据来源",children: [- r.isPending || r.error || r.data?.items.length || i.error ? /* @__PURE__ */ (0, C.jsxs)(CA, { children: [+ o ? /* @__PURE__ */ (0, C.jsxs)(CA, { children: [r.isPending ? /* @__PURE__ */ (0, C.jsx)("div", {"aria-busy": "true","data-skeleton": "",@@ -67738,10 +67742,9 @@ function rNe({ receipt: e }) {}, t.id)),i.error ? /* @__PURE__ */ (0, C.jsx)(EA, { children: i.error }) : null] }) : null,- t ? null : /* @__PURE__ */ (0, C.jsx)(wA, { children: /* @__PURE__ */ (0, C.jsx)(K, {- variant: "secondary",- onClick: () => n(nNe()),- children: "添加来源"+ t ? null : o ? /* @__PURE__ */ (0, C.jsx)(wA, { children: s }) : /* @__PURE__ */ (0, C.jsx)(CA, { children: /* @__PURE__ */ (0, C.jsx)("div", {+ className: "flex justify-end",+ children: s}) }),t ? /* @__PURE__ */ (0, C.jsx)(iNe, {initial: t,