"use client"; import { useState, useRef } from 'react'; import { PhotoPreviewSection } from '../PhotoPreview'; import type { PhotoItem, PhotoType } from '../PhotoPreview/types'; import { PlusOutlined, UserOutlined, CameraOutlined, BulbOutlined, ArrowRightOutlined, SettingOutlined, } from '@ant-design/icons'; import { Dropdown, Menu } from 'antd'; import { ConfigPanel } from './ConfigPanel'; import { MobileConfigModal } from './MobileConfigModal'; import { defaultConfig } from './config-options'; import type { ConfigOptions } from './config-options'; import { useDeviceType } from '@/hooks/useDeviceType'; export default function VideoCreationForm() { const [photos, setPhotos] = useState([]); const [inputText, setInputText] = useState(''); const [configOptions, setConfigOptions] = useState(defaultConfig); const [configModalVisible, setConfigModalVisible] = useState(false); const { isMobile, isDesktop } = useDeviceType(); const characterInputRef = useRef(null); const sceneInputRef = useRef(null); const propInputRef = useRef(null); /** Handle photo deletion */ const handleDeletePhoto = (index: number) => { setPhotos(prevPhotos => prevPhotos.filter((_, i) => i !== index)); }; /** Handle file upload */ const handleFileUpload = (event: React.ChangeEvent, type: PhotoType) => { const files = event.target.files; if (!files || files.length === 0) return; const newPhotos: PhotoItem[] = Array.from(files).map((file, index) => ({ url: URL.createObjectURL(file), type, id: `${type}-${Date.now()}-${index}`, })); setPhotos(prevPhotos => [...prevPhotos, ...newPhotos]); event.target.value = ''; }; /** Handle configuration change */ const handleConfigChange = ( key: K, value: ConfigOptions[K] ) => { setConfigOptions(prev => ({ ...prev, [key]: value })); }; /** Handle video creation */ const handleCreate = () => { console.log({ text: inputText, photos, config: configOptions, }); // TODO: Implement video creation logic }; return (
{/* Main Content Area with Border */}
{/* Photo Preview Section - Top */} {photos.length > 0 && (
)} {/* Text Input Area - Middle */}