import { useState, useCallback } from 'react'; import { motion } from 'motion/react'; import { VideoFilled, ShareFilled, } from '@/shared/icons/FilledIcons'; import { Button } from '@/shared/ui/button'; import { Input } from '@/shared/ui/input'; import { Textarea } from '@/shared/ui/textarea'; import { MOCK_CONTENT, INITIAL_CHANNELS } from '../data/distributionMocks'; // ─── 컴포넌트 ─── export default function DistributionPage() { const [channels, setChannels] = useState(INITIAL_CHANNELS); const [title, setTitle] = useState(MOCK_CONTENT.title); const [description, setDescription] = useState(MOCK_CONTENT.description); const [tags] = useState(MOCK_CONTENT.tags); const [scheduleMode, setScheduleMode] = useState<'now' | 'scheduled'>('now'); const [scheduleDate, setScheduleDate] = useState(''); const [scheduleHour, setScheduleHour] = useState(9); const [scheduleMinute, setScheduleMinute] = useState(0); const [schedulePeriod, setSchedulePeriod] = useState<'AM' | 'PM'>('AM'); const [isPublishing, setIsPublishing] = useState(false); const selectedChannels = channels.filter(c => c.connected && c.selected); const allPublished = selectedChannels.length > 0 && selectedChannels.every(c => c.status === 'published'); const toggleChannel = useCallback((id: string) => { setChannels(prev => prev.map(c => c.id === id && c.connected ? { ...c, selected: !c.selected } : c )); }, []); const handlePublish = useCallback(() => { setIsPublishing(true); // 순차 발행 시뮬레이션 const selected = channels.filter(c => c.connected && c.selected); selected.forEach((ch, i) => { setTimeout(() => { setChannels(prev => prev.map(c => c.id === ch.id ? { ...c, status: 'publishing' } : c )); }, i * 1500); setTimeout(() => { setChannels(prev => prev.map(c => c.id === ch.id ? { ...c, status: 'published' } : c )); if (i === selected.length - 1) setIsPublishing(false); }, (i + 1) * 1500 + 500); }); }, [channels]); return (
{/* Header */}

Content Distribution

콘텐츠 배포

제작된 콘텐츠를 연결된 채널에 동시 배포합니다.

{/* Left: Content Preview + Meta */}

콘텐츠

{/* Video Preview */}

{MOCK_CONTENT.aspectRatio}

{MOCK_CONTENT.duration}

{/* Title */}
setTitle(e.target.value)} className="w-full px-4 py-3 h-auto rounded-xl border-slate-200 text-sm text-slate-700 focus-visible:border-brand-purple-vivid focus-visible:ring-brand-purple-vivid/20" />
{/* Description */}