fix(downloads): humanized reasons and TechInfo on the download panel (DL-2b)
- board organize hint uses DEAI-2 reasonLine; add transfer_failed, blocked, blocked_by_conflict, main_failed, not_imported_kind, target_root_not_managed, download_removed to the reason table with tests - download detail / plans tab: internal ids, raw codes and JSON moved into TechInfo - library versions tech block switched to TechInfo (TODO(DEAI-2)) - copy: glossary terms (no 接管/候选), plan reason codes no longer shown raw Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8315ece4d1
commit
3f1c4d6c3b
11 files changed
+105
-65
No files matched your search
@@ -3,8 +3,9 @@ import { ChevronDown } from "lucide-react";
|
||||
import { type ReactNode, useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { useLibraryVersions } from "~/api/library-versions.ts";
|
||||
import { type KvItem, KvList } from "~/components/console/kv-list.tsx";
|
||||
import { JsonView } from "~/components/console/json-view.tsx";
|
||||
import { consolePath } from "~/components/console/nav.ts";
|
||||
import { TechInfo } from "~/components/console/tech-info.tsx";
|
||||
import { Panel } from "~/components/library/parts.tsx";
|
||||
import { cn, formatBytes, formatDateTime } from "~/lib/utils.ts";
|
||||
|
||||
@@ -86,45 +87,31 @@ function duration(sec: number | null): string | null {
|
||||
const SPEC_FROM: Record<string, string> = { name: "文件名", probe: "ffprobe" };
|
||||
|
||||
/** 技术信息:路径、音轨、字幕、入库时间、下载任务、探测原始值 */
|
||||
// TODO(DEAI-2):TechInfo 组件合入后改用 components/console/tech-info.tsx,和其他页面统一折叠样式与默认展开偏好
|
||||
function VersionTech({ v }: { v: AssetVersion }) {
|
||||
const items: KvItem[] = [
|
||||
{ label: "文件", value: v.absolutePath ?? v.relativePath ?? v.fileName, mono: true, wide: true },
|
||||
{ label: "音轨", value: audioText(v) },
|
||||
{ label: "字幕", value: v.subtitleLanguages.map(langLabel).join("、") || null },
|
||||
{ label: "时长", value: duration(v.durationSec) },
|
||||
{ label: "色深", value: v.bitDepth ? `${v.bitDepth} bit` : null },
|
||||
{ label: "入库时间", value: formatDateTime(v.organizedAt) },
|
||||
{
|
||||
label: "下载任务",
|
||||
value: v.downloadTaskId ? (
|
||||
<Link to={consolePath("downloads", v.downloadTaskId)} className="underline-offset-2 hover:underline">
|
||||
查看下载任务
|
||||
</Link>
|
||||
) : null,
|
||||
},
|
||||
{ label: "规格来源", value: v.specFrom.map((f) => SPEC_FROM[f] ?? f).join(" + ") || null },
|
||||
].filter((it) => it.value !== null && it.value !== undefined && it.value !== "");
|
||||
return (
|
||||
<details className="group mt-1">
|
||||
<summary className="inline-flex cursor-pointer list-none items-center gap-1 text-meta text-muted-foreground hover:text-foreground [&::-webkit-details-marker]:hidden">
|
||||
技术信息
|
||||
<ChevronDown className="size-3.5 transition-transform duration-micro group-open:rotate-180" aria-hidden />
|
||||
</summary>
|
||||
<div className="grid gap-3 pt-2 pb-1">
|
||||
<KvList items={items} />
|
||||
{v.probe ? (
|
||||
<details className="group/raw">
|
||||
<summary className="cursor-pointer list-none text-meta text-muted-foreground hover:text-foreground [&::-webkit-details-marker]:hidden">
|
||||
探测原始值
|
||||
</summary>
|
||||
<pre className="mt-1 max-h-64 overflow-auto rounded-lg bg-muted/40 p-2 font-mono text-caption break-all whitespace-pre-wrap text-foreground">
|
||||
{JSON.stringify(v.probe, null, 2)}
|
||||
</pre>
|
||||
</details>
|
||||
) : null}
|
||||
</div>
|
||||
</details>
|
||||
<TechInfo
|
||||
className="mt-1"
|
||||
items={[
|
||||
{ label: "文件", value: v.absolutePath ?? v.relativePath ?? v.fileName, wide: true },
|
||||
{ label: "音轨", value: audioText(v), mono: false },
|
||||
{ label: "字幕", value: v.subtitleLanguages.map(langLabel).join("、") || null, mono: false },
|
||||
{ label: "时长", value: duration(v.durationSec), mono: false },
|
||||
{ label: "色深", value: v.bitDepth ? `${v.bitDepth} bit` : null, mono: false },
|
||||
{ label: "入库时间", value: v.organizedAt ? formatDateTime(v.organizedAt) : null, mono: false },
|
||||
{
|
||||
label: "下载任务",
|
||||
mono: false,
|
||||
value: v.downloadTaskId ? (
|
||||
<Link to={consolePath("downloads", v.downloadTaskId)} className="underline-offset-2 hover:underline">
|
||||
查看下载任务
|
||||
</Link>
|
||||
) : null,
|
||||
},
|
||||
{ label: "规格来源", value: v.specFrom.map((f) => SPEC_FROM[f] ?? f).join(" + ") || null, mono: false },
|
||||
]}
|
||||
>
|
||||
{v.probe ? <JsonView label="探测原始值" value={v.probe} defaultOpen={false} maxHeight="16rem" /> : null}
|
||||
</TechInfo>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user