import { Fragment, useState, type CSSProperties, type ReactNode } from "react"; import { Dropdown, Popover } from "antd"; import { AlignLeft, ArrowRight, Bot, Check, ChevronDown, ChevronUp, Clapperboard, FolderKanban, Images, MoreHorizontal, Palette, Pencil, Plus, Sparkles, Type, Upload, X } from "lucide-react"; import { canvasThemes } from "@/lib/canvas-theme"; import { CanvasCreateMenu, type CanvasCreateCommand } from "@/components/canvas/canvas-create-menu"; import type { CanvasShortDramaProgress, CanvasShortDramaStepId } from "@/lib/canvas/canvas-short-drama"; import { useThemeStore } from "@/stores/use-theme-store"; import type { CanvasNodeData } from "@/types/canvas"; export function CanvasLinkedProjectEmptyState({ projectName, hasChapter, onAddFirstChapter, onOpenAssets, onAddText }: { projectName: string; hasChapter: boolean; onAddFirstChapter: () => void; onOpenAssets: () => void; onAddText: () => void }) { const theme = canvasThemes[useThemeStore((state) => state.theme)]; return (

{projectName}

项目画布为空

); } export function CanvasShortDramaEmptyState({ onCreatePipeline, onOpenAgent, onStartFreeform, onUpload, onAddText, onAddScript }: { onCreatePipeline: () => void; onOpenAgent: () => void; onStartFreeform: () => void; onUpload: () => void; onAddText: () => void; onAddScript: () => void; }) { const theme = canvasThemes[useThemeStore((state) => state.theme)]; const focusStyle = { "--tw-ring-color": theme.accent.primary } as CSSProperties; return (

从哪里开始?

选择一条主路径,之后仍可随时切换。

} title="自己创作" description="搭好短剧骨架,再逐镜头编辑和生成。" action="创建短剧流水线" accent={theme.accent.primary} theme={theme} focusStyle={focusStyle} onClick={onCreatePipeline} /> } title="交给 Agent" description="用一句话描述题材、角色和核心冲突。" action="一句话生成影视项目" accent={theme.node.activeStroke} theme={theme} focusStyle={focusStyle} onClick={onOpenAgent} /> } title="自由空白画布" description="不预设流程,自由添加文本、图片、音频和视频。" action="从空白画布开始" accent={theme.node.muted} theme={theme} focusStyle={focusStyle} onClick={onStartFreeform} />
, label: "导入素材", onClick: onUpload }, { key: "text", icon: , label: "新建文本", onClick: onAddText }, { key: "storyboard", icon: , label: "新建空白分镜", onClick: onAddScript }, ], }} >
); } export function CanvasFreeformEmptyState({ commands }: { commands: CanvasCreateCommand[] }) { const theme = canvasThemes[useThemeStore((state) => state.theme)]; const [createOpen, setCreateOpen] = useState(false); const createCommands = commands.map((command) => ({ ...command, onClick: () => { setCreateOpen(false); command.onClick(); }, })); return (

自由空白画布

不预设流程,从任意一种素材开始创作。

event.stopPropagation()}>
} >

点击 + 添加文本、图片、视频、音频或导入素材

); } function PathCard({ icon, title, description, action, accent, theme, focusStyle, onClick }: { icon: ReactNode; title: string; description: string; action: string; accent: string; theme: (typeof canvasThemes)[keyof typeof canvasThemes]; focusStyle: CSSProperties; onClick: () => void; }) { return (
{icon}
{title}

{description}

); } export function CanvasShortDramaGuide({ progress, collapsed, onToggle, onSkip, onStepClick }: { progress: CanvasShortDramaProgress; collapsed: boolean; onToggle: () => void; onSkip: () => void; onStepClick: (stepId: CanvasShortDramaStepId) => void; }) { const theme = canvasThemes[useThemeStore((state) => state.theme)]; if (!progress.active || collapsed) return null; return (
{progress.steps.map((step, index) => ( {index ? ( ) : null} ))}
{!progress.completed ? : null}
); } export function CanvasStylePlaceholderNodeContent({ onChoose }: { onChoose: () => void }) { const theme = canvasThemes[useThemeStore((state) => state.theme)]; return (
项目画风
待选择
); } export function CanvasStoryInputNodeContent({ node, onEdit }: { node: CanvasNodeData; onEdit: () => void }) { const theme = canvasThemes[useThemeStore((state) => state.theme)]; const content = (node.metadata?.content || "").replace(/\s+/g, " ").trim(); return (
故事梗概
{content || "写下题材、角色、冲突和结局方向…"}
); }