import * as React from 'react'; import { AIGCVideo, ScheduledPost, SocialAccount } from '../types'; import { Icon } from './ui/Icon'; import { format, startOfMonth, endOfMonth, startOfWeek, endOfWeek, eachDayOfInterval, addMonths, subMonths, addWeeks, subWeeks, addDays, subDays, isSameMonth, isToday, parseISO, isPast, getDay, isSameDay } from 'date-fns'; import { useTranslation } from '../hooks/useI18n'; const initialSocialAccounts: SocialAccount[] = [ { id: 'tw', platform: 'Twitter', username: 'greenpage_ai', icon: Twitter }, { id: 'fb', platform: 'Facebook', username: 'GreenPageApp', icon: Facebook }, { id: 'ig', platform: 'Instagram', username: 'greenpage.ai', icon: Instagram }, ]; const CheckCircleIcon: React.FC<{ className?: string }> = ({ className }) => ( ); // --- MODAL COMPONENTS --- const SchedulePostModal: React.FC<{ video: AIGCVideo | null; post: ScheduledPost | null; date: string; accounts: SocialAccount[]; onClose: () => void; onSchedule: (post: Omit) => void; onUpdate: (post: ScheduledPost) => void; onDelete: (postId: string) => void; }> = ({ video, post, date, accounts, onClose, onSchedule, onUpdate, onDelete }) => { const { t, dateLocale } = useTranslation(); const [time, setTime] = React.useState(post ? post.time : '10:00'); const [caption, setCaption] = React.useState(post ? post.caption : (video ? `Check out our new video: ${video.title}!` : "")); const [selectedAccounts, setSelectedAccounts] = React.useState(post ? post.socialAccountIds : []); const handleAccountToggle = (accountId: string) => { setSelectedAccounts(prev => prev.includes(accountId) ? prev.filter(id => id !== accountId) : [...prev, accountId] ); }; const handleSubmit = () => { if (selectedAccounts.length === 0 || !time) { alert('Please select at least one social account and set a time.'); return; } if (post) { onUpdate({ ...post, time, caption, socialAccountIds: selectedAccounts }); } else if (video) { onSchedule({ videoId: video.id, date, time, caption, socialAccountIds: selectedAccounts }); } onClose(); }; if (!video) return null; return (
onClose()}>
e.stopPropagation()}>

{post ? t('aigc.scheduler.title') : t('aigc.scheduler.title')}

{`${t('for')} ${format(parseISO(date), 'MMMM d, yyyy', { locale: dateLocale })}`}

{video.title}

{video.title}

setTime(e.target.value)} className="w-full bg-gray-100 dark:bg-gray-700 p-2 rounded-md border border-gray-300 dark:border-gray-600"/>