'use client' import type { ReactNode } from 'react' import { useTranslations } from 'next-intl' import TaskStatusInline from '@/components/task/TaskStatusInline' import { AppIcon } from '@/components/ui/icons' import type { TaskPresentationState } from '@/lib/task/presentation' import { MAX_VOICE_SCHEME_COUNT, MIN_VOICE_SCHEME_COUNT, normalizeVoiceSchemeCount, type GeneratedVoice, } from './voice-design-shared' const VOICE_PRESET_KEYS = [ 'maleBroadcaster', 'gentleFemale', 'matureMale', 'livelyFemale', 'intellectualFemale', 'narrator', ] as const type VoicePresetKey = (typeof VOICE_PRESET_KEYS)[number] interface VoiceDesignGeneratorSectionProps { voicePrompt: string onVoicePromptChange: (value: string) => void previewText: string onPreviewTextChange: (value: string) => void schemeCount: string onSchemeCountChange: (value: string) => void isSubmitting: boolean submittingState: TaskPresentationState | null error: string | null generatedVoices: GeneratedVoice[] selectedIndex: number | null onSelectIndex: (index: number) => void playingIndex: number | null onPlayVoice: (index: number) => void onGenerate: () => void footer?: ReactNode } export default function VoiceDesignGeneratorSection({ voicePrompt, onVoicePromptChange, previewText, onPreviewTextChange, schemeCount, onSchemeCountChange, isSubmitting, submittingState, error, generatedVoices, selectedIndex, onSelectIndex, playingIndex, onPlayVoice, onGenerate, footer = null, }: VoiceDesignGeneratorSectionProps) { const tv = useTranslations('voice.voiceDesign') const normalizedSchemeCount = normalizeVoiceSchemeCount(schemeCount) return ( <>
{tv('selectStyle')}
{VOICE_PRESET_KEYS.map((presetKey) => { const prompt = tv(`presetsPrompts.${presetKey}` as `presetsPrompts.${VoicePresetKey}`) return ( ) })}
{tv('orCustomDescription')}