'use client' import React, { useMemo } from 'react' import { TaskObject } from '@/api/DTO/movieEdit' import { GlassIconButton } from '@/components/ui/glass-icon-button' import { Pencil, RotateCcw, Download, ArrowDownWideNarrow, Scissors, Maximize, Minimize, MessageCircleMore } from 'lucide-react' interface H5TaskInfoProps { /** 标题文案 */ title: string /** 当前分镜序号(从1开始) */ current: number /** 任务对象(用于读取总数等信息) */ taskObject: TaskObject /** video:聊天编辑 */ onEditWithChat?: () => void /** 下载:全部分镜 */ onDownloadAll?: () => void /** 下载:最终成片 */ onDownloadFinal?: () => void /** 下载:当前分镜视频 */ onDownloadCurrent?: () => void /** video:失败时显示重试 */ showRetry?: boolean onRetry?: () => void className?: string } const H5TaskInfo: React.FC = ({ title, current, taskObject, onEditWithChat, onDownloadAll, onDownloadFinal, onDownloadCurrent, showRetry, onRetry, className }) => { const total = useMemo(() => { if (taskObject.currentStage === 'video' || taskObject.currentStage === 'final_video') { return taskObject.videos?.total_count || taskObject.videos?.data?.length || 0 } if (taskObject.currentStage === 'scene' || taskObject.currentStage === 'character') { const rolesTotal = taskObject.roles?.total_count || taskObject.roles?.data?.length || 0 const scenesTotal = taskObject.scenes?.total_count || taskObject.scenes?.data?.length || 0 return rolesTotal + scenesTotal } return 0 }, [taskObject]) const shouldShowCount = taskObject.currentStage !== 'script' const displayCurrent = useMemo(() => { if (taskObject.currentStage === 'video' || taskObject.currentStage === 'final_video') { return Math.max(current, 1) } if (taskObject.currentStage === 'scene' || taskObject.currentStage === 'character') { const bounded = Math.min(Math.max(current, 1), Math.max(total, 1)) return bounded } return 0 }, [taskObject, current, total]) return (

{title || '...'}

{shouldShowCount && ( 分镜 {displayCurrent}/{Math.max(total, 1)} )}
{taskObject.currentStage === 'final_video' && (
)} {taskObject.currentStage === 'video' && (
{showRetry && ( )}
)}
) } export default H5TaskInfo