"use client"; import { GlobalOutlined, ClockCircleOutlined, DownOutlined } from '@ant-design/icons'; import { WandSparkles, RectangleHorizontal, RectangleVertical } from 'lucide-react'; import { Dropdown, Tooltip } from 'antd'; import { LanguageOptions, VideoDurationOptions } from './config-options'; import type { ConfigOptions, LanguageValue, VideoDurationValue } from './config-options'; import { PortraitAnimeSelector } from './PortraitAnimeSelector'; interface ConfigPanelProps { /** Current configuration options */ configOptions: ConfigOptions; /** Handler for configuration changes */ onConfigChange: (key: K, value: ConfigOptions[K], exclude?: boolean) => void; /** Whether it's mobile device */ isMobile?: boolean; /** Whether it's desktop device */ isDesktop?: boolean; /** Whether to disable duration selection */ disableDuration?: boolean; } /** * Configuration panel component for video creation settings. * Includes language, auto script, duration, and aspect ratio selectors. * @param {ConfigOptions} configOptions - current configuration * @param {Function} onConfigChange - handler for config changes * @param {boolean} isMobile - whether it's mobile device * @param {boolean} isDesktop - whether it's desktop device * @returns {JSX.Element} */ export const ConfigPanel = ({ configOptions, onConfigChange, isMobile = false, isDesktop = true, disableDuration = false, }: ConfigPanelProps) => { /** Language dropdown menu items */ const languageMenuItems = LanguageOptions.map((option) => ({ key: option.value, label: {option.label}, })); /** Duration dropdown menu items */ const durationMenuItems = VideoDurationOptions.map((option) => ({ key: option.value, label: {option.label}, })); const currentLanguage = LanguageOptions.find((option) => option.value === configOptions.language); const currentDuration = configOptions.videoDuration === 'unlimited' ? 'auto' : configOptions.videoDuration; return (
{/* Language selector */} onConfigChange('language', key as LanguageValue), className: 'bg-[#1a1a1a] border border-white/10' }} trigger={['click']} > {/* Auto script toggle */} {/* Duration selector */} onConfigChange('videoDuration', key as VideoDurationValue), className: 'bg-[#1a1a1a] border border-white/10' }} trigger={['click']} disabled={disableDuration} > {/* Aspect ratio toggles */}
{/* Portrait/Anime selector */} onConfigChange('pcode', v, true)} />
); };