import { useState, useCallback, useMemo } from 'react'; import { motion, AnimatePresence } from 'motion/react'; import { ChevronLeft, ChevronRight } from 'lucide-react'; import type { StudioState, StudioChannel, ContentFormat, AssetSourceType, MusicGenre, NarrationLanguage, NarrationVoice, GenerateOutputType } from '../../types/studio'; import { DEFAULT_SOUND } from '../../types/studio'; import ChannelFormatStep from './ChannelFormatStep'; import StrategySourceStep from './StrategySourceStep'; import SoundStudioStep from './SoundStudioStep'; import GeneratePreviewStep from './GeneratePreviewStep'; import BlogEditorStep from './BlogEditorStep'; interface StepDef { key: string; label: string; } const VIDEO_STEPS: StepDef[] = [ { key: 'channel', label: '채널 선택' }, { key: 'strategy', label: '전략 선택' }, { key: 'sound', label: '사운드' }, { key: 'generate', label: '생성' }, ]; const BLOG_STEPS: StepDef[] = [ { key: 'channel', label: '채널 선택' }, { key: 'strategy', label: '전략 선택' }, { key: 'blog', label: '콘텐츠 생성' }, ]; function isBlogChannel(channel: StudioChannel | null): boolean { return channel === 'naver_blog'; } export default function StudioWizard() { const [step, setStep] = useState(0); const [state, setState] = useState({ channel: null, format: null, pillarId: null, assetSources: [], sound: DEFAULT_SOUND, outputType: 'video', }); const steps = useMemo(() => isBlogChannel(state.channel) ? BLOG_STEPS : VIDEO_STEPS, [state.channel]); const setChannel = useCallback((channel: StudioChannel | null) => { setState(s => ({ ...s, channel, format: null, outputType: channel === 'naver_blog' ? 'image' : 'video', })); // Reset step if switching between blog/video flow setStep(0); }, []); const setFormat = useCallback((format: ContentFormat | null) => { setState(s => ({ ...s, format })); }, []); const setPillar = useCallback((pillarId: string | null) => { setState(s => ({ ...s, pillarId })); }, []); const toggleAssetSource = useCallback((source: AssetSourceType) => { setState(s => ({ ...s, assetSources: s.assetSources.includes(source) ? s.assetSources.filter(x => x !== source) : [...s.assetSources, source], })); }, []); const setGenre = useCallback((genre: MusicGenre) => { setState(s => ({ ...s, sound: { ...s.sound, genre, trackId: null } })); }, []); const setTrack = useCallback((trackId: string | null) => { setState(s => ({ ...s, sound: { ...s.sound, trackId } })); }, []); const setNarration = useCallback((enabled: boolean) => { setState(s => ({ ...s, sound: { ...s.sound, narrationEnabled: enabled } })); }, []); const setNarrationLang = useCallback((lang: NarrationLanguage) => { setState(s => ({ ...s, sound: { ...s.sound, narrationLanguage: lang } })); }, []); const setNarrationVoice = useCallback((voice: NarrationVoice) => { setState(s => ({ ...s, sound: { ...s.sound, narrationVoice: voice } })); }, []); const setSubtitle = useCallback((enabled: boolean) => { setState(s => ({ ...s, sound: { ...s.sound, subtitleEnabled: enabled } })); }, []); const setOutputType = useCallback((type: GenerateOutputType) => { setState(s => ({ ...s, outputType: type })); }, []); const currentStepKey = steps[step]?.key; const canProceed = (): boolean => { switch (currentStepKey) { case 'channel': return state.channel !== null && state.format !== null; case 'strategy': return state.pillarId !== null && state.assetSources.length > 0; case 'sound': return true; case 'generate': return true; case 'blog': return true; default: return false; } }; return (
{/* Progress Bar */}
{steps.map((s, i) => (
{i < steps.length - 1 && (
)}
))}
{/* Step Content */} {currentStepKey === 'channel' && ( )} {currentStepKey === 'strategy' && ( )} {currentStepKey === 'sound' && ( )} {currentStepKey === 'generate' && ( )} {currentStepKey === 'blog' && ( )} {/* Bottom Navigation */}
{step < steps.length - 1 ? ( ) : (
)}
); }