feat(web): 前端插槽设施,作品页与整理记录行挂「补字幕」
- lib/slots.ts 按位置注册(侧栏入口、作品页操作区 / 面板区、整理记录行操作、设置分区),默认直接显示; components/slots 挂载点:面板类直接渲染,动作类渲染成按钮 / 菜单项、对话框在菜单外渲染 - 作品页操作区与面板区、整理记录行菜单接入插槽;补字幕改由 features/subtitles.tsx 注册, 作品页按钮行为不变,整理记录行菜单新增「补字幕」(成功 / 部分成功的入库类整理) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
079c3eafe9
commit
62119a9b30
7 files changed
+313
-11
No files matched your search
@@ -0,0 +1,5 @@
|
||||
// 功能模块的前端插槽注册汇总(ADR-006)。新增功能:在本目录加 <功能>.tsx 导出 register(registry),在这里调用一次。
|
||||
import { slots } from "~/lib/slots.ts";
|
||||
import { registerSubtitles } from "./subtitles.tsx";
|
||||
|
||||
registerSubtitles(slots);
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Captions } from "lucide-react";
|
||||
import { SubtitleDialog } from "~/components/subtitles/subtitle-dialog.tsx";
|
||||
import type { SlotRegistry } from "~/lib/slots.ts";
|
||||
|
||||
// 补字幕(功能模块样板,ADR-006):作品页操作区「补字幕」、整理记录行菜单「补字幕」,都打开同一个补字幕对话框。
|
||||
|
||||
export function registerSubtitles(registry: SlotRegistry): void {
|
||||
registry.register("entity.actions", {
|
||||
id: "subtitles.entity",
|
||||
feature: "subtitles",
|
||||
label: "补字幕",
|
||||
icon: Captions,
|
||||
visible: ({ entity }) => entity.status !== "merged",
|
||||
Dialog: ({ entity, onClose }) => (
|
||||
<SubtitleDialog entityId={entity.id} title={entity.title} open onOpenChange={(o) => !o && onClose()} />
|
||||
),
|
||||
});
|
||||
registry.register("organize.record.actions", {
|
||||
id: "subtitles.record",
|
||||
feature: "subtitles",
|
||||
label: "补字幕",
|
||||
icon: Captions,
|
||||
// 入库成功(或部分成功)且认到作品的整理才有视频可配字幕
|
||||
visible: ({ record }) =>
|
||||
!!record.media &&
|
||||
(record.status === "succeeded" || record.status === "partial") &&
|
||||
["copy", "move", "in_place"].includes(record.action),
|
||||
Dialog: ({ record, onClose }) => (
|
||||
<SubtitleDialog
|
||||
entityId={record.media!.entityId}
|
||||
title={record.media!.title}
|
||||
open
|
||||
onOpenChange={(o) => !o && onClose()}
|
||||
/>
|
||||
),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user