16bc4f53bf
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m11s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1m15s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 1m34s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 2m15s
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m19s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m50s
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 (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (push) Successful in 3m54s
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 52s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 37s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 3m24s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 4m28s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 6m49s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 6m57s
AI Code Review / AI Code Review (pull_request) Failing after 6m8s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 8m41s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 6m24s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 50s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 3m30s
CI/CD Pipeline / Integration Tests (push) Successful in 4m4s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m29s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m35s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 12m56s
CI/CD Pipeline / Unit Tests (push) Successful in 13m13s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / CI Gate (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 / Canary Release to Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Successful in 13m1s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 13s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 7m15s
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
/**
|
|
* GeneratePage 步骤导航
|
|
* 管理步骤切换与各步骤的前置校验
|
|
* 步骤顺序:模板(1) → 素材(2) → 配音(3) → 标题(4) → 预览(5) → 封面(6) → 确认(7)
|
|
*
|
|
* 前端实时预览架构:Step5 无需等待服务器渲染
|
|
*/
|
|
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
|
|
}
|
|
|
|
export interface UseStepNavigationReturn {
|
|
goNext: () => void
|
|
goPrev: () => void
|
|
}
|
|
|
|
export const useStepNavigation = (options: UseStepNavigationOptions): UseStepNavigationReturn => {
|
|
const {
|
|
currentStep,
|
|
setCurrentStep,
|
|
selectedTemplate,
|
|
materialMode,
|
|
selectedMaterials,
|
|
smartSelectedIds,
|
|
titleSettings,
|
|
} = 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
|
|
}
|
|
if (currentStep === 4 && !titleSettings.title.trim()) {
|
|
message.warning("请选择或输入标题")
|
|
return
|
|
}
|
|
if (currentStep < 7) {
|
|
setCurrentStep((s) => s + 1)
|
|
}
|
|
}
|
|
|
|
const goPrev = () => {
|
|
if (currentStep > 1) {
|
|
setCurrentStep((s) => s - 1)
|
|
}
|
|
}
|
|
|
|
return { goNext, goPrev }
|
|
}
|
|
|
|
export default useStepNavigation
|