"use client"; import { useState } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Textarea } from '@/components/ui/textarea'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Checkbox } from '@/components/ui/checkbox'; import { ArrowLeft, ArrowRight, Edit, RefreshCw, Users, Play, Plus, X } from 'lucide-react'; interface GenerateChaptersStepProps { onNext: () => void; onPrevious: () => void; } const mockChapters = [ { id: 1, title: '夜空烟花秀:璀璨瞬间', content: '有没有想过,为什么烟花总能让我们突得那么开心?(停顿)当五颜六色的烟花在空中绽放时,人们会聚集在一起,眼睛睁得大大的。(停顿)每一次闪耀,每一次炸呼——都充满了魔力!(停顿)和朋友们一起在星空下看烟花,这许愿就是无与伦比的。', duration: '45s', selectedActors: [1], }, { id: 2, title: 'Core Concepts', content: 'Let\'s dive into the core concepts of artificial intelligence. We\'ll break down complex topics into digestible pieces that anyone can understand.', duration: '1m 20s', selectedActors: [2], }, { id: 3, title: 'Practical Applications', content: 'Now we\'ll examine real-world applications of AI technology across various industries and how they\'re transforming our daily lives.', duration: '1m 15s', selectedActors: [1, 3], }, { id: 4, title: 'Future Outlook', content: 'Finally, let\'s look ahead to the future of AI and what exciting developments we can expect in the coming years.', duration: '50s', selectedActors: [3], }, ]; const availableActors = [ { id: 1, name: 'Liu Wei 1.10x', voice: 'Professional Female', avatar: 'https://images.pexels.com/photos/774909/pexels-photo-774909.jpeg?auto=compress&cs=tinysrgb&w=100', }, { id: 2, name: 'Dr. Marcus Webb', voice: 'Expert Male', avatar: 'https://images.pexels.com/photos/1222271/pexels-photo-1222271.jpeg?auto=compress&cs=tinysrgb&w=100', }, { id: 3, name: 'Alex Rivera', voice: 'Enthusiastic Neutral', avatar: 'https://images.pexels.com/photos/1239291/pexels-photo-1239291.jpeg?auto=compress&cs=tinysrgb&w=100', }, { id: 4, name: 'Lisa Park', voice: 'Friendly Female', avatar: 'https://images.pexels.com/photos/1181686/pexels-photo-1181686.jpeg?auto=compress&cs=tinysrgb&w=100', }, ]; export function GenerateChaptersStep({ onNext, onPrevious }: GenerateChaptersStepProps) { const [chapters, setChapters] = useState(mockChapters); const [editingChapter, setEditingChapter] = useState(null); const handleChapterEdit = (chapterId: number, content: string) => { setChapters(chapters.map(ch => ch.id === chapterId ? { ...ch, content } : ch )); setEditingChapter(null); }; const handleActorToggle = (chapterId: number, actorId: number) => { setChapters(chapters.map(ch => { if (ch.id === chapterId) { const isSelected = ch.selectedActors.includes(actorId); const newSelectedActors = isSelected ? ch.selectedActors.filter(id => id !== actorId) : [...ch.selectedActors, actorId]; return { ...ch, selectedActors: newSelectedActors }; } return ch; })); }; const getSelectedActors = (chapterId: number) => { const chapter = chapters.find(ch => ch.id === chapterId); if (!chapter) return []; return availableActors.filter(actor => chapter.selectedActors.includes(actor.id)); }; return (
Generated Chapters & Actor Assignment
{chapters.length} Chapters

AI has automatically split your script into chapters and suggested actors for each section. You can edit the content and assign multiple actors as needed.

{chapters.map((chapter, index) => (

Chapter {index + 1}: {chapter.title}

{/* Left side - Chapter Content */}

Chapter Content

{editingChapter === chapter.id ? (