生产 v0.3.8~v0.3.13 均由 8013196 加工作区修改构建部署,此前未提交;本提交补齐源码,
并含未部署的 v0.3.14 原地入库。中间各版本源码状态未保存,无法逐版拆分,详见
docs/plan/17-full-upgrade.md 与 docs/plan/18-organize-release.md。
- v0.3.8 全面升级:Deno workspace 依赖、Router 8 / Vite 8、camofox 1.18.0 / Node 24、
PostgreSQL 18.6、备份客户端 18.6、演示 qB 5.2.4
- v0.3.9 媒体整理:分类规则、整理来源与目录快照(0059)、文件管理整理入口
- v0.3.10 手动下载与入库:独立手动下载、详情页资源下载、TMDB / Local 元数据兜底
(metadata.resolve_organize)、正常多版本 / 一次性洗版(0060)
- v0.3.11 搜索详情与桌面黑边修复
- v0.3.12 列表分页、搜索历史、首页概况
- v0.3.13 统一整理弹窗与队列
- v0.3.14 原地入库(0061,未部署)
同批审计修复:
- 刮削入队:确认原记录存在后才删重放产生的新记录;写回 run 关联失败时保持 queued,
由处理器补关联(对齐 MP 先登记、只在入队失败时记失败)
- 识别升级链只在结果更确定时采用,不再用 no_match 顶替原有歧义候选
- bluray_dir 资产以原盘目录本身为刮削根(MP 同做法)
- metadata.resolve_organize 登记到入库排障 Skill 与能力地图
- db/src/types.ts 按迁移重新生成;contracts 整理动作枚举顺序与数据库对齐
- 测试:原地入库用例改为直接查记录表;domain 测试模板补 version
- 前端:通知铃铛弹层与用户菜单统一样式;站点卡片共用卡头、底栏贴底、分页间距
依赖升级证据只提交摘要文件,registry-snapshot.json 移至 .local/(SHA-256 记于文档)。
Co-Authored-By: Claude Opus 5.5 <[email protected]>
132 lines
5.4 KiB
TypeScript
132 lines
5.4 KiB
TypeScript
import type { SearchWork } from "@umt/contracts";
|
|
import { ArrowRight, Film, PackageSearch } from "lucide-react";
|
|
import { useState } from "react";
|
|
import { Link, useNavigate } from "react-router";
|
|
import { mediaServers } from "~/api/instances.ts";
|
|
import { useSearch } from "~/api/search.ts";
|
|
import { EmptyState, ErrorState, LoadingState } from "~/components/console/empty-state.tsx";
|
|
import { settingsPath } from "~/components/console/nav.ts";
|
|
import { useListPagination } from "~/components/console/use-list-pagination.ts";
|
|
import { Button } from "~/components/ui/button.tsx";
|
|
import { Pagination } from "~/components/ui/pagination.tsx";
|
|
import { actionIcon } from "./search-labels.ts";
|
|
import { SitePickerDialog } from "./site-picker-dialog.tsx";
|
|
import { releaseSearchPath, WorkCard, workRef } from "./work-card.tsx";
|
|
|
|
// 结果页第一阶段:作品(本地 + TMDB 合并,带库存对比)与操作;资源要点「搜索资源」选站点后才查(release-results.tsx)
|
|
|
|
function SectionTitle({ id, title, extra }: { id: string; title: string; extra?: string }) {
|
|
return (
|
|
<h2 id={id} className="mb-3 text-body font-semibold text-foreground">
|
|
{title}
|
|
{extra ? <span className="ml-2 text-caption font-normal text-muted-foreground tabular-nums">{extra}</span> : null}
|
|
</h2>
|
|
);
|
|
}
|
|
|
|
/** 「搜索资源」:先选站点,再跳到第二阶段(同一搜索页带 work / in 参数) */
|
|
export function useReleaseSearchLauncher() {
|
|
const navigate = useNavigate();
|
|
const [target, setTarget] = useState<{ title: string; ref: string } | null>(null);
|
|
return {
|
|
open: (t: { title: string; ref: string }) => setTarget(t),
|
|
dialog: (
|
|
<SitePickerDialog
|
|
open={!!target}
|
|
onOpenChange={(o) => !o && setTarget(null)}
|
|
title={target?.title ?? ""}
|
|
onConfirm={(ids) => target && navigate(releaseSearchPath(target, ids))}
|
|
/>
|
|
),
|
|
};
|
|
}
|
|
|
|
export function WorksSection({ q }: { q: string }) {
|
|
const res = useSearch(q, "media", 50);
|
|
const ms = mediaServers.useList();
|
|
const emby = (ms.data?.items ?? []).some((i) => (i as { enabled?: boolean }).enabled !== false);
|
|
const launcher = useReleaseSearchLauncher();
|
|
const works = res.data?.media?.works ?? [];
|
|
const paged = useListPagination(works, { resetKey: q });
|
|
const tmdb = res.data?.media?.tmdb;
|
|
const searchReleases = (w: SearchWork) => {
|
|
const ref = workRef(w);
|
|
if (ref) launcher.open({ title: w.title, ref });
|
|
};
|
|
return (
|
|
<section aria-labelledby="search-media" className="min-w-0">
|
|
<div className="mb-3 flex flex-wrap items-end justify-between gap-2">
|
|
<SectionTitle id="search-media" title="作品" extra={res.data ? `${works.length} 部` : undefined} />
|
|
<Button variant="ghost" size="sm" onClick={() => launcher.open({ title: q, ref: `q:${q}` })}>
|
|
<PackageSearch />
|
|
按关键词搜资源
|
|
</Button>
|
|
</div>
|
|
{res.isPending ? (
|
|
<LoadingState rows={3} className="pg-slab rounded-xl p-4" />
|
|
) : res.isError ? (
|
|
<div className="pg-slab rounded-xl">
|
|
<ErrorState plain error={res.error} onRetry={() => res.refetch()} />
|
|
</div>
|
|
) : works.length === 0 ? (
|
|
<div className="pg-slab rounded-xl">
|
|
<EmptyState
|
|
plain
|
|
icon={Film}
|
|
title="没有匹配的作品"
|
|
description="换个译名、原名或别名再搜;资源标题可以点「按关键词搜资源」。"
|
|
className="py-8"
|
|
/>
|
|
</div>
|
|
) : (
|
|
<div className="grid gap-3 md:grid-cols-2 xl:grid-cols-3">
|
|
{paged.items?.map((w) => (
|
|
<WorkCard key={w.key} w={w} emby={emby} onSearchReleases={searchReleases} />
|
|
))}
|
|
</div>
|
|
)}
|
|
{res.data ? <Pagination {...paged.pagination} /> : null}
|
|
{tmdb && !tmdb.configured ? (
|
|
<p className="mt-2 text-meta text-muted-foreground">
|
|
TMDB 未配置,只搜了本地作品。
|
|
<Link to={settingsPath("metadata")} className="ml-1 underline underline-offset-4">
|
|
去配置
|
|
</Link>
|
|
</p>
|
|
) : null}
|
|
{tmdb?.error ? <p className="mt-2 text-meta text-warning">TMDB 查询失败:{tmdb.error}</p> : null}
|
|
{launcher.dialog}
|
|
</section>
|
|
);
|
|
}
|
|
|
|
export function ActionsSection({ q }: { q: string }) {
|
|
const res = useSearch(q, "actions", 12);
|
|
const items = res.data?.actions?.items ?? [];
|
|
if (res.isPending || res.isError || items.length === 0) return null;
|
|
return (
|
|
<section aria-labelledby="search-actions" className="min-w-0">
|
|
<SectionTitle id="search-actions" title="操作" />
|
|
<div className="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
|
|
{items.map((a) => {
|
|
const Icon = actionIcon(a.kind);
|
|
return (
|
|
<Link
|
|
key={a.id}
|
|
to={a.href}
|
|
className="pg-slab flex min-w-0 items-center gap-3 rounded-xl px-4 py-3 transition-colors duration-micro hover:bg-foreground/[0.04]"
|
|
>
|
|
<Icon className="h-4 w-4 shrink-0 text-muted-foreground" />
|
|
<span className="min-w-0 flex-1">
|
|
<span className="block truncate text-sm font-medium text-foreground">{a.title}</span>
|
|
<span className="block truncate text-meta text-muted-foreground">{a.group}</span>
|
|
</span>
|
|
<ArrowRight className="h-4 w-4 shrink-0 text-muted-foreground" />
|
|
</Link>
|
|
);
|
|
})}
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|