import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Textarea } from '@/components/ui/textarea'; import { Label } from '@/components/ui/label'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; import { Plus, Trash2, ChevronUp, ChevronDown } from 'lucide-react'; import { nanoid } from 'nanoid'; import type { SceneOutline } from '@/lib/types/generation'; interface OutlinesEditorProps { outlines: SceneOutline[]; onChange: (outlines: SceneOutline[]) => void; onConfirm: () => void; onBack: () => void; isLoading?: boolean; } export function OutlinesEditor({ outlines, onChange, onConfirm, onBack, isLoading = false, }: OutlinesEditorProps) { const addOutline = () => { const newOutline: SceneOutline = { id: nanoid(8), type: 'slide', title: '', description: '', keyPoints: [], order: outlines.length + 1, }; onChange([...outlines, newOutline]); }; const updateOutline = (index: number, updates: Partial) => { const newOutlines = [...outlines]; newOutlines[index] = { ...newOutlines[index], ...updates }; onChange(newOutlines); }; const removeOutline = (index: number) => { const newOutlines = outlines.filter((_, i) => i !== index); // Update order newOutlines.forEach((outline, i) => { outline.order = i + 1; }); onChange(newOutlines); }; const moveOutline = (index: number, direction: 'up' | 'down') => { const newIndex = direction === 'up' ? index - 1 : index + 1; if (newIndex < 0 || newIndex >= outlines.length) return; const newOutlines = [...outlines]; [newOutlines[index], newOutlines[newIndex]] = [newOutlines[newIndex], newOutlines[index]]; // Update order newOutlines.forEach((outline, i) => { outline.order = i + 1; }); onChange(newOutlines); }; const updateKeyPoints = (index: number, keyPointsText: string) => { const keyPoints = keyPointsText .split('\n') .map((p) => p.trim()) .filter(Boolean); updateOutline(index, { keyPoints }); }; return (

场景大纲

共 {outlines.length} 个场景,可编辑、添加、删除或重排序

{outlines.map((outline, index) => (
{index + 1} updateOutline(index, { title: e.target.value })} placeholder="场景标题" className="flex-1" disabled={isLoading} />