import dynamic from "next/dynamic"; import { ReferenceIcon } from "@/components/lovart/reference-icon"; import { ModelIdentityIcon } from "@/components/lovart/model-identity-icon"; import { Lightbulb, Loader2, X } from "lucide-react"; import { useRef, type ChangeEvent } from "react"; import { Button } from "@/components/ui/button"; import { Select, SelectContent, SelectItem, SelectTrigger, } from "@/components/ui/select"; import { Textarea } from "@/components/ui/textarea"; import { cn } from "@/lib/utils"; import type { ModelOption, UploadFileItem } from "./types"; const HomeAnimationEmbed = dynamic( () => import("@/components/home/home-animation-embed").then( (module) => module.HomeAnimationEmbed ), { loading: () => (
), ssr: false, } ); type LovartHeroComposerProps = { composerPlaceholder: string; displayLogo: string; files: UploadFileItem[]; handleAddFiles: (files: FileList | null) => void; heroPromoActionText?: string | null; heroPromoText?: string | null; heroSubtitleText?: string | null; heroTitleText?: string | null; homeAnimationData?: { enabled?: boolean; htmlContent?: string; fileName?: string; }; isAgentModeActive: boolean; isMembershipEnabled: boolean; isSubmitting: boolean; onSubmit: () => void; openUpgradeDialog: () => void; prompt: string; removeFile: (id: string) => void; setPrompt: (value: string) => void; siteName: string; modelOptions: ModelOption[]; onModelChange: (modelId: string) => void; onStartAgentMode: () => void; selectedModelId: string; onOpenGallery: () => void; }; export function LovartHeroComposer({ composerPlaceholder, files, handleAddFiles, heroSubtitleText, heroTitleText, homeAnimationData, isAgentModeActive, isSubmitting, onSubmit, prompt, removeFile, setPrompt, siteName, modelOptions, onModelChange, onStartAgentMode, selectedModelId, onOpenGallery, }: LovartHeroComposerProps) { const textareaRef = useRef(null); const uploadRef = useRef(null); const suggestions = [ { label: "电商", icon: "commerce" as const, prompt: "为我的产品设计一张高转化的电商主图,突出产品卖点。", }, { label: "社交媒体", icon: "social" as const, prompt: "设计一张适合社交媒体发布的视觉海报。", }, { label: "品牌", icon: "branding" as const, prompt: "为我的品牌设计一套统一的视觉形象。", }, { label: "创意", icon: "creativity" as const, prompt: "创作一张富有想象力和视觉冲击力的创意作品。", }, { label: "网站", icon: "website" as const, prompt: "设计一个简洁、现代的网站首页视觉稿。", }, ]; return (

{heroTitleText || "你想设计什么?"}

{heroSubtitleText ? (

{heroSubtitleText}

) : null}