Skip to content

armgit / peach

Public Imported from GitHub
0

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

fix(web): 管理与设置页在极端内容下不撑出视口、读数可读

longmeidao8cf08f90f86c
diff --git a/frontend/e2e/management-layout.test.ts b/frontend/e2e/management-layout.test.ts
index 3ec4f0cb6..aaae41174 100644
--- a/frontend/e2e/management-layout.test.ts
+++ b/frontend/e2e/management-layout.test.ts
@@ -221,3 +221,54 @@ describe('管理页面容器与骨架', () => {
});
}
});
+
+describe('管理页在极端内容下不撑出视口', () => {
+ const narrow = { name: 'narrow', width: 320, height: 720, mobile: true };
+ const LONG_PATH = `R:/media/${'很长的没有空格的目录名'.repeat(12)}/FC2-PPV-4728193.mp4`;
+ let browser: Browser;
+ before(async () => { browser = await launch(); });
+ after(async () => { await browser?.close(); });
+
+ it('复核页骨架在窄屏上不越过视口,数据到了以后侧栏仍收着', { timeout: 60_000 }, async () => {
+ const opened = await visit(browser, '/review', narrow);
+ let release = () => {};
+ try {
+ const page = opened.page;
+ const pending = new Promise<void>(resolve => { release = resolve; });
+ await page.route('**/api/review**', async route => { await pending; await route.continue(); });
+ await page.evaluate(() => sessionStorage.removeItem('board.sidebar'));
+ await page.reload({ waitUntil: 'load' });
+ await page.locator('[data-skeleton="review"]').waitFor();
+ const skeleton = await page.evaluate(() => ({
+ workspace: document.querySelector('[data-skeleton="review"]')!.getBoundingClientRect().width,
+ page: document.documentElement.scrollWidth,
+ }));
+ assert.ok(skeleton.workspace <= narrow.width, `骨架宽 ${skeleton.workspace}`);
+ assert.ok(skeleton.page <= narrow.width, `页面宽 ${skeleton.page}`);
+ release();
+ await page.locator('[data-skeleton="review"]').waitFor({ state: 'detached' });
+ await settle(page);
+ assert.equal(await page.evaluate(() => document.body.classList.contains('drawer-open')), false);
+ } finally { release(); await opened.close(); }
+ });
+
+ it('高清版的判定原因是一长串路径时在卡内折行,不把页面撑宽', { timeout: 60_000 }, async () => {
+ const opened = await visit(browser, '/quality-goals', narrow);
+ try {
+ const page = opened.page;
+ await page.route('**/api/quality-goals**', route => route.fulfill({ json: {
+ total: 1234567, offset: 0, has_more: true, items: [{
+ id: 1, name: 'FC2-PPV-4728193.mp4', code: 'FC2-PPV-4728193', location: 'local', size: 1e9, duration: 3600,
+ reason: LONG_PATH, cost: '', has_thumb: false, has_cover: false }] } }));
+ await page.reload({ waitUntil: 'load' });
+ const card = page.locator('#stats li[data-goal-id]').first();
+ await card.waitFor();
+ await settle(page);
+ const right = (await box(card)).x + (await box(card)).width;
+ assert.ok(right <= narrow.width, `卡片右缘 ${right}`);
+ assert.ok(await page.evaluate(() => document.documentElement.scrollWidth) <= narrow.width);
+ assert.equal(await page.locator('#stats [data-collection-summary] strong').textContent(), '1,234,567 部作品');
+ assert.match(await page.locator('#stats').textContent() ?? '', /显示前 1 部,共 1,234,567 部。/);
+ } finally { await opened.close(); }
+ });
+});
diff --git a/frontend/src/manage-header.ts b/frontend/src/manage-header.ts
index 7262444e7..6eb6d175f 100644
--- a/frontend/src/manage-header.ts
+++ b/frontend/src/manage-header.ts
@@ -45,8 +45,17 @@ export const MANAGE_CRUMB_PAGES: Readonly<Record<string, string>> = {
其余管理页跟全站页面标题走 24px。 */
const COMPACT_TITLE_PATHS = new Set(['/data-cleanup', '/scraping']);
+/** 管理条上按下哪一项。数据管理那几张卡通往的子页从数据管理进,按下的是「数据管理」;
+ * 别的页按自己的管理区,管理条上没有这一项时就没有按下项。 */
+export function pressedManageKey(props: Pick<ManageHeaderProps, 'section' | 'path' | 'menu'>): string {
+ const key = MANAGE_CRUMB_PAGES[props.path] ? 'cleanup' : props.section;
+ return props.menu.some(([entry]) => entry === key) ? key : '';
+}
+
export interface ManageHeaderView {
title: string;
+ /** 管理条上按下的那一项;空串时没有按下项。 */
+ pressed: string;
/** 面包屑当前那一项的名字;空串时不画面包屑。 */
crumb: string;
compact: boolean;
@@ -54,7 +63,8 @@ export interface ManageHeaderView {
lede: { kind: 'none' } | { kind: 'skeleton' } | { kind: 'count'; text: string; total: number };
}
-export const trashLedeText = ({ total, shown }: TrashCount) => `${total.toLocaleString()} 个符合 · 显示 ${shown}`;
+export const trashLedeText = ({ total, shown }: TrashCount) =>
+ `${total.toLocaleString()} 个符合 · 显示 ${shown.toLocaleString()}`;
/** 页头这一刻画什么;不在管理区时是 null。 */
export function manageHeaderView(props: ManageHeaderProps): ManageHeaderView | null {
@@ -63,6 +73,7 @@ export function manageHeaderView(props: ManageHeaderProps): ManageHeaderView | n
const crumb = MANAGE_CRUMB_PAGES[props.path] ?? '';
return {
title: props.path === '/diagnostics' ? '系统诊断' : (props.section === 'cleanup' && crumb) || entry[1],
+ pressed: pressedManageKey(props),
crumb,
compact: COMPACT_TITLE_PATHS.has(props.path) || props.section === 'configuration',
lede: props.section !== 'trash' ? { kind: 'none' }
@@ -85,7 +96,7 @@ export function manageHeaderSkeletonHtml(props: ManageHeaderProps): string {
const view = manageHeaderView(props);
if (!view) return '';
const menu = props.menu.map(([key, label, mark]) => {
- const on = key === props.section;
+ const on = key === view.pressed;
return `<button type="button" data-manage="${escape(key)}" aria-pressed="${on}"${on ? ' aria-current="page"' : ''}>`
+ `${glyph(mark)}<span>${escape(label)}</span></button>`;
}).join('');
diff --git a/frontend/src/react/activity/activity-page.tsx b/frontend/src/react/activity/activity-page.tsx
index 26fe27da0..398fa2452 100644
--- a/frontend/src/react/activity/activity-page.tsx
+++ b/frontend/src/react/activity/activity-page.tsx
@@ -28,9 +28,10 @@ import { Page } from '../components/page';
import { Progress } from '../components/progress';
import { busyProps } from '../settings/use-action';
import { DownloadsPanel } from './downloads-panel';
+import { ErrorExcerpt } from './error-excerpt';
import {
elapsedText, fetchEarlier, fetchTasks, foldRoutine, followupDetail, groupFollowups, isActive,
- isRoutine, mergeFinished, momentText, pollInterval, statusLabel, summaryText, TASKS_KEY, TRIGGER_LABELS, type TaskRunPayload,
+ isRoutine, mergeFinished, momentText, pollInterval, progressText, statusLabel, summaryText, TASKS_KEY, TRIGGER_LABELS, type TaskRunPayload,
} from './tasks';
/* 状态徽章只有三档颜色:成功是绿、失败是红、被叫停与被打断是黄,其余留中性底。
@@ -95,7 +96,7 @@ function RunCard(
{followups?.length ? <FollowupList rows={followups} /> : null}
{footer
? <div className="flex min-h-14 flex-col justify-center rounded-b-2xl border-t border-separator-border bg-card-footer px-5 py-3">
- <p className="text-caption-1-regular text-text-secondary">{footer}</p>
+ <ErrorExcerpt text={footer} className="text-caption-1-regular text-text-secondary" />
</div>
: null}
</li>
@@ -113,8 +114,8 @@ function RunningRun({ run, followups }: { run: TaskRunPayload; followups?: TaskR
<RunCard run={run} meta={meta} followups={followups}>
{total > 0
? <div className="flex flex-col gap-1.5">
- <Progress label={label} value={current} max={total} />
- <p className="text-caption-1-regular text-text-secondary">{label} · {current} / {total} 项</p>
+ <Progress label={label} value={Math.min(current, total)} max={total} />
+ <p className="text-caption-1-regular text-text-secondary wrap-anywhere">{label} · {progressText(current, total)} 项</p>
</div>
: <LoadingDots label={label} />}
</RunCard>
@@ -136,7 +137,7 @@ function SettledRun(
elapsed && `用时 ${elapsed}`]).filter(Boolean).join(' · ');
return (
<RunCard run={run} meta={meta} footer={run.error} followups={followups}>
- {summary ? <p className="text-caption-1-regular text-text-secondary">{summary}</p> : null}
+ {summary ? <p className="text-caption-1-regular text-text-secondary wrap-anywhere">{summary}</p> : null}
</RunCard>
);
}
diff --git a/frontend/src/react/activity/error-excerpt.tsx b/frontend/src/react/activity/error-excerpt.tsx
new file mode 100644
index 000000000..29c40c131
--- /dev/null
+++ b/frontend/src/react/activity/error-excerpt.tsx
@@ -0,0 +1,31 @@
+/* 列表里的一段报错:平时只露一行(`errorHeadline`),「查看详情」展开全文。
+ *
+ * 后端回的常是整段 traceback 或整页 HTML,铺开会把一张卡撑成几屏高;只露一行又看不到全文,
+ * 所以全文收在键后面,展开后保留原有换行、长 URL 就地折断,太长时在自己的框里滚。 */
+import { useId, useState } from 'react';
+
+import { Button } from '@/components/base/buttons/button';
+
+import { errorHeadline } from './tasks';
+
+export function ErrorExcerpt({ text, className = '' }: { text: string; className?: string }) {
+ const [open, setOpen] = useState(false);
+ const id = useId();
+ const full = String(text || '').trim();
+ const head = errorHeadline(full);
+ if (!head) return null;
+ const more = head !== full;
+ return (
+ <div data-error-excerpt="" className={`flex min-w-0 max-w-full flex-col items-start gap-1 ${className}`}>
+ {open
+ ? <p id={id} className="max-h-80 w-full overflow-y-auto whitespace-pre-line wrap-anywhere">{full}</p>
+ : <p className="w-full wrap-anywhere">{head}</p>}
+ {more
+ ? <Button variant="ghost" size="xs" className="-ml-2" aria-expanded={open} aria-controls={open ? id : undefined}
+ onClick={() => setOpen(!open)}>
+ {open ? '收起详情' : '查看详情'}
+ </Button>
+ : null}
+ </div>
+ );
+}
diff --git a/frontend/src/react/activity/tasks.ts b/frontend/src/react/activity/tasks.ts
index 2df6e1729..2cb27b078 100644
--- a/frontend/src/react/activity/tasks.ts
+++ b/frontend/src/react/activity/tasks.ts
@@ -157,19 +157,36 @@ export function followupDetail(row: TaskRunPayload): string {
const label = row.progress_label || '';
const item = label.startsWith(prefix) ? label.slice(prefix.length) : label === row.task_label ? '' : label;
const total = row.progress_total || 0;
- const tail = row.error || summaryText(row.result_summary)
- || (isActive(row) && total > 0 ? `${row.progress_current || 0} / ${total} 项` : '');
+ const tail = errorHeadline(row.error) || summaryText(row.result_summary)
+ || (isActive(row) && total > 0 ? `${progressText(row.progress_current, total)} 项` : '');
return [item, tail].filter(Boolean).join(' · ');
}
-/** 秒数说成「几分几秒」。跑了几小时的批处理也要一眼读得出量级。 */
+/** 秒数说成「几分几秒」。跑了几小时的批处理也要一眼读得出量级:满 48 小时按天说。 */
export function elapsedText(seconds: number | null | undefined): string {
if (typeof seconds !== 'number' || !Number.isFinite(seconds) || seconds < 0) return '';
const whole = Math.floor(seconds);
if (whole < 60) return `${whole} 秒`;
const minutes = Math.floor(whole / 60);
if (minutes < 60) return `${minutes} 分 ${whole % 60} 秒`;
- return `${Math.floor(minutes / 60)} 小时 ${minutes % 60} 分`;
+ const hours = Math.floor(minutes / 60);
+ if (hours < 48) return `${hours} 小时 ${minutes % 60} 分`;
+ return `${Math.floor(hours / 24).toLocaleString()} 天 ${hours % 24} 小时`;
+}
+
+/** 进度读数「已做 / 总数」:服务端偶尔报出超过总数的已做数,按总数封顶。 */
+export function progressText(current: number | null | undefined, total: number | null | undefined): string {
+ const all = Math.max(0, Number(total) || 0);
+ const done = Math.min(all, Math.max(0, Number(current) || 0));
+ return `${done.toLocaleString()} / ${all.toLocaleString()}`;
+}
+
+/** 一段报错在列表里只露的那一行。Python traceback 的第一行永远是「Traceback (most recent call
+ * last):」,说明不了什么,取最后一行的异常类型与消息;别的取第一行非空。 */
+export function errorHeadline(text: string | null | undefined): string {
+ const lines = String(text || '').split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
+ if (!lines.length) return '';
+ return /^Traceback \(most recent call last\)/.test(lines[0]!) ? lines[lines.length - 1]! : lines[0]!;
}
/** 时间戳说成本地的「月-日 时:分」。账本里存的是 UTC,界面上一律按本机时区读。 */
@@ -194,6 +211,6 @@ export function summaryText(summary: Record<string, unknown>): string {
.filter(([key, value]) => !SUMMARY_HIDDEN.has(key)
&& (typeof value === 'number' || typeof value === 'string')
&& String(value) !== '')
- .map(([key, value]) => `${SUMMARY_LABELS[key] || key} ${value}`)
+ .map(([key, value]) => `${SUMMARY_LABELS[key] || key} ${typeof value === 'number' ? value.toLocaleString() : value}`)
.join(' · ');
}
diff --git a/frontend/src/react/data-cleanup/link-manager.tsx b/frontend/src/react/data-cleanup/link-manager.tsx
index 2ecc071b2..3b054d8ff 100644
--- a/frontend/src/react/data-cleanup/link-manager.tsx
+++ b/frontend/src/react/data-cleanup/link-manager.tsx
@@ -19,6 +19,7 @@ import {
} from '@/components/base/table/table';
import { errorMessage } from '../../api';
+import { ErrorExcerpt } from '../activity/error-excerpt';
import { useBackgroundJob } from '../background-job';
import { DataTableFrame } from '../components/data-table-frame';
import {
@@ -46,6 +47,9 @@ const DISCONNECTED = '暂时无法读取进度,正在重新连接…';
const count = (value: number | undefined) => Number(value || 0).toLocaleString();
+/** 一张结果表先露的行数:一趟检查能判出上百条,全铺开这一节就有几屏长。 */
+export const LINK_TABLE_PREVIEW = 10;
+
/** 一格读数:名目、数字、可选的一句注。每一类各占一格:挤成一行时标签和数字之间只剩
* 间隔点,数字归谁全靠猜。 */
function Stat({ label, value, note }: { label: string; value: string; note?: string }) {
@@ -65,13 +69,17 @@ function LinkTable(
picked?: readonly number[]; onPick?(next: number[]): void; children?: ReactNode;
},
) {
+ const [expanded, setExpanded] = useState(false);
if (!items.length) return null;
const chosen = picked ?? [];
const all = chosen.length > 0 && chosen.length === items.length;
+ // 收起时只露前几行;全选、重试与删除照旧作用于整张表,表头的计数也是全部。
+ const shown = expanded ? items : items.slice(0, LINK_TABLE_PREVIEW);
+ const folded = items.length > LINK_TABLE_PREVIEW;
return (
<div className={RESULT_SECTION}>
<h4 className="mb-1 text-body-semibold text-text-primary">
- {title}<b className="ml-1.5 font-semibold tabular-nums text-text-secondary">{items.length}</b>
+ {title}<b className="ml-1.5 font-semibold tabular-nums text-text-secondary">{items.length.toLocaleString()}</b>
</h4>
<p className="mb-3 text-caption-1-regular text-text-secondary">{hint}</p>
<DataTableFrame>
@@ -91,7 +99,7 @@ function LinkTable(
<TableColumn id="url">地址</TableColumn>
</TableHeader>
<TableBody>
- {items.map((item) => (
+ {shown.map((item) => (
<TableRow key={item.id} id={item.id}>
{onPick ? (
<TableCell>
@@ -102,10 +110,15 @@ function LinkTable(
: chosen.filter((id) => id !== item.id))} />
</TableCell>
) : null}
- <TableCell>{item.entity}</TableCell>
+ {/* 结果常是整段报错:收成一行、宽度封顶,所属和标签留出能读的宽度。 */}
+ <TableCell><span className="block min-w-24 wrap-anywhere">{item.entity}</span></TableCell>
<TableCell>{LINK_KINDS[item.link_kind] || item.link_kind}</TableCell>
- <TableCell>{item.label || ''}</TableCell>
- <TableCell><span className="tabular-nums text-text-error-primary">{item.note}</span></TableCell>
+ <TableCell><span className="block min-w-24 wrap-anywhere">{item.label || ''}</span></TableCell>
+ <TableCell>
+ <div className="min-w-40 max-w-80">
+ <ErrorExcerpt text={item.note} className="tabular-nums text-text-error-primary" />
+ </div>
+ </TableCell>
<TableCell>
{/* 地址保留首尾:`/official/talent/X` 与 `/talent/X` 的差别就在尾部,尾部省略
正好把这张表要回答的东西切掉。中缩改写的是那个 span 的 textContent,
@@ -121,6 +134,13 @@ function LinkTable(
</TableBody>
</Table>
</DataTableFrame>
+ {folded
+ ? <div className="mt-2">
+ <Button variant="secondary" size="small" aria-expanded={expanded} onClick={() => setExpanded(!expanded)}>
+ {expanded ? '收起' : `显示全部 ${items.length.toLocaleString()} 条`}
+ </Button>
+ </div>
+ : null}
{children}
</div>
);
@@ -158,7 +178,7 @@ export function LinkManager() {
const unclear = state?.unclear ?? [];
const retryable = done ? unclear : [];
const info = stats.data;
- const hosts = (info?.top_hosts ?? []).slice(0, 3).map(([host, n]) => `${host} ${n}`).join(' · ');
+ const hosts = (info?.top_hosts ?? []).slice(0, 3).map(([host, n]) => `${host} ${count(n)}`).join(' · ');
const run = (retry?: readonly number[]) => {
if (running || (retry && !retry.length)) return;
@@ -193,11 +213,11 @@ export function LinkManager() {
} else if (state && state.status !== 'idle') {
progress = <>
{state.status === 'running'
- ? <TaskProgress embedded label={checkLine(state)} value={state.checked} total={state.total} />
+ ? <TaskProgress embedded label={checkLine(state)} value={Math.min(state.checked || 0, state.total || 0)} total={state.total} />
: null}
{removing
? <TaskProgress embedded label={prune.job?.message || '正在重验并删除失效链接…'}
- value={prune.job?.checked} total={prune.job?.total} />
+ value={Math.min(prune.job?.checked || 0, prune.job?.total || 0)} total={prune.job?.total} />
: null}
</>;
const pickedLabel = picked.length ? `重试选中的 ${picked.length} 条` : '重试选中的链接';
diff --git a/frontend/src/react/data-cleanup/organize-card.tsx b/frontend/src/react/data-cleanup/organize-card.tsx
index 236ea8ff3..14d52e2eb 100644
--- a/frontend/src/react/data-cleanup/organize-card.tsx
+++ b/frontend/src/react/data-cleanup/organize-card.tsx
@@ -73,9 +73,6 @@ export function OrganizeCard(
const request = () => ({ location, file_template: fields.file.trim(), dir_template: fields.dir.trim() });
const preview = useMutation({
mutationFn: previewOrganize,
- onSuccess: (_plan, sent) => void rememberTemplates({
- ...(data?.templates ?? {}), [sent.location]: { file: sent.file_template, dir: sent.dir_template },
- }),
/* 模板不合法时错误就出在两个框里的一个,所以除了说原因还要指出是哪一格。 */
onError: (cause) => {
const target = DIRECTORY_TEMPLATE_ERROR.test(errorMessage(cause)) ? 'dir' : 'file';
@@ -113,7 +110,14 @@ export function OrganizeCard(
};
const runApply = () => void confirmModal({
title: '按模板整理文件', body: APPLY_BODY(name), confirmLabel: '整理文件',
- onConfirm: () => job.start.mutateAsync({ kind: 'apply', request: request() }),
+ /* 预览只是试一试,不落盘;确认执行的那两行才记成这个来源的模板。 */
+ onConfirm: async () => {
+ const sent = request();
+ await job.start.mutateAsync({ kind: 'apply', request: sent });
+ void rememberTemplates({
+ ...(data?.templates ?? {}), [sent.location]: { file: sent.file_template, dir: sent.dir_template },
+ });
+ },
});
const runRollback = () => void confirmModal({
title: '回滚上一批整理', body: ROLLBACK_BODY, confirmLabel: '回滚整理',
@@ -126,7 +130,7 @@ export function OrganizeCard(
const outcome = job.outcome;
if (current?.status === 'running') {
const line = current.message || current.stage || '正在整理文件…';
- state = <TaskProgress embedded label={line} value={current.checked} total={current.total} />;
+ state = <TaskProgress embedded label={line} value={Math.min(current.checked || 0, current.total || 0)} total={current.total} />;
} else if (outcome?.status === 'failed') {
state = <Note tone="error" title="文件整理未完成">{outcome.error || '请查看任务记录,核对已处理的文件。'}</Note>;
} else if (outcome) {
@@ -186,15 +190,16 @@ export function OrganizeCard(
{data?.presets?.length
? <div className="flex flex-wrap gap-2">
{data.presets.map((preset) => (
- <Button key={preset.label} variant="secondary"
+ <Button key={preset.label} variant="secondary" title={preset.label}
+ className="max-w-full [&>span]:min-w-0 [&>span]:shrink"
onClick={() => { edit({ file: preset.file, dir: preset.dir }); setInvalid(null) }}>
- {preset.label}
+ <span className="truncate">{preset.label}</span>
</Button>
))}
</div>
: null}
<p className="text-caption-1-regular leading-4.5 text-text-secondary">
- {`${hint};方括号里的内容在字段为空时整段省略。`}
+ {`${hint ? `${hint};` : ''}方括号里的内容在字段为空时整段省略。`}
</p>
</div>
<div aria-live="polite" className="mt-3 flex flex-col gap-2 empty:hidden">{state}</div>
diff --git a/frontend/src/react/data-cleanup/organize.ts b/frontend/src/react/data-cleanup/organize.ts
index 0a295bbe6..c0345dd45 100644
--- a/frontend/src/react/data-cleanup/organize.ts
+++ b/frontend/src/react/data-cleanup/organize.ts
@@ -69,8 +69,8 @@ export const startOrganize = (command: OrganizeCommand) => command.kind === 'app
? apiSend<OrganizeJob>(ORGANIZE_APPLY_URL, { ...command.request, confirm: true })
: apiSend<OrganizeJob>(ORGANIZE_ROLLBACK_URL, { confirm: true });
-/** 预览成功的那一刻顺手存下模板:下次进这一页看到的是自己上次用的那两行,而不是又一次
- * 空框。只读端存不进去,那不该挡住预览,所以失败不报。 */
+/** 确认执行的那一刻存下模板:下次进这一页看到的是自己上次执行用的那两行,而不是又一次
+ * 空框。预览不存,试过又放弃的模板不会顶掉上一次的。存不进去不该挡住已经起跑的整理,所以失败不报。 */
export async function rememberTemplates(templates: Record<string, OrganizeTemplate>): Promise<void> {
queryClient.setQueryData<OrganizeData>(ORGANIZE_KEY, (data) => (data ? { ...data, templates } : data));
try {
diff --git a/frontend/src/react/data-cleanup/orphan-records-card.tsx b/frontend/src/react/data-cleanup/orphan-records-card.tsx
index 2bbb8f515..0e8653489 100644
--- a/frontend/src/react/data-cleanup/orphan-records-card.tsx
+++ b/frontend/src/react/data-cleanup/orphan-records-card.tsx
@@ -71,17 +71,17 @@ function OrphanRow({ item, toast }: { item: OrphanRecord; toast(message: string)
: null}
</span>
<span className="flex min-w-0 flex-col gap-0.5">
- <span title={item.name} className="max-w-72 truncate text-body-regular text-text-primary">{item.name}</span>
- <small className="text-caption-1-regular text-text-secondary">
+ <span title={item.name} className="max-w-56 truncate text-body-regular text-text-primary">{item.name}</span>
+ <small className="max-w-56 truncate text-caption-1-regular text-text-secondary">
{[item.code, LOC[item.location] || item.location].filter(Boolean).join(' · ')}
</small>
</span>
</span>
</TableCell>
- <TableCell><span className="block min-w-44">{recordsText(item.records)}</span></TableCell>
+ <TableCell><span className="block min-w-28">{recordsText(item.records)}</span></TableCell>
<TableCell>
{item.candidates.length
- ? <Select aria-label={`把 ${item.name} 的记录接到哪个文件`} className="w-64" selectedKey={target}
+ ? <Select aria-label={`把 ${item.name} 的记录接到哪个文件`} className="w-52" selectedKey={target}
onSelectionChange={(key) => { if (key !== null) setTarget(Number(key)) }}>
{item.candidates.map((candidate) => (
<SelectItem key={candidate.id} id={candidate.id} textValue={candidateText(candidate)}>
@@ -108,6 +108,7 @@ function OrphanRow({ item, toast }: { item: OrphanRecord; toast(message: string)
export function OrphanRecordsCard({ toast }: { toast(message: string): void }) {
const query = useQuery({ queryKey: ORPHAN_RECORDS_KEY, queryFn: ({ signal }) => fetchOrphanRecords(signal) });
const items = query.data?.items ?? [];
+ const total = query.data?.total ?? items.length;
if (!query.isError && !items.length) return null;
return (
<section id="orphan-records" aria-labelledby="orphan-records-title" className="flex scroll-mt-20 flex-col gap-4">
@@ -132,6 +133,11 @@ export function OrphanRecordsCard({ toast }: { toast(message: string): void }) {
</TableBody>
</Table>
</DataTableFrame>}
+ {!query.isError && total > items.length
+ ? <p className="mt-3 text-caption-1-regular text-text-secondary">
+ {`显示前 ${items.length.toLocaleString()} 条,共 ${total.toLocaleString()} 条。`}
+ </p>
+ : null}
</Fieldset>
</section>
);
diff --git a/frontend/src/react/diagnostics/diagnostics-page.tsx b/frontend/src/react/diagnostics/diagnostics-page.tsx
index 2bc42c95d..c6ef2fd79 100644
--- a/frontend/src/react/diagnostics/diagnostics-page.tsx
+++ b/frontend/src/react/diagnostics/diagnostics-page.tsx
@@ -3,6 +3,7 @@ import { useQuery } from '@tanstack/react-query';
import { RiFileListLine } from '@remixicon/react';
import { Button } from '@/components/base/buttons/button';
import { errorMessage } from '../../api';
+import { ErrorExcerpt } from '../activity/error-excerpt';
import { EmptyState } from '../components/empty-state';
import { useOverlayScrollbar } from '../components/overlay-scrollbar';
import { Note } from '../components/note';
@@ -45,12 +46,12 @@ function HealthList({ group, openItem, receipt }: Pick<DiagnosticsProps, 'openIt
const action = useAction();
const scroll = useOverlayScrollbar<HTMLUListElement>();
const list = group.items.map(row => row.code || `作品 #${row.id}`).join('\n');
- return <Disclosure summary={`${group.label} · ${group.count === null ? '未取得' : `${group.count} 项`}`}>
+ return <Disclosure summary={`${group.label} · ${group.count === null ? '未取得' : `${group.count.toLocaleString()} 项`}`}>
{group.count === null ? <Note tone="neutral">清单未取得,请重新检查。</Note> : !group.items.length
? <EmptyState icon={RiFileListLine} title="清单为空" shell="plain">没有需要处理的作品。</EmptyState>
: <Stack>
<div className="flex flex-wrap items-center justify-between gap-2">
- {group.truncated ? <span className="text-body-2-regular text-text-secondary">当前显示 {group.items.length} 项</span> : null}
+ {group.truncated ? <span className="text-body-2-regular text-text-secondary">当前显示 {group.items.length.toLocaleString()} 项</span> : null}
<Button size="small" variant="secondary" {...busyProps(action.busy === 'copy')} onClick={() => void action.run('copy',
() => navigator.clipboard.writeText(list), () => receipt('已复制清单'))}>复制当前清单</Button>
</div>
@@ -88,8 +89,9 @@ export function DiagnosticsPage(props: DiagnosticsProps) {
</Section>)}
<Section title="来源会话"><Stack>
{data.sources.map(source => <div key={source.source} className="flex flex-col gap-2">
- <h3 className="text-body-medium text-text-primary">{source.label} · {STATUS[source.status]}</h3>
- <p className="text-body-regular text-text-primary">{source.reason}</p>
+ <h3 className="text-body-medium text-text-primary">{source.label} · {STATUS[source.status] ?? '未取得'}</h3>
+ {/* 原因常是整段堆栈:平时只露异常那一行,全文收在「查看详情」后面。 */}
+ <ErrorExcerpt text={source.reason} className="text-body-regular text-text-primary" />
<FactList>
<Fact term="上次解析成功">{source.last_success_at ? moment(source.last_success_at) : '未取得'}</Fact>
<Fact term="冷却截止">{source.cooldown_until ? moment(source.cooldown_until) : '未在冷却'}</Fact>
diff --git a/frontend/src/react/duplicates/duplicates-page.tsx b/frontend/src/react/duplicates/duplicates-page.tsx
index 389275004..7eecad777 100644
--- a/frontend/src/react/duplicates/duplicates-page.tsx
+++ b/frontend/src/react/duplicates/duplicates-page.tsx
@@ -23,8 +23,8 @@ import { queryClient } from '../query';
import { SourceMark } from '../settings/section';
import { busyProps } from '../settings/use-action';
import {
- batchOperate, bulkCloudPreferences, DUPLICATES_KEY, duplicateVictims, fetchDuplicates, KEEP_LABELS,
- mixedCloudPreferences, victimBytes, type DuplicateFile, type DuplicateGroup, type KeepRule,
+ batchOperate, bulkCloudPreferences, distinctName, DUPLICATES_KEY, duplicateVictims, fetchDuplicates, KEEP_LABELS,
+ mixedCloudPreferences, sharedNamePrefix, victimBytes, type DuplicateFile, type DuplicateGroup, type KeepRule,
} from './duplicates';
const PLAY = spriteGlyph('play');
@@ -53,8 +53,10 @@ function evidenceFlag(group: DuplicateGroup) {
</span>;
}
-function FileRow({ file, openItem }: { file: DuplicateFile; openItem(id: number): void }) {
+/** 一份副本。`prefix` 是组内共有的名字开头,显示时用「…」顶替,整名在 title 里。 */
+function FileRow({ file, prefix, openItem }: { file: DuplicateFile; prefix: string; openItem(id: number): void }) {
const open = () => openItem(file.id);
+ const location = LOC[file.location] || file.location || file.drive;
return (
<div className="duplicate-row items-center gap-3 border-t border-separator-border px-5 py-4 max-compact:p-4">
{/* 封面格居中用 `inline-grid`:`grid` 与旧样式表同名,不生成这个工具类。 */}
@@ -68,7 +70,7 @@ function FileRow({ file, openItem }: { file: DuplicateFile; openItem(id: number)
<span className="flex min-w-0 items-center gap-2 max-duplicate-narrow:col-start-2 max-duplicate-narrow:-col-end-1">
<button type="button" onClick={open} title={file.name} data-middle-truncate data-middle-truncate-within
className="min-w-0 shrink cursor-pointer truncate text-left text-body-regular hover:text-text-secondary">
- {file.name}
+ {distinctName(file.name, prefix)}
</button>
{file.is_largest || file.is_longest
? <span className="flex flex-none gap-1">
@@ -79,12 +81,12 @@ function FileRow({ file, openItem }: { file: DuplicateFile; openItem(id: number)
</span>
<span className={`${MONO} flex min-w-0 items-center gap-1.5`}>
<SourceMark mark={MEDIA_SOURCE_ICONS[file.location] || 'database'} />
- <span className="whitespace-nowrap">{LOC[file.location] || file.location || file.drive}</span>
+ <span title={location} className="min-w-0 truncate">{location}</span>
</span>
<span className={MONO}>{fmtSize(file.size || 0)}</span>
<span className={MONO}>{fmtDur(file.duration)}</span>
- <span data-middle-truncate title={file.path ?? ''}
- className={`${MONO} col-start-2 -col-end-1 min-w-0 truncate pt-0.5 max-duplicate-narrow:col-span-full`}>
+ {/* 路径整条折行显示:同一组的几份常只在中段不同,截断会让它们看起来一模一样。 */}
+ <span className={`${MONO} col-start-2 -col-end-1 min-w-0 pt-0.5 wrap-anywhere max-duplicate-narrow:col-span-full`}>
{file.path ?? ''}
</span>
</div>
@@ -142,7 +144,7 @@ export function DuplicatesPage({ openItem, toast, failure }: DuplicatesProps) {
return (
<div className="mx-auto w-full max-w-board pb-10.5">
<CollectionSummary label="重复内容" figure={`${Number(data.total || 0).toLocaleString()} 组`}
- detail={`${data.files} 个文件 · 可回收 ${fmtSize(data.reclaimable)}`} />
+ detail={`${Number(data.files || 0).toLocaleString()} 个文件 · 可回收 ${fmtSize(data.reclaimable)}`} />
{groups.length
? <FilterGlass title="批量保留">
<GlassPill busy={pending === 'all:largest'} onPress={() => run({ groups, keep: 'largest', key: 'all:largest' })}>
@@ -165,13 +167,14 @@ export function DuplicatesPage({ openItem, toast, failure }: DuplicatesProps) {
{groups.length
? groups.map((group, index) => {
const one = [group];
+ const prefix = sharedNamePrefix(group.files.map((file) => file.name));
const key = (keep: string) => `${index}:${keep}`;
return (
<section key={`${group.code}-${index}`} aria-label={group.code} className={GROUP}>
<div className="flex flex-wrap items-center gap-3 bg-background-tertiary-default p-5 max-compact:p-4 dark:bg-background-secondary-default">
<b className="text-title-2-medium text-text-primary">{group.code}</b>
<span className="font-mono text-caption-1-regular leading-5 text-text-primary">
- {`${group.count} 个 · 可回收 ${fmtSize(group.reclaimable)}`}
+ {`${Number(group.count || 0).toLocaleString()} 个 · 可回收 ${fmtSize(group.reclaimable)}`}
</span>
{evidenceFlag(group)}
{group.cross_drive
@@ -192,13 +195,18 @@ export function DuplicatesPage({ openItem, toast, failure }: DuplicatesProps) {
onClick={() => run({ groups: one, keep: 'all', key: key('all') })}>整组回收</Button>
</span>
</div>
- <div>{group.files.map((file) => <FileRow key={file.id} file={file} openItem={openItem} />)}</div>
+ <div>{group.files.map((file) => <FileRow key={file.id} file={file} prefix={prefix} openItem={openItem} />)}</div>
</section>
);
})
: <EmptyState icon={STACK} title="没有找到重复文件">
所有来源之间没有检测到内容相同的文件。扫描新来源后,这里会自动更新。
</EmptyState>}
+ {groups.length > 0 && data.total > groups.length
+ ? <p className="text-center text-caption-1-regular text-text-secondary">
+ {`显示可回收最多的前 ${groups.length.toLocaleString()} 组,共 ${Number(data.total).toLocaleString()} 组;处理掉这些后,其余的会补上来。`}
+ </p>
+ : null}
</div>
);
}
diff --git a/frontend/src/react/duplicates/duplicates.ts b/frontend/src/react/duplicates/duplicates.ts
index 2d3c07448..604198324 100644
--- a/frontend/src/react/duplicates/duplicates.ts
+++ b/frontend/src/react/duplicates/duplicates.ts
@@ -56,6 +56,27 @@ export interface DuplicatesData {
export const fetchDuplicates = (signal?: AbortSignal) =>
apiGet<DuplicatesData>(DUPLICATES_URL, signal);
+/* 名字之间在哪里断开算一个词:空格、连字符、下划线、点、括号与路径分隔符。 */
+const NAME_BREAK = /[\s\-_.()[\]【】/\\]/;
+
+/** 一组副本共有的开头,退到最后一个断词处:同一部片子的几份常只在中段不同(分辨率、
+ * 转载站、序号),整名中段截断正好把唯一的差别切掉。共有段不足 8 个字或只有一份时为空。 */
+export function sharedNamePrefix(names: readonly string[]): string {
+ if (names.length < 2) return '';
+ let end = 0;
+ const first = names[0]!;
+ while (end < first.length && names.every((name) => name[end] === first[end])) end += 1;
+ // 共有段一直到某一个名字的结尾时,那个名字整个都是共有段,退一格留出能显示的部分。
+ if (names.some((name) => name.length <= end)) end = Math.max(0, end - 1);
+ let cut = end;
+ while (cut > 0 && !NAME_BREAK.test(first[cut - 1]!)) cut -= 1;
+ return cut >= 8 ? first.slice(0, cut) : '';
+}
+
+/** 组内显示的名字:去掉组里共有的开头,用「…」顶替;组头已经写着番号。 */
+export const distinctName = (name: string, prefix: string) =>
+ prefix && name.startsWith(prefix) && name.length > prefix.length ? `…${name.slice(prefix.length)}` : name;
+
/** 首屏:重复分组与配了根目录的网盘(「留 115」那几颗键要它),取完才画。不给 `staleTime`,
* `/duplicates` 是 `refresh:'reopen'`,进来就重取。 */
export async function prefetchDuplicates(signal: AbortSignal): Promise<void> {
diff --git a/frontend/src/react/junk-queue/junk-queue-page.tsx b/frontend/src/react/junk-queue/junk-queue-page.tsx
index fbc10b425..72826116e 100644
--- a/frontend/src/react/junk-queue/junk-queue-page.tsx
+++ b/frontend/src/react/junk-queue/junk-queue-page.tsx
@@ -118,6 +118,12 @@ function JunkBody({ props, data, pending, error, retry }: {
))}
</div>
{shown.length < items.length ? <RevealMore key={segments} onMore={more} /> : null}
+ {/* 队列一次只取前 200 条:露到底了还有没取的,说清楚是截断而不是全部。 */}
+ {shown.length >= items.length && Number(data.total || 0) > items.length
+ ? <p data-junk-truncated="" className="py-6 text-center text-caption-1-regular text-text-secondary">
+ {`显示前 ${items.length.toLocaleString()} 条,共 ${Number(data.total).toLocaleString()} 条;处理掉这些后,其余的会补上来。`}
+ </p>
+ : null}
</>
);
};
diff --git a/frontend/src/react/junk-queue/junk-queue.css b/frontend/src/react/junk-queue/junk-queue.css
index 9f1c94ee5..57216cefa 100644
--- a/frontend/src/react/junk-queue/junk-queue.css
+++ b/frontend/src/react/junk-queue/junk-queue.css
@@ -217,3 +217,11 @@ body[data-density="dense"] .peach-react [data-junk-actions] [data-junk-label] {
.peach-react [data-junk-actions] button { min-height: 44px; }
.peach-react [data-junk-actions] button[data-junk-action="dispose"] { padding-inline: 7px; }
}
+
+/* 键行按自己的宽度判:卡片窄到三格放不下「图标+五个字」时(单列手机上约 290px 宽的卡)
+ * 收掉图标、收窄内边距,字留着;无障碍名与 title 不变。 */
+.peach-react [data-junk-actions] { container-type: inline-size; }
+@container (max-width: 340px) {
+ .peach-react [data-junk-actions] button[data-junk-action] { gap: 4px; padding-inline: 6px; }
+ .peach-react [data-junk-actions] button > svg { display: none; }
+}
diff --git a/frontend/src/react/library-processing/library-processing-card.tsx b/frontend/src/react/library-processing/library-processing-card.tsx
index 841a07422..76d44ceaf 100644
--- a/frontend/src/react/library-processing/library-processing-card.tsx
+++ b/frontend/src/react/library-processing/library-processing-card.tsx
@@ -145,7 +145,7 @@ function Outcome(
<ul ref={list} className="max-h-96 overflow-y-auto pr-3">
{details.items.map((item) => (
<li key={item.key}
- className="flex flex-col gap-0.5 border-b border-current/15 py-2 first:pt-1 last:border-b-0 last:pb-1">
+ className="flex flex-col gap-0.5 border-b border-current/15 py-2 wrap-anywhere first:pt-1 last:border-b-0 last:pb-1">
{item.href
? <a href={item.href} className="text-body-2-medium underline-offset-4 hover:underline">{item.label}</a>
: <span className="text-body-2-medium">{item.label}</span>}
@@ -240,7 +240,7 @@ export function LibraryProcessingCard(props: LibraryProcessingProps) {
<FieldsetTitle>扫描与采集</FieldsetTitle>
<p className="text-body-2-regular text-text-secondary">{SCAN_CARD_TEXT}</p>
{state.status === 'running'
- ? <TaskProgress embedded label={line} value={state.checked} total={state.total} />
+ ? <TaskProgress embedded label={line} value={Math.min(state.checked || 0, state.total || 0)} total={state.total} />
: null}
</div>
</Fieldset>
diff --git a/frontend/src/react/library-processing/library-processing-notice.tsx b/frontend/src/react/library-processing/library-processing-notice.tsx
index 04e259dd6..d87e678f6 100644
--- a/frontend/src/react/library-processing/library-processing-notice.tsx
+++ b/frontend/src/react/library-processing/library-processing-notice.tsx
@@ -11,6 +11,7 @@ import { RiArrowRightLine, RiErrorWarningLine, RiInformationLine } from '@remixi
import { LinkButton } from '@/components/base/buttons/link-button';
import { errorMessage } from '../../api';
+import { progressText } from '../activity/tasks';
import type { LibraryProcessingProps } from '../bundle';
import { currentLine, DISCONNECTED_TEXT } from './library-processing';
import { useLibraryProcessingJob } from './use-library-processing';
@@ -56,11 +57,11 @@ export function LibraryProcessingNotice(props: LibraryProcessingProps) {
if (!problem && !running && !failed) return null;
const tone: Tone = failed ? 'error' : problem || state?.stalled ? 'warning' : 'gray';
- const checked = state?.checked || 0;
const total = state?.total || 0;
+ const checked = Math.min(state?.checked || 0, total);
const message = problem
|| (failed ? '扫描与资料采集未完成'
- : currentLine(state!) + (total ? ` · ${checked} / ${total}` : ''));
+ : currentLine(state!) + (total ? ` · ${progressText(checked, total)}` : ''));
const Glyph = tone === 'gray' ? RiInformationLine : RiErrorWarningLine;
return (
<aside role={failed ? 'alert' : 'status'} className={SURFACE[tone]}>
diff --git a/frontend/src/react/library-processing/library-processing.ts b/frontend/src/react/library-processing/library-processing.ts
index 2792e23a9..9d79834c9 100644
--- a/frontend/src/react/library-processing/library-processing.ts
+++ b/frontend/src/react/library-processing/library-processing.ts
@@ -5,6 +5,7 @@
* 轮询也由 Query 合成一份——各存一份状态的话,卡片说「已完成」、横幅还挂着进度。
* 端点在 `frontend/src` 里只在这里声明一次(`tests/test_frontend_build.py` 盯着)。 */
import { apiGet } from '../../api';
+import { elapsedText } from '../activity/tasks';
import { queryClient } from '../query';
export const LIBRARY_PROCESSING_URL = '/api/library-processing';
@@ -108,14 +109,14 @@ const NOTE_LABELS: Record<string, string> = {
export function notesLine(notes: Record<string, number>): string {
const parts = Object.entries(notes)
.filter(([key, count]) => NOTE_LABELS[key] && count > 0)
- .map(([key, count]) => `${NOTE_LABELS[key]} ${count} 部`);
+ .map(([key, count]) => `${NOTE_LABELS[key]} ${count.toLocaleString()} 部`);
return parts.length ? `外部来源${parts.join('、')},7 天内不再问。` : '';
}
/** 此刻在做什么:哪个文件、哪一步、等了多久。 */
export function currentLine(state: LibraryProcessingData): string {
const action = ACTION_LABELS[state.current_action || ''] || state.stage || '正在处理';
- const waited = state.waited_seconds ? ` · 已等待 ${state.waited_seconds} 秒` : '';
+ const waited = state.waited_seconds ? ` · 已等待 ${elapsedText(state.waited_seconds)}` : '';
return state.current_asset_name
? `当前:${state.current_asset_name} · ${action}${waited}`
: action + waited;
diff --git a/frontend/src/react/manage-header/manage-header-island.tsx b/frontend/src/react/manage-header/manage-header-island.tsx
index cd6c6250a..a4811bc3a 100644
--- a/frontend/src/react/manage-header/manage-header-island.tsx
+++ b/frontend/src/react/manage-header/manage-header-island.tsx
@@ -57,7 +57,7 @@ function ManageHeader({ host: at, props: current }: { host: ManageHeaderHost; pr
if (!view) return null;
return (
<>
- <ManageBar host={at} section={current.section} menu={current.menu} />
+ <ManageBar host={at} pressed={view.pressed} menu={current.menu} />
{view.crumb ? <Crumb host={at} label={view.crumb} /> : null}
<h2 data-manage-title="" data-compact={view.compact ? '' : undefined}>{view.title}</h2>
{view.lede.kind === 'none' ? null : <TrashLede host={at} lede={view.lede} />}
@@ -69,7 +69,9 @@ function ManageHeader({ host: at, props: current }: { host: ManageHeaderHost; pr
一排下划线页签:按下那一项由一条 2px 的线标出来。线是这一排里的一个绝对定位元素,位置与宽度
量出来写成 `--tab-x`、`--tab-width`;换页沿弹簧滑过去。离开管理区再回来时这一排是新挂上的,
线先落在上一次停的那一项下面、下一帧再滑到这一页:上一次停在哪儿按模块记,不按节点记。
- 真正头一次出现时没有上一次,直接落位。回收站不在菜单里,那一页没有按下项,线收成 0 宽。 */
+ 真正头一次出现时没有上一次,直接落位。数据管理那几张卡通往的子页按下「数据管理」;管理条上没有
+ 按下项的页面(`pressedManageKey` 判出空串)线收成 0 宽。窄屏这一排横向滚,换页时把按下那一项
+ 滚进视口;只在换页时滚,用户自己横滑之后不被拉回去。 */
let lastTab: { x: number; width: number } | null = null;
function placeLine(mark: HTMLElement, x: number, width: number) {
@@ -77,7 +79,7 @@ function placeLine(mark: HTMLElement, x: number, width: number) {
mark.style.setProperty('--tab-width', `${width}px`);
}
-function ManageBar({ host: at, section, menu }: Pick<ManageHeaderProps, 'section' | 'menu'> & { host: ManageHeaderHost }) {
+function ManageBar({ host: at, pressed: key, menu }: Pick<ManageHeaderProps, 'menu'> & { host: ManageHeaderHost; pressed: string }) {
const row = useRef<HTMLDivElement>(null);
const line = useRef<HTMLSpanElement>(null);
@@ -103,16 +105,25 @@ function ManageBar({ host: at, section, menu }: Pick<ManageHeaderProps, 'section
return () => { cancelAnimationFrame(first); cancelAnimationFrame(second); resize.disconnect() };
}, []);
- useLayoutEffect(() => { if (line.current?.hasAttribute('data-ready')) measure() }, [section, menu]);
+ useLayoutEffect(() => { if (line.current?.hasAttribute('data-ready')) measure() }, [key, menu]);
+
+ useLayoutEffect(() => {
+ const group = row.current;
+ const pressed = group?.querySelector<HTMLElement>('button[aria-pressed="true"]');
+ if (!group || !pressed) return;
+ const left = pressed.offsetLeft, right = left + pressed.offsetWidth;
+ if (left < group.scrollLeft) group.scrollLeft = left;
+ else if (right > group.scrollLeft + group.clientWidth) group.scrollLeft = right - group.clientWidth;
+ }, [key, menu]);
return (
<nav data-manage-bar="" aria-label="管理">
<div ref={row} data-manage-menu="">
- {menu.map(([key, label, glyph]) => {
- const on = key === section;
+ {menu.map(([entry, label, glyph]) => {
+ const on = entry === key;
return (
- <button key={key} type="button" data-manage={key} aria-pressed={on} aria-current={on ? 'page' : undefined}
- onClick={() => at.openManage(key)}>
+ <button key={entry} type="button" data-manage={entry} aria-pressed={on} aria-current={on ? 'page' : undefined}
+ onClick={() => at.openManage(entry)}>
<Icon name={glyph} /><span>{label}</span>
</button>
);
diff --git a/frontend/src/react/media-repair/media-repair.ts b/frontend/src/react/media-repair/media-repair.ts
index f0090b59d..5ea870e84 100644
--- a/frontend/src/react/media-repair/media-repair.ts
+++ b/frontend/src/react/media-repair/media-repair.ts
@@ -54,7 +54,8 @@ const count = (value: number) => Number(value).toLocaleString();
/** 一句话说清此刻在干什么:扫描报进度,修复报进度加当前这部片。 */
export function statusLine(state: MediaRepairState): string {
if (state.status === 'running') {
- const where = state.total ? `${count(state.checked)} / ${count(state.total)}` : '准备中';
+ // 服务端偶尔报出超过总数的已查数,按总数封顶。
+ const where = state.total ? `${count(Math.min(state.checked || 0, state.total))} / ${count(state.total)}` : '准备中';
return state.stage === '修复' && state.message
? `修复 ${where} · ${state.message}`
: `${state.stage || '扫描'} ${where}`;
diff --git a/frontend/src/react/quality-goals/quality-goals-page.tsx b/frontend/src/react/quality-goals/quality-goals-page.tsx
index 2fe6d2ecd..b08d9bdcb 100644
--- a/frontend/src/react/quality-goals/quality-goals-page.tsx
+++ b/frontend/src/react/quality-goals/quality-goals-page.tsx
@@ -37,7 +37,7 @@ function GoalCard({ item, openItem, searchResources, javTitleHtml, javDisplayNam
间距的规则,排在 `peach-react.css` 后面会赢。这颗按钮是 flex 子项,行内格
会被块级化,算出来仍是 `display:grid`。 */}
<button type="button" onClick={open} aria-label={`打开 ${javDisplayName(item)}`}
- className="relative inline-grid w-card-cover shrink-0 aspect-card-cover cursor-pointer place-items-center overflow-hidden rounded-2lg bg-background-tertiary-default">
+ className="relative inline-grid w-card-cover shrink-0 self-start aspect-card-cover cursor-pointer place-items-center overflow-hidden rounded-2lg bg-background-tertiary-default">
{/* 图片取不到时(onError 把 img 摘掉)露出来的就是这句。 */}
<span className="text-caption-1-regular text-text-secondary">暂无预览</span>
<img src={previewUrl(item)} alt="" loading="lazy"
@@ -45,9 +45,10 @@ function GoalCard({ item, openItem, searchResources, javTitleHtml, javDisplayNam
className="absolute inset-0 size-full object-contain" />
</button>
<div className="flex min-w-0 flex-col gap-1.5">
+ {/* 标题从番号读起,长了折到第二行再截尾:中段截断会把番号和片名一起切掉。 */}
<h3 className="text-headline-medium text-text-primary">
- <button type="button" data-middle-truncate onClick={open}
- className="block w-full cursor-pointer text-left"
+ <button type="button" onClick={open} title={javDisplayName(item)}
+ className="line-clamp-2 w-full cursor-pointer text-left wrap-anywhere"
dangerouslySetInnerHTML={{ __html: javTitleHtml(item) }} />
</h3>
<p className="flex flex-wrap items-center gap-2 text-body-2-regular text-text-secondary">
@@ -59,7 +60,7 @@ function GoalCard({ item, openItem, searchResources, javTitleHtml, javDisplayNam
<span>{Number(item.size) > 0 ? fmtSize(Number(item.size)) : '大小未知'}</span>
</p>
{item.reason
- ? <p className="border-t border-separator-border pt-3 text-body-2-regular text-text-secondary">
+ ? <p className="border-t border-separator-border pt-3 text-body-2-regular text-text-secondary wrap-anywhere">
{item.reason}
</p>
: null}
@@ -100,10 +101,16 @@ export function QualityGoalsPage({ toast, ...props }: QualityGoalsProps) {
<Page>
{/* 总数取服务端的 `total` 而不是这一页的条数:`limit` 截断时两者不是一个数,
而这一行要回答的是「一共还欠多少部」。 */}
- <CollectionSummary label="待升级" figure={`${data.total} 部作品`} flush />
+ <CollectionSummary label="待升级" figure={`${Number(data.total || 0).toLocaleString()} 部作品`} flush />
<ul className="card-grid-cover gap-5">
{items.map((item) => <GoalCard key={item.id} item={item} {...props} searchResources={setDownload} />)}
</ul>
+ {/* 列表只取前 200 部;总数比这多时说清楚这一页不是全部。 */}
+ {Number(data.total || 0) > items.length
+ ? <p className="mt-6 text-center text-caption-1-regular text-text-secondary">
+ {`显示前 ${items.length.toLocaleString()} 部,共 ${Number(data.total).toLocaleString()} 部。`}
+ </p>
+ : null}
<CloudDownloadDialog prefill={download} close={() => setDownload(null)} receipt={toast} />
</Page>
);
diff --git a/frontend/src/react/review/review-card.tsx b/frontend/src/react/review/review-card.tsx
index f3151a0d5..03292c162 100644
--- a/frontend/src/react/review/review-card.tsx
+++ b/frontend/src/react/review/review-card.tsx
@@ -32,6 +32,9 @@ const CARD = cardClass({
勾选框和判定徽章各自在这 24px 里居中,谁的字号变了也还在同一条中线上。 */
const HEADING_LINE = 'flex min-h-6 min-w-0 items-center';
+/** 实体类卡头最多露几部对照作品,同服务端给的条数。 */
+const COMPARISON_SHOWN = 2;
+
/* 一排卡等高,长出来的那部分在卡内滚。高度随内容走的话,一行里几张卡参差不齐,
眼睛要在每张卡上重新找「判定」在哪;身份回配那一类要放下来源图和样本列表,高一档。 */
const CARD_HEIGHT = (category: ReviewCategory) =>
@@ -86,11 +89,18 @@ export function ReviewCard(props: ReviewCardProps) {
const assets = row.preview_assets || [];
const decided = String(row.decision || 'pending') !== 'pending';
+ /* 对照作品排在不缩的卡头里:服务端给两条,再多也只露前两条,其余报一个数,
+ 否则卡头会把动作条挤出卡外。 */
const origin = comparison.length > 1
? <div className="flex flex-col gap-3">
- {comparison.map((asset) => (
+ {comparison.slice(0, COMPARISON_SHOWN).map((asset) => (
<OriginAsset key={asset.id} asset={asset} openItem={handlers.openItem} />
))}
+ {comparison.length > COMPARISON_SHOWN
+ ? <p className="text-body-2-regular text-text-secondary">
+ {`另有 ${(comparison.length - COMPARISON_SHOWN).toLocaleString()} 部对照作品`}
+ </p>
+ : null}
</div>
: asEntity
? <EntityHead kind={subjectKind} name={subjectName}
@@ -132,7 +142,8 @@ export function ReviewCard(props: ReviewCardProps) {
/* 字段名是这张卡在问的问题(「这个作品的创作者填什么」),作品标识只是它问的对象。
写在标题末尾的话,一条无番号视频的文件名会先把它挤出省略号。 */
? <h4 className={`${HEADING_LINE} flex-wrap gap-2`}>
- <Chip variant="caption" color="blue">{fieldName}</Chip>
+ {/* Chip 自己不截断:外面套一层封顶的裁切框,超长的字段名不撑出卡外,全文在 title 里。 */}
+ <span title={fieldName} className="flex max-w-full min-w-0 overflow-hidden rounded-md"><Chip variant="caption" color="blue">{fieldName}</Chip></span>
<span title={subject} className="min-w-0 truncate text-body-medium text-text-primary">{subject}</span>
</h4>
: <h4 className={HEADING_LINE}>
@@ -169,7 +180,7 @@ export function ReviewCard(props: ReviewCardProps) {
{/* 实体类卡片的作品数已经写在创作者入口里,这里再写一遍就是同一个数字两处。 */}
{!asEntity && (row.board || row.assets)
? <p className="text-body-2-regular text-text-secondary">
- {`样本/资产:${row.video_count || row.assets || ''}`}
+ {`样本/资产:${Number(row.video_count || row.assets || 0).toLocaleString()}`}
</p>
: null}
{!asEntity && origin ? origin : null}
@@ -183,7 +194,7 @@ export function ReviewCard(props: ReviewCardProps) {
{preview}
<PendingGenres row={row} tags={genreTags} locked={locked} toast={handlers.toast} />
{!metadata && evidence
- ? <p className="text-body-2-regular text-text-secondary">{evidence}</p>
+ ? <p className="text-body-2-regular text-text-secondary wrap-anywhere">{evidence}</p>
: null}
</div>
</div>
@@ -194,7 +205,7 @@ export function ReviewCard(props: ReviewCardProps) {
{metadata && evidence
? <div className="relative -mx-5 -mb-4 shrink-0">
<p ref={current} role="region" aria-label="当前信息"
- className="max-h-22 overflow-y-auto border-t border-separator-border px-5 py-2.5 text-body-2-regular text-text-secondary">
+ className="max-h-22 overflow-y-auto border-t border-separator-border px-5 py-2.5 text-body-2-regular text-text-secondary wrap-anywhere">
{evidence}
</p>
</div>
@@ -207,9 +218,11 @@ export function ReviewCard(props: ReviewCardProps) {
onClick={() => onDecide('rejected')}>拒绝</Button>
<Button variant="secondary" size="small" disabled={locked} {...busyProps(busy)}
onClick={() => onDecide('skipped')}>跳过</Button>
+ {/* 没有可采纳的候选时这颗键灰着,字面说它为什么点不了,和旁边的「跳过」分得开。 */}
<Button variant="primary" size="small" disabled={locked || !approvable} {...busyProps(busy)}
+ title={approvable ? undefined : '没有可采纳的候选,只能拒绝或跳过'}
onClick={() => onDecide('approved')}>
- {approvable ? '通过' : '已跳过'}
+ {approvable ? '通过' : '不可通过'}
</Button>
{problem
? <p role="status" className="w-full text-body-2-regular text-text-error-primary">{problem}</p>
diff --git a/frontend/src/react/review/review-page.tsx b/frontend/src/react/review/review-page.tsx
index cc88d444b..f411dc8ff 100644
--- a/frontend/src/react/review/review-page.tsx
+++ b/frontend/src/react/review/review-page.tsx
@@ -323,7 +323,14 @@ export function ReviewPage(props: ReviewProps) {
))}
</div>
</section>
- )) : (
+ )) : review.isError && !review.data ? (
+ /* 读不到队列和队列是空的不是一回事:说清楚是读取失败,给一颗重试键。 */
+ <Note tone="error" title="复核队列读取失败" action={
+ <Button variant="secondary" size="small" disabled={review.isFetching} onClick={() => void review.refetch()}>重试</Button>
+ }>
+ {errorMessage(review.error)}
+ </Note>
+ ) : (
<EmptyState icon={RiCheckboxCircleLine} title="此分类没有待复核项目">
可切换分类查看其他候选。
</EmptyState>
diff --git a/frontend/src/react/scraping/scraping-page.tsx b/frontend/src/react/scraping/scraping-page.tsx
index f047d751e..9eafd40cc 100644
--- a/frontend/src/react/scraping/scraping-page.tsx
+++ b/frontend/src/react/scraping/scraping-page.tsx
@@ -28,7 +28,7 @@ import { Page } from '../components/page';
import { SEGMENT, SEGMENTED_TRACK, SegmentedRadioGroup as RadioGroup } from '../components/segmented';
import { queryClient } from '../query';
import {
- ErrorText, ExternalLink, Fact, FactList, FieldLabel, Footer, Help, Rows, Section, Stack,
+ Disclosure, ErrorText, ExternalLink, Fact, FactList, FieldLabel, Footer, Help, Rows, Section, Stack,
} from '../settings/section';
import { busyProps } from '../settings/use-action';
import {
@@ -39,6 +39,21 @@ import {
} from './scraping';
const NETWORKS = [['peach', 'Peach 代理'], ['direct', '直接连接']] as const;
+
+/** 连接方式的选项。账本里存着这两种以外的值(旧版写下的、手改的)时把它原样列成一项,
+ * 下拉框照实显示现在是什么,不落到空占位上。 */
+export function networkOptions(current: string): (readonly [string, string])[] {
+ return NETWORKS.some(([key]) => key === current) || !current ? [...NETWORKS] : [...NETWORKS, [current, current]];
+}
+
+/** 登录页外链只写主机名:整条地址在窄屏上会把分区标题挤成一字一行,路径也说明不了是哪个站。 */
+export function linkHost(url: string): string {
+ try {
+ return new URL(url).host || url;
+ } catch {
+ return url;
+ }
+}
const COOKIE_METHODS = [['paste', '粘贴 Cookie'], ['file', '导入文件']] as const;
/* 前面是站点自己的图标(指对象),后面是外链箭头(指形态)——两枚都在
@@ -154,14 +169,15 @@ function SourceCard({ source, toast }: { source: Source } & ScrapingProps) {
<Section title={source.label} onSubmit={submit} aside={
<span className="flex min-w-0 items-center gap-1">
<SiteMark source={source.source} />
- <ExternalLink href={source.login}>{source.login}</ExternalLink>
+ <ExternalLink href={source.login}>{linkHost(source.login)}</ExternalLink>
</span>
}>
<Rows>
<SettingsRow label="连接方式">
- <Select aria-label="连接方式" selectedKey={network}
+ {/* 定宽:账本里的长取值按内容撑宽会把左边的「连接方式」挤成竖排,定宽后取值在框里截断。 */}
+ <Select aria-label="连接方式" className="w-44 min-w-0" selectedKey={network}
onSelectionChange={(key) => { if (key !== null) setNetwork(String(key)) }}>
- {NETWORKS.map(([key, name]) => <SelectItem key={key} id={key}>{name}</SelectItem>)}
+ {networkOptions(network).map(([key, name]) => <SelectItem key={key} id={key}>{name}</SelectItem>)}
</Select>
</SettingsRow>
</Rows>
@@ -310,9 +326,14 @@ function AmaneBridgeCard({ toast }: ScrapingProps) {
<Fact term="已安装版本">{data.installed_version || '未安装'}</Fact>
<Fact term="上游最新版本">{check.data?.latest ?? '尚未检查'}</Fact>
<Fact term="运行环境">{data.installed ? '已安装' : '未安装'}</Fact>
- <Fact term="内置站点">{data.sites.map((site) => site.label).join('、')}</Fact>
+ <Fact term="内置站点">{data.sites.length.toLocaleString()} 个</Fact>
</FactList>
<Stack divided>
+ {data.sites.length
+ ? <Disclosure summary="查看内置站点">
+ <p className="text-body-2-regular text-text-secondary">{data.sites.map((site) => site.label).join('、')}</p>
+ </Disclosure>
+ : null}
<Help>
已安装版本:{data.installed_version || '未安装'}。amane({data.license})提供这些内置站点的解析能力。
重新安装会使用 Peach 内置的 {data.version} 版本,不随上游自动升级。
diff --git a/frontend/src/react/settings-panel/number-setting.tsx b/frontend/src/react/settings-panel/number-setting.tsx
index e302b2c69..cf75da15b 100644
--- a/frontend/src/react/settings-panel/number-setting.tsx
+++ b/frontend/src/react/settings-panel/number-setting.tsx
@@ -22,6 +22,14 @@ export type NumberSettingId = keyof typeof NUMBER_SPECS;
const storageKey = (id: string) => `peach.number.${id}`;
+/** 以分钟计的间隔满一天时,单位旁边再说一遍是几天:「10080 分钟」读不出是一周。
+ * 不满一天、不是整数或不是分钟的读数返回空串。 */
+export function dayReading(value: number, unit: string): string {
+ if (unit !== '分钟' || !Number.isInteger(value) || value < 1440) return '';
+ const days = value / 1440;
+ return Number.isInteger(days) ? `${days.toLocaleString()} 天` : `约 ${days.toFixed(1)} 天`;
+}
+
export function NumberSetting({ id, label, value, disabled = false, onApply }: {
id: NumberSettingId; label: string;
/** 当前值;null 表示还没取到(关注自动更新那一项),此时整块禁用、不改显示。 */
@@ -112,7 +120,7 @@ export function NumberSetting({ id, label, value, disabled = false, onApply }: {
}
}}
onKeyDown={(event) => { if (event.key === 'Enter') { event.preventDefault(); commit() } }} />
- <span aria-hidden="true">{unit}</span>
+ <span aria-hidden="true">{unit}{dayReading(Number(draft), unit) ? ` · ${dayReading(Number(draft), unit)}` : ''}</span>
</div>
<small id={`${id}-error`} data-number-error="" role="status" hidden={!error}>{error}</small>
</div>
diff --git a/frontend/src/react/settings-panel/settings-data.ts b/frontend/src/react/settings-panel/settings-data.ts
index e3f0063b5..04f7cdbef 100644
--- a/frontend/src/react/settings-panel/settings-data.ts
+++ b/frontend/src/react/settings-panel/settings-data.ts
@@ -10,6 +10,7 @@
import { useMutation, type QueryClient } from '@tanstack/react-query';
import { apiGet, apiSend } from '../../api';
+import { errorHeadline } from '../activity/tasks';
import { queryClient } from '../query';
import { localTime } from '../time';
@@ -97,15 +98,16 @@ export function useSaveThumbnailMode() {
export function followScheduleCopy(status: FollowScheduleStatus): string {
if (!status.available) return '只在账本写入端运行';
if (status.running) return '正在检查全部来源…';
- if (status.last_error) return `上次失败:${status.last_error}`;
- if (status.last_finished_at) return `上次完成 ${localTime(status.last_finished_at)} · 新增 ${status.last_added || 0}`;
+ // 面板里一行说明放不下整段堆栈,只说异常那一行;全文在活动页这一轮的卡片里。
+ if (status.last_error) return `上次失败:${errorHeadline(status.last_error)}`;
+ if (status.last_finished_at) return `上次完成 ${localTime(status.last_finished_at)} · 新增 ${(status.last_added || 0).toLocaleString()}`;
if (status.next_run_at) return `下次 ${localTime(status.next_run_at)}`;
return status.enabled ? '等待首次运行' : '已关闭';
}
export function videoThumbnailCopy(status: ThumbnailJobStatus): string {
if (status.status === 'running') return '正在采集,进度在活动页查看。';
- if (status.status === 'failed') return `上一轮采集停下了:${status.stopped || '原因未取得'}`;
+ if (status.status === 'failed') return `上一轮采集停下了:${errorHeadline(status.stopped) || '原因未取得'}`;
if (status.status === 'complete') return status.stopped ? '上一轮采集已按停。' : '上一轮采集已完成。';
return status.mode === 'off'
? '关闭时不采集;已经生成的图留在盘上,清理走数据管理页。'
diff --git a/frontend/src/react/settings-panel/settings-panel.css b/frontend/src/react/settings-panel/settings-panel.css
index d36315b31..680082be1 100644
--- a/frontend/src/react/settings-panel/settings-panel.css
+++ b/frontend/src/react/settings-panel/settings-panel.css
@@ -37,7 +37,7 @@
[data-settings-panel] [data-setting-row]{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;align-items:center;padding:14px 0 14px;border-top:1px solid var(--line-soft)}
[data-settings-panel] [data-setting-group]>h3+[data-setting-row]{border-top:0}
[data-settings-panel] [data-setting-row] b{display:block;font-size:var(--fs-md)}
-[data-settings-panel] [data-setting-row] small{display:block;color:var(--muted);margin-top:8px;line-height:1.45}
+[data-settings-panel] [data-setting-row] small{display:block;color:var(--muted);margin-top:8px;line-height:1.45;overflow-wrap:anywhere}
[data-settings-panel] [data-setting-row] [class~=ui-gselect]{min-width:148px}
[data-settings-panel] [data-setting-row][data-setting-related]{border-top:0}
[data-settings-panel] [data-setting-group] [data-setting-row][data-setting-sort]{grid-template-columns:minmax(0,1fr);gap:12px;padding-block:14px 16px}
@@ -355,6 +355,9 @@ html[data-theme-snapshot] [data-settings-panel] :is([data-settings-glide],[data-
@media (max-width:760px){[data-settings-panel][data-settings-panel]{padding:12px;grid-template-columns:minmax(0,1fr)}}
@media (max-width:760px){[data-settings-panel] [data-settings-card][data-settings-card]{width:calc(100vw - 24px);max-width:calc(100vw - 24px);min-width:0}}
@media (max-width:760px){[data-settings-panel] [data-settings-card] [data-settings-scroll] [data-setting-row]:has([data-number-setting]){grid-template-columns:minmax(0,1fr) auto;gap:12px}}
+/* 再窄的手机上开关加数字框要占去一半宽,名目会挤成一字一行:控件换到名目下面、靠右。 */
+@media (max-width:420px){[data-settings-panel] [data-settings-card] [data-settings-scroll] [data-setting-row]:has([data-number-setting]){grid-template-columns:minmax(0,1fr);gap:8px}}
+@media (max-width:420px){[data-settings-panel] [data-settings-card] [data-settings-scroll] [data-setting-row]:has([data-number-setting])>:last-child{justify-self:end}}
@media (max-width:760px){[data-settings-panel] [data-settings-card]>[data-settings-nav]{min-width:0;max-width:100%}}
/* 纯图标按钮不继承浏览器按钮的水平内边距。 */
[data-settings-panel] :is([data-settings-head] button,[data-sidebar-row] button){padding:0;display:inline-grid;place-items:center;line-height:1;flex-shrink:0}
diff --git a/frontend/src/react/settings/folder-rows.tsx b/frontend/src/react/settings/folder-rows.tsx
index ad14584b8..fefb22e07 100644
--- a/frontend/src/react/settings/folder-rows.tsx
+++ b/frontend/src/react/settings/folder-rows.tsx
@@ -117,11 +117,27 @@ export function FolderRow({ label, path, onPath, error, inputRef, picking, onPic
status?: ReactNode;
children: ReactNode;
}) {
+ /* 一组文件夹常共用很长的前缀,窄框里露开头的话每行都是同一段;不在编辑时露末段,
+ 分得出是哪一个文件夹。全文在 title 里。 */
+ const box = useRef<HTMLInputElement | null>(null);
+ const showTail = () => {
+ const input = box.current;
+ if (input && input.ownerDocument.activeElement !== input) input.scrollLeft = input.scrollWidth;
+ };
+ useLayoutEffect(() => {
+ if (box.current) box.current.title = path;
+ showTail();
+ }, [path]);
+ const attach = (element: HTMLInputElement | null) => {
+ box.current = element;
+ inputRef(element);
+ };
return (
<div data-folder-row className="@container flex flex-col gap-2 rounded-2lg border border-separator-border bg-background-primary-default p-3">
<div className="flex items-start gap-2">
<Input className="min-w-0 flex-1" aria-label={label} placeholder="本机文件夹路径"
- value={path} onChange={onPath} ref={inputRef}
+ value={path} onChange={onPath} ref={attach}
+ onBlur={() => requestAnimationFrame(showTail)}
validationBehavior="aria" isInvalid={Boolean(error)} hint={error || undefined} />
{status ? <div className="flex h-10 shrink-0 items-center">{status}</div> : null}
<IconButton icon={FolderSearchIcon} aria-label="选择文件夹" onClick={onPick} {...busyProps(picking)} />
diff --git a/frontend/src/react/settings/section.tsx b/frontend/src/react/settings/section.tsx
index a2639899f..62e7f1e6a 100644
--- a/frontend/src/react/settings/section.tsx
+++ b/frontend/src/react/settings/section.tsx
@@ -21,21 +21,24 @@ interface SectionProps {
children: ReactNode;
}
+/* 分区里的说明、报错与读数常带长 URL、堆栈和无空格路径:整个分区按 `overflow-wrap:anywhere`
+ 就地折断(属性会继承,行内说明、Help 与读数都跟着走),不把卡片撑出横向滚动。 */
export function Section({ title, id, aside, onSubmit, children }: SectionProps) {
const body = (
<>
{aside
+ /* 标题至少留 10rem:放不下时外链换到下一行,不把标题挤成一字一行。 */
? <div className="flex w-full flex-wrap items-center justify-between gap-2">
- <div className="min-w-0 flex-1"><SettingsSectionLabel>{title}</SettingsSectionLabel></div>
- {aside}
+ <div className="min-w-40 flex-1"><SettingsSectionLabel>{title}</SettingsSectionLabel></div>
+ <div className="flex min-w-0 max-w-full">{aside}</div>
</div>
: <SettingsSectionLabel>{title}</SettingsSectionLabel>}
<SettingsCard>{children}</SettingsCard>
</>
);
return onSubmit
- ? <form id={id} aria-label={title} noValidate onSubmit={onSubmit} className="flex w-full flex-col gap-2">{body}</form>
- : <section id={id} aria-label={title} className="flex w-full flex-col gap-2">{body}</section>;
+ ? <form id={id} aria-label={title} noValidate onSubmit={onSubmit} className="flex w-full flex-col gap-2 wrap-anywhere">{body}</form>
+ : <section id={id} aria-label={title} className="flex w-full flex-col gap-2 wrap-anywhere">{body}</section>;
}
/** 一组 `SettingsRow`。行自己画下边线、最后一行不画,所以要有一层只装行的父元素。 */
@@ -96,11 +99,13 @@ export function FactList({ children }: { children: ReactNode }) {
return <dl className="flex flex-col">{children}</dl>;
}
+/* 名目按内容宽,最多占一半,再长就在自己那一半里折行;读数靠右,折成多行时行内文字左对齐,
+ 读起来是一段话而不是一面右对齐的字墙。 */
export function Fact({ term, children }: { term: ReactNode; children: ReactNode }) {
return (
<div className="flex min-h-11 items-center justify-between gap-4 border-b border-separator-border py-2.5 pr-3 last:border-b-0">
- <dt className="flex shrink-0 items-center gap-2 text-body-regular text-text-secondary">{term}</dt>
- <dd className="flex min-w-0 flex-wrap items-center justify-end gap-2 text-right text-body-regular break-all text-text-primary">{children}</dd>
+ <dt className="flex max-w-1/2 min-w-0 shrink-0 items-center gap-2 text-body-regular text-text-secondary">{term}</dt>
+ <dd className="flex min-w-0 flex-wrap items-center justify-end gap-2 text-left text-body-regular break-all text-text-primary">{children}</dd>
</div>
);
}
diff --git a/frontend/test/react/activity.test.tsx b/frontend/test/react/activity.test.tsx
index ca300d532..cd9449ce5 100644
--- a/frontend/test/react/activity.test.tsx
+++ b/frontend/test/react/activity.test.tsx
@@ -8,7 +8,10 @@ import { afterEach, expect, it, vi } from 'vitest';
import { ActivityPage } from '../../src/react/activity/activity-page';
import { DOWNLOADS_URL } from '../../src/react/activity/downloads-panel';
-import { elapsedText, prefetchTasks, summaryText, TASKS_URL } from '../../src/react/activity/tasks';
+import { ErrorExcerpt } from '../../src/react/activity/error-excerpt';
+import {
+ elapsedText, errorHeadline, prefetchTasks, progressText, summaryText, TASKS_URL,
+} from '../../src/react/activity/tasks';
import type { ActivityData, FinishedPage, TaskRunPayload } from '../../src/react/activity/tasks';
import type { DownloadsSnapshot } from '../../src/react/bundle';
import { queryClient } from '../../src/react/query';
@@ -366,7 +369,15 @@ it('时长与摘要的折算各自成立', () => {
expect(elapsedText(59)).toBe('59 秒');
expect(elapsedText(75)).toBe('1 分 15 秒');
expect(elapsedText(3725)).toBe('1 小时 2 分');
+ // 满 48 小时按天说:「73 小时 1 分」读不出是三天。
+ expect(elapsedText(47 * 3600 + 59 * 60)).toBe('47 小时 59 分');
+ expect(elapsedText(73 * 3600 + 60)).toBe('3 天 1 小时');
expect(elapsedText(null)).toBe('');
+ expect(summaryText({ checked: 1234567 })).toBe('已检查 1,234,567');
+ // 进度按总数封顶,带千分位。
+ expect(progressText(1500, 1000)).toBe('1,000 / 1,000');
+ expect(progressText(-3, 10)).toBe('0 / 10');
+ expect(progressText(null, null)).toBe('0 / 0');
// 明细与「谁挡的」不进这一行:前者太长,后者已经写在错误那一句里了。
expect(summaryText({ checked: 7, operation: 'like', rows: [1], blocked_by: 3 }))
.toBe('已检查 7 · 操作 like');
@@ -376,3 +387,26 @@ it('时长与摘要的折算各自成立', () => {
request_id: '417dab8d', completed_at: 1790138495.48,
})).toBe('已检查 83 · 总数 83');
});
+
+it('报错在列表里只露一行:traceback 取最后一行,别的取第一行非空', () => {
+ const stack = 'Traceback (most recent call last):\n File "x.py", line 1, in <module>\nValueError: 坏了';
+ expect(errorHeadline(stack)).toBe('ValueError: 坏了');
+ expect(errorHeadline('\n 连接超时\n详情见日志')).toBe('连接超时');
+ expect(errorHeadline('')).toBe('');
+ expect(errorHeadline(null)).toBe('');
+});
+
+it('报错摘要平时只露一行,「查看详情」展开全文、再点收起;只有一行时不给这颗键', async () => {
+ const stack = 'Traceback (most recent call last):\n File "x.py", line 1\nValueError: 坏了';
+ const host = await mount(<ErrorExcerpt text={stack} />);
+ expect(host.textContent).toBe('ValueError: 坏了查看详情');
+ await click(buttonNamed('查看详情', host));
+ expect(host.textContent).toContain('File "x.py", line 1');
+ expect(buttonNamed('收起详情', host)?.getAttribute('aria-expanded')).toBe('true');
+ await click(buttonNamed('收起详情', host));
+ expect(host.textContent).toBe('ValueError: 坏了查看详情');
+
+ const single = await mount(<ErrorExcerpt text="只有一行" />);
+ expect(single.textContent).toBe('只有一行');
+ expect(buttonNamed('查看详情', single)).toBeNull();
+});
diff --git a/frontend/test/react/data-cleanup.test.tsx b/frontend/test/react/data-cleanup.test.tsx
index 919a64d87..bb536f0a4 100644
--- a/frontend/test/react/data-cleanup.test.tsx
+++ b/frontend/test/react/data-cleanup.test.tsx
@@ -496,7 +496,7 @@ describe('整理', () => {
});
}
- it('模板框跟着存下的模板走;预览发的是这一格的来源与模板,成功后存下模板', async () => {
+ it('模板框跟着存下的模板走;预览发的是这一格的来源与模板,预览不存模板', async () => {
const server = organizeServer();
queryClient.setQueryData(['organize'], organizeIdle);
const host = await wrap(<OrganizeCard toast={vi.fn()} failure={vi.fn()} />);
@@ -508,14 +508,12 @@ describe('整理', () => {
expect(server.posts('/api/organize/preview')).toEqual([
{ location: 'local', file_template: '{number} {title}', dir_template: '' },
]);
- expect(server.posts('/api/settings')).toEqual([
- { organizeTemplates: { local: { file: '{number} {title}', dir: '' } } },
- ]);
+ expect(server.posts('/api/settings')).toEqual([]);
expect(host.textContent).toContain('2 个文件会改名或移动,5 个已经就是目标名字;跳过 缺番号 1。');
expect(host.textContent).toContain('ABC-001.mp4');
});
- it('执行先确认,确认了才发 apply', async () => {
+ it('执行先确认,确认了才发 apply,起跑后存下这次的模板', async () => {
const seen = confirmWith(true);
const server = organizeServer();
queryClient.setQueryData(['organize'], organizeIdle);
@@ -530,6 +528,9 @@ describe('整理', () => {
expect(server.posts('/api/organize/apply')).toEqual([
{ location: 'local', file_template: '{number}', dir_template: '', confirm: true },
]);
+ expect(server.posts('/api/settings')).toEqual([
+ { organizeTemplates: { local: { file: '{number}', dir: '' } } },
+ ]);
});
it('有上一批才给回滚;回滚也先确认,取消就不发', async () => {
diff --git a/frontend/test/react/duplicates.test.tsx b/frontend/test/react/duplicates.test.tsx
index c31dcdc6e..cc47589dd 100644
--- a/frontend/test/react/duplicates.test.tsx
+++ b/frontend/test/react/duplicates.test.tsx
@@ -7,7 +7,8 @@ import * as legacyUi from '@peach/legacy/ui';
import { DuplicatesPage } from '../../src/react/duplicates/duplicates-page';
import {
- cloudPreferenceLocations, DUPLICATES_KEY, duplicateVictims, mixedCloudPreferences, prefetchDuplicates,
+ cloudPreferenceLocations, distinctName, DUPLICATES_KEY, duplicateVictims, mixedCloudPreferences, prefetchDuplicates,
+ sharedNamePrefix,
type DuplicateFile, type DuplicateGroup, type DuplicatesData,
} from '../../src/react/duplicates/duplicates';
import { cloudLocations, MEDIA_SOURCES_KEY, type MediaSourcesData } from '../../src/react/media-sources';
@@ -179,3 +180,16 @@ it('没有重复组时是一张空态,不画批量条', async () => {
expect(host.textContent).toContain('没有找到重复文件');
expect(buttonNamed('全部保留最大', host)).toBeNull();
});
+
+it('同组副本只在中段不同时,名字去掉共有开头、退到断词处,差别留在显示的那一段里', () => {
+ const names = ['ABC-123 [1080p] 转载站甲.mp4', 'ABC-123 [720p] 转载站甲.mp4', 'ABC-123 [480p] 转载站甲.mp4'];
+ const prefix = sharedNamePrefix(names);
+ expect(prefix).toBe('ABC-123 [');
+ expect(names.map((name) => distinctName(name, prefix)))
+ .toEqual(['…1080p] 转载站甲.mp4', '…720p] 转载站甲.mp4', '…480p] 转载站甲.mp4']);
+ // 共有段太短、只有一份或名字整个都是共有段时,原样显示。
+ expect(sharedNamePrefix(['AB-1.mp4', 'AB-2.mp4'])).toBe('');
+ expect(sharedNamePrefix(['ABC-123 一份.mp4'])).toBe('');
+ expect(sharedNamePrefix(['ABC-123 part.mp4', 'ABC-123 part.mp4'])).toBe('ABC-123 part.');
+ expect(distinctName('ABC-123 part.mp4', 'ABC-123 part.mp4')).toBe('ABC-123 part.mp4');
+});
diff --git a/frontend/test/react/library-processing.test.tsx b/frontend/test/react/library-processing.test.tsx
index 90a8de906..59bcbbc14 100644
--- a/frontend/test/react/library-processing.test.tsx
+++ b/frontend/test/react/library-processing.test.tsx
@@ -10,7 +10,7 @@ import { afterEach, expect, it, vi } from 'vitest';
import { queryClient } from '../../src/react/query';
import {
- prefetchLibraryProcessing, type LibraryProcessingData,
+ currentLine, notesLine, prefetchLibraryProcessing, type LibraryProcessingData,
} from '../../src/react/library-processing/library-processing';
import { LibraryProcessingCard } from '../../src/react/library-processing/library-processing-card';
import { LibraryProcessingNotice } from '../../src/react/library-processing/library-processing-notice';
@@ -163,7 +163,7 @@ it('运行态说清当前项目、动作与等待时长,处理慢只提示不
});
const host = await mount(card({ toast: vi.fn() }));
- expect(host.textContent).toContain('当前:ABW-001.mp4 · 查询外部资料 · 已等待 300 秒');
+ expect(host.textContent).toContain('当前:ABW-001.mp4 · 查询外部资料 · 已等待 5 分 0 秒');
expect(host.textContent).toContain('处理较慢');
// 有分母就画进度条,不再另画一组等待点:同一件事两种说法。
expect(host.querySelectorAll('[role="progressbar"]')).toHaveLength(1);
@@ -339,3 +339,10 @@ it('卡片卸载之后轮询就停了', async () => {
await tick(20_000);
expect(served.calls, '离开这一页之后那棵根还活着的话,它会照原节律接着敲库').toHaveLength(1);
});
+
+it('来源说没有的计数带千分位,等待时长按分、时、天进位', () => {
+ expect(notesLine({ querying_metadata: 1234567, fetching_cover: 0 }))
+ .toBe('外部来源没有资料 1,234,567 部,7 天内不再问。');
+ expect(currentLine({ status: 'running', current_action: 'fetching_cover', waited_seconds: 259200 } as LibraryProcessingData))
+ .toBe('采集缺失封面 · 已等待 3 天 0 小时');
+});
diff --git a/frontend/test/react/manage-header.test.tsx b/frontend/test/react/manage-header.test.tsx
index 179c59016..8c6c8033b 100644
--- a/frontend/test/react/manage-header.test.tsx
+++ b/frontend/test/react/manage-header.test.tsx
@@ -7,7 +7,7 @@ import { act } from 'react';
import { createRoot } from 'react-dom/client';
import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest';
-import { manageHeaderSkeletonHtml, type ManageEntry, type ManageHeaderProps } from '../../src/manage-header';
+import { manageHeaderSkeletonHtml, pressedManageKey, type ManageEntry, type ManageHeaderProps } from '../../src/manage-header';
import type { BatchDockApi, BatchDockHost } from '../../src/react/batch-dock/batch-dock-api';
import type { ManageHeaderApi, ManageHeaderHost } from '../../src/react/manage-header/manage-header-api';
import type { ShellActions } from '../../src/react/router/shell-actions';
@@ -231,6 +231,19 @@ describe('管理条与面包屑', () => {
expect(host.openManage).toHaveBeenCalledWith('stats');
});
+ it('数据管理之下的子页按下「数据管理」,骨架与组件同一个判据;管理条上没有的区不按下任何一项', async () => {
+ const first = props('trash', '/trash');
+ const { root, render } = await setup(first);
+ const pressed = () => [...root.querySelectorAll('[data-manage][aria-pressed="true"]')].map((node) => node.getAttribute('data-manage'));
+ expect(pressed()).toEqual(['cleanup']);
+ expect(manageHeaderSkeletonHtml(first)).toContain('data-manage="cleanup" aria-pressed="true"');
+ render(props('cleanup', '/quality-goals'));
+ expect(pressed()).toEqual(['cleanup']);
+ render(props('stats', '/stats'));
+ expect(pressed()).toEqual(['stats']);
+ expect(pressedManageKey({ section: 'trash', path: '/somewhere', menu: MENU })).toBe('');
+ });
+
it('面包屑普通左键走路由,带修饰键或中键的点击照链接自己走', async () => {
const { root, host } = await setup(props('cleanup', '/duplicates'));
const link = root.querySelector<HTMLAnchorElement>('[data-manage-crumb] a')!;
diff --git a/frontend/test/react/media-repair.test.tsx b/frontend/test/react/media-repair.test.tsx
index 4e40ee8e6..13190c348 100644
--- a/frontend/test/react/media-repair.test.tsx
+++ b/frontend/test/react/media-repair.test.tsx
@@ -7,7 +7,7 @@ import * as legacyUi from '@peach/legacy/ui';
import { MediaRepairCard } from '../../src/react/media-repair/media-repair-card';
import {
- IDLE_REPAIR, MEDIA_REPAIR_KEY, prefetchMediaRepair, REPAIR_LIBRARIES_KEY,
+ IDLE_REPAIR, MEDIA_REPAIR_KEY, prefetchMediaRepair, REPAIR_LIBRARIES_KEY, statusLine,
type MediaRepairState, type RepairLibrary,
} from '../../src/react/media-repair/media-repair';
import { queryClient } from '../../src/react/query';
@@ -131,3 +131,8 @@ it('缺索引的片子卡在没装 untrunc 上时,指明去配置页的运行
expect(host.querySelector('p[role="status"]')?.textContent).toBe('修好 0 部,2 部修不了');
expect(host.textContent).toContain('2 部缺索引的片子要装上 untrunc 才修得了,下载入口在配置页的「运行信息」里');
});
+
+it('进度读数按总数封顶:服务端报出的已查数超过总数时不写成 1,500 / 1,000', () => {
+ expect(statusLine({ ...IDLE_REPAIR, status: 'running', stage: '修复', checked: 1500, total: 1000 }))
+ .toBe('修复 1,000 / 1,000');
+});
diff --git a/frontend/test/react/number-setting.test.tsx b/frontend/test/react/number-setting.test.tsx
index 15b6e143e..bf0f4a340 100644
--- a/frontend/test/react/number-setting.test.tsx
+++ b/frontend/test/react/number-setting.test.tsx
@@ -4,7 +4,7 @@ import { createRoot } from 'react-dom/client';
import { afterEach, beforeEach, expect, it, vi } from 'vitest';
import { boundedPreference } from '../../src/number-setting';
-import { NumberSetting, type NumberSettingId } from '../../src/react/settings-panel/number-setting';
+import { dayReading, NumberSetting, type NumberSettingId } from '../../src/react/settings-panel/number-setting';
import './render';
const unmounts: (() => void)[] = [];
@@ -98,3 +98,10 @@ it('读回的偏好只认区间内的整数', () => {
expect(boundedPreference(2.5, 1, 50, 10)).toBe(10);
expect(boundedPreference(99, 1, 50, 10)).toBe(10);
});
+
+it('以分钟计的间隔满一天时在单位旁换算成天,不满一天或不是分钟时不说', () => {
+ expect(dayReading(10080, '分钟')).toBe('7 天');
+ expect(dayReading(2160, '分钟')).toBe('约 1.5 天');
+ expect(dayReading(1439, '分钟')).toBe('');
+ expect(dayReading(10080, '秒')).toBe('');
+});
diff --git a/frontend/test/react/quality-goals.test.tsx b/frontend/test/react/quality-goals.test.tsx
index a70944136..facc7640b 100644
--- a/frontend/test/react/quality-goals.test.tsx
+++ b/frontend/test/react/quality-goals.test.tsx
@@ -100,7 +100,8 @@ it('每条目标一张卡片,读数走遗留层同一套格式化口径', asyn
expect(card.querySelector('.src')?.getAttribute('data-location')).toBe('115');
expect(card.querySelector('.src')?.classList.contains('metered')).toBe(true);
expect(card.querySelector('h3 .ui-javcode')?.textContent).toBe('one.mp4');
- expect(card.querySelector('h3 button')?.hasAttribute('data-middle-truncate')).toBe(true);
+ expect(card.querySelector('h3 button')?.hasAttribute('data-middle-truncate')).toBe(false);
+ expect(card.querySelector('h3 button')?.getAttribute('title')).toBe('名称 one.mp4');
expect([...card.querySelectorAll('p')].at(-1)?.textContent).toBe('只有 720p');
});
diff --git a/frontend/test/react/review.test.tsx b/frontend/test/react/review.test.tsx
index 754b9250b..5d3135ab0 100644
--- a/frontend/test/react/review.test.tsx
+++ b/frontend/test/react/review.test.tsx
@@ -241,3 +241,32 @@ it('打开复核页只读队列,不再触发自动落库写操作', async () =
const { fetcher } = await open();
expect(fetcher.mock.calls.map(([url]) => String(url))).toEqual([REVIEW_URL]);
});
+
+it('队列读取失败时说读取失败、给重试键,和空队列分得开;重试成功后画出队列', async () => {
+ let fail = true;
+ vi.stubGlobal('fetch', vi.fn(async (input: string) => {
+ if (!String(input).startsWith(REVIEW_URL)) throw new Error(`没有安排这个端点:${String(input)}`);
+ return fail
+ ? { ok: false, status: 500, json: async () => ({ message: '复核队列查询出错' }) }
+ : ok(review());
+ }));
+ await prefetchReview(new AbortController().signal).catch(() => {});
+ const { host } = await mountRoot(
+ <QueryClientProvider client={queryClient}><ReviewPage {...shellProps()} /></QueryClientProvider>);
+ await settle();
+ expect(host.textContent).toContain('复核队列读取失败');
+ expect(host.textContent).not.toContain('此分类没有待复核项目');
+ fail = false;
+ await click(buttonIn(host, '重试'));
+ await settle();
+ expect(host.textContent).not.toContain('复核队列读取失败');
+ expect(cards(host)).toHaveLength(REVIEW_PAGE_SIZE);
+});
+
+it('没有可采纳候选的卡,通过键写「不可通过」,和「跳过」字面分得开', async () => {
+ const empty: ReviewRow = { ...row(7), candidates: [] };
+ const { host } = await open({ data: review({ sections: { metadata_fields: [empty], creator_tags: [] } }) });
+ const footer = cards(host)[0]!.querySelector('footer')!;
+ expect([...footer.querySelectorAll('button')].map((button) => button.textContent?.trim()))
+ .toEqual(['拒绝', '跳过', '不可通过']);
+});
diff --git a/frontend/test/react/scraping.test.tsx b/frontend/test/react/scraping.test.tsx
index 0f2e6e4aa..fd0db4163 100644
--- a/frontend/test/react/scraping.test.tsx
+++ b/frontend/test/react/scraping.test.tsx
@@ -7,7 +7,7 @@ import { notifyManager, QueryClientProvider } from '@tanstack/react-query';
import { afterEach, expect, it, vi } from 'vitest';
import { queryClient } from '../../src/react/query';
-import { ScrapingPage } from '../../src/react/scraping/scraping-page';
+import { linkHost, networkOptions, ScrapingPage } from '../../src/react/scraping/scraping-page';
import { prefetchScraping } from '../../src/react/scraping/scraping';
import type { AmaneBridge, Check, CoverJob, Source } from '../../src/react/scraping/scraping';
@@ -319,3 +319,10 @@ it('amane 桥:检查上游只填「上游最新版本」那一行,重建跟
expect(toast).toHaveBeenCalledTimes(1);
expect(toast).toHaveBeenCalledWith('amane 桥已按 79ecfa763cc7 重建');
});
+
+it('登录外链只写主机名;账本里认不出的连接方式原样列成一项,下拉框不落到空占位', () => {
+ expect(linkHost('https://www.javbus.com/login?next=%2F')).toBe('www.javbus.com');
+ expect(linkHost('不是地址')).toBe('不是地址');
+ expect(networkOptions('peach').map(([key]) => key)).toEqual(['peach', 'direct']);
+ expect(networkOptions('socks-legacy')).toEqual([['peach', 'Peach 代理'], ['direct', '直接连接'], ['socks-legacy', 'socks-legacy']]);
+});
diff --git a/web/app.js b/web/app.js
index 574fc8d64..66c814da9 100644
--- a/web/app.js
+++ b/web/app.js
@@ -2572,13 +2572,16 @@ function routeFollowFromSidebar(patch){
routeFollowFeed({...followView(),...patch});
paintSidebar({filters:followSidebarFilters()});
}
+/* 侧栏按窄屏处理(抽屉盖在页面上、收起时 inert)的判据,与样式表的 `@media(max-width:760px)` 同源。
+ 读的是媒体查询而不是 innerWidth:页面内容一旦撑出视口,布局视口跟着变宽,innerWidth 报的就不是屏幕宽。 */
+function narrowShell(){return matchMedia('(max-width:760px)').matches}
function openDrawer(v){const drawer=$('#drawer'),restore=!v&&drawer.contains(document.activeElement);
- drawer.inert=!v&&innerWidth<=760;
+ drawer.inert=!v&&narrowShell();
drawer.classList.toggle('open',v);$('#scrim').classList.toggle('on',v);
document.body.classList.toggle('drawer-open',!!v);document.dispatchEvent(new Event('board:sidebar'));
$('#filterBtn').setAttribute('aria-expanded',String(!!v));$('#filterBtn').setAttribute('aria-controls','drawer');$('#filterBtn').setAttribute('aria-label',v?'收起侧栏':'展开侧栏');
if(restore)$('#filterBtn').focus();sessionStorage.setItem('board.sidebar',v?'open':'closed')}
-function closeDrawerAfterNav(){if(innerWidth<=760)openDrawer(false)}
+function closeDrawerAfterNav(){if(narrowShell())openDrawer(false)}
$('#filterBtn').onclick=()=>openDrawer(!$('#drawer').classList.contains('open'));
/* 侧栏导航默认就有的入口,`[键, 名称, 字形]`;首页的键是空串。 */
const SIDEBAR_ITEMS=[
@@ -3837,7 +3840,7 @@ function placeBrand(){
if(!head)return;
boardBrand.setAttribute('aria-label','选择媒体库');
if(boardBrand.parentElement!==head)head.prepend(boardBrand);
- const expanded=drawer.classList.contains('open'),desktop=innerWidth>760;
+ const expanded=drawer.classList.contains('open'),desktop=!narrowShell();
if(desktop||expanded){if(boardToggle.parentElement!==head)head.append(boardToggle)}else if(boardToggle.parentElement!==toggleHome.parentElement)toggleHome.after(boardToggle);
drawer.inert=!desktop&&!expanded;
}
@@ -3923,4 +3926,4 @@ if(/Chrome|Chromium|Edg\//.test(navigator.userAgent)){
})();
-openDrawer(innerWidth>760&&sessionStorage.getItem('board.sidebar')!=='closed');
+openDrawer(!narrowShell()&&sessionStorage.getItem('board.sidebar')!=='closed');
diff --git a/web/board.css b/web/board.css
index 74a28c586..7581d1ec2 100644
--- a/web/board.css
+++ b/web/board.css
@@ -936,7 +936,7 @@ body[data-surface="/trash"] #grid{width:100%;max-width:var(--board-content);marg
这一页的占位条改成随正文色走的一层薄叠色,深浅两种底上都看得出。说明行那两条占位同理,归页头岛。 */
body[data-surface="/trash"] .catalog-skeleton .skeletoncard>*{background:color-mix(in srgb,var(--ink) 7%,transparent)}
@media(max-width:900px){
- body[data-surface="/review"] .review-workspace{grid-template-columns:1fr}
+ body[data-surface="/review"] .review-workspace{grid-template-columns:minmax(0,1fr)}
body[data-surface="/review"] .review-workspace>.reviewcontrols{position:static;grid-column:1;grid-row:auto!important;margin-bottom:16px}
body[data-surface="/review"] .reviewtabs{flex-direction:row;flex-wrap:wrap}
body[data-surface="/review"] .review-workspace>:is(.reviewsection,.reviewbulktoolbar){grid-column:1}