9a51cad137
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Successful in 48s
CI/CD Pipeline / Validate - Code Quality (push) Failing after 2m24s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m25s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m27s
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 3m8s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 3m16s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 1m20s
CI/CD Pipeline / Integration Tests (push) Successful in 3m53s
CI/CD Pipeline / Unit Tests (push) Failing after 7m53s
CI/CD Pipeline / Build Staging API Image (push) Successful in 11m29s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m13s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 26s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1m3s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m15s
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
/**
|
|
* Step 3 生成预览 Hook
|
|
* 封装预览信息的计算逻辑
|
|
*/
|
|
import { useMemo } from "react"
|
|
import type { EditingTemplate } from "@/api/editing-planner"
|
|
|
|
interface UseStep3PreviewProps {
|
|
templates: EditingTemplate[]
|
|
selectedTemplate: string
|
|
materialMode: "manual" | "auto"
|
|
selectedMaterials: string[]
|
|
smartSelectedIds: string[]
|
|
duration: number
|
|
videoRatio: string
|
|
}
|
|
|
|
export function useStep3Preview({
|
|
templates,
|
|
selectedTemplate,
|
|
materialMode,
|
|
selectedMaterials,
|
|
smartSelectedIds,
|
|
duration,
|
|
videoRatio,
|
|
}: UseStep3PreviewProps) {
|
|
const templateName = useMemo(
|
|
() => templates.find((t) => t.id === selectedTemplate)?.name ?? "未选择",
|
|
[templates, selectedTemplate],
|
|
)
|
|
|
|
const materialCount = useMemo(() => {
|
|
if (materialMode === "auto") {
|
|
return `${smartSelectedIds.length} 个素材(智能匹配)`
|
|
}
|
|
return `${selectedMaterials.length} 个素材`
|
|
}, [materialMode, selectedMaterials.length, smartSelectedIds.length])
|
|
|
|
return {
|
|
templateName,
|
|
materialCount,
|
|
duration,
|
|
videoRatio,
|
|
}
|
|
}
|
|
|
|
export default useStep3Preview
|