import React from 'react'; import { useTranslation } from 'react-i18next'; export type UploadStatus = 'pending' | 'uploading' | 'completed' | 'failed'; interface UploadProgressModalProps { isOpen: boolean; onClose: () => void; status: UploadStatus; progress: number; videoTitle: string; channelName: string; youtubeUrl?: string; errorMessage?: string; isScheduled?: boolean; } const UploadProgressModal: React.FC = ({ isOpen, onClose, status, progress, videoTitle, channelName, youtubeUrl, errorMessage, isScheduled = false, }) => { const { t } = useTranslation(); if (!isOpen) return null; const getStatusText = () => { switch (status) { case 'pending': return t('upload.statusPending'); case 'uploading': return t('upload.statusUploading'); case 'completed': return isScheduled ? t('upload.statusScheduled') : t('upload.statusCompleted'); case 'failed': return t('upload.statusFailed'); default: return t('upload.statusDefault'); } }; const getStatusIcon = () => { switch (status) { case 'pending': case 'uploading': return (
); case 'completed': return (
); case 'failed': return (
); default: return null; } }; const canClose = status === 'completed' || status === 'failed'; return (
{/* Header */}

{isScheduled && status === 'completed' ? t('upload.titleScheduled') : t('upload.title')}

{canClose && ( )}
{/* Content */}
{/* Status Icon */} {getStatusIcon()} {/* Status Text */}

{getStatusText()}

{/* Progress Bar (only for pending/uploading) */} {(status === 'pending' || status === 'uploading') && (
{progress}%
)} {/* Video Info */}
{t('upload.videoTitleLabel')} {videoTitle}
{t('upload.channelLabel')} {channelName}
{/* Error Message */} {status === 'failed' && errorMessage && (

{errorMessage}

)} {/* Success: YouTube Link */} {status === 'completed' && youtubeUrl && ( YouTube {t('upload.viewOnYoutube')} )}
{/* Footer */}
{canClose ? ( ) : (

{t('upload.doNotClose')}

)}
); }; export default UploadProgressModal;