d512cd2ac1
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1m30s
CI/CD Pipeline / Build Staging API Image (push) Successful in 4m51s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 1m19s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m32s
AI Code Review / AI Code Review (pull_request) Failing after 3m6s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m19s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 12m25s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m44s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 15m1s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 1m9s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 9m55s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 51s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 6m11s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 12m41s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 2m16s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m55s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m48s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 3m52s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 37m18s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 33m46s
CI/CD Pipeline / Unit Tests (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Build Production API Image (push) Has been cancelled
CI/CD Pipeline / Build Production Web Image (push) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Production (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / Canary Release to Production (push) Has been cancelled
CI/CD Pipeline / CI Gate (push) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 448h9m20s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 448h9m43s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 448h9m24s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 448h11m5s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 448h11m7s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 448h13m7s
CI/CD Pipeline / Frontend Lint (push) Failing after 448h15m19s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 448h16m20s
CI/CD Pipeline / PR Build Web Image (push) Failing after 448h13m9s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 448h19m4s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 448h19m8s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 448h26m9s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 448h43m23s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 448h44m18s
CI/CD Pipeline / PR Build API Image (push) Failing after 448h47m12s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 448h53m7s
84 lines
2.3 KiB
TypeScript
84 lines
2.3 KiB
TypeScript
/**
|
|
* GeneratePage 步骤导航
|
|
* 步骤顺序(6步):模板(1) → 素材(2) → 配音(3) → 标题(4) → 确认生成(5) → 封面(6)
|
|
*/
|
|
import { message } from "antd"
|
|
import type { TitleSettings } from "../types"
|
|
|
|
export interface UseStepNavigationOptions {
|
|
currentStep: number
|
|
setCurrentStep: (step: number | ((prev: number) => number)) => void
|
|
selectedTemplate: string
|
|
materialMode: "manual" | "auto"
|
|
selectedMaterials: string[]
|
|
smartSelectedIds: string[]
|
|
titleSettings: TitleSettings
|
|
/** 预览是否已就绪(素材已加载,可播放) */
|
|
previewReady: boolean
|
|
/** 是否已完成视频生成(步骤5确认生成后才能进入封面) */
|
|
generated: boolean
|
|
}
|
|
|
|
export interface UseStepNavigationReturn {
|
|
goNext: () => void
|
|
goPrev: () => void
|
|
}
|
|
|
|
export const useStepNavigation = (options: UseStepNavigationOptions): UseStepNavigationReturn => {
|
|
const {
|
|
currentStep,
|
|
setCurrentStep,
|
|
selectedTemplate,
|
|
materialMode,
|
|
selectedMaterials,
|
|
smartSelectedIds,
|
|
titleSettings,
|
|
previewReady,
|
|
generated,
|
|
} = options
|
|
|
|
const goNext = () => {
|
|
if (currentStep === 1 && !selectedTemplate) {
|
|
message.warning("请先选择一个模板")
|
|
return
|
|
}
|
|
if (currentStep === 2 && materialMode === "manual" && selectedMaterials.length === 0) {
|
|
message.warning("请至少选择一个素材")
|
|
return
|
|
}
|
|
if (currentStep === 2 && materialMode === "auto" && smartSelectedIds.length === 0) {
|
|
message.warning("请先进行智能匹配并选择素材")
|
|
return
|
|
}
|
|
// Step4(标题+预览):标题必填 + 预览必须已加载
|
|
if (currentStep === 4) {
|
|
if (!titleSettings.title.trim()) {
|
|
message.warning("请选择或输入标题")
|
|
return
|
|
}
|
|
if (!previewReady) {
|
|
message.warning("预览视频正在加载,请稍候")
|
|
return
|
|
}
|
|
}
|
|
// Step5(确认生成):必须已完成生成才能进入封面
|
|
if (currentStep === 5 && !generated) {
|
|
message.warning("请先生成视频")
|
|
return
|
|
}
|
|
if (currentStep < 6) {
|
|
setCurrentStep((s) => s + 1)
|
|
}
|
|
}
|
|
|
|
const goPrev = () => {
|
|
if (currentStep > 1) {
|
|
setCurrentStep((s) => s - 1)
|
|
}
|
|
}
|
|
|
|
return { goNext, goPrev }
|
|
}
|
|
|
|
export default useStepNavigation
|