import { useRef } from 'react';
import { useLang } from '../LanguageContext';
export default function VideoTranslationTab({
videoFile, handleVideoUpload,
videoSrcLang, setVideoSrcLang,
videoTgtLang, setVideoTgtLang,
burnSubtitles, setBurnSubtitles,
overlayVoice, setOverlayVoice,
isProcessingVideo, processVideo,
videoProgress, videoProgressText,
videoResult,
}) {
const { t } = useLang();
const videoFileInputRef = useRef(null);
return (
{t('video.from')}
{t('video.to')}
videoFileInputRef.current.click()}
style={{ padding: '2.5rem 2rem' }}
>
🎬
{t('video.browse')}
{t('video.supported')}
{videoFile && (
🎥
{videoFile.name} ({(videoFile.size / (1024 * 1024)).toFixed(2)} MB)
)}
{isProcessingVideo && (
🎞️ {t('common.processing')}
{videoProgress}%
{videoProgressText}
)}
{t('video.preview')}
{videoResult ? (
{videoResult.translated_srt.split('\n\n').filter(Boolean).map((block, idx) => {
const lines = block.split('\n');
const timing = lines[1] || '';
const text = lines.slice(2).join(' ') || '';
return (
{timing.split(' --> ')[0]?.slice(3, 8)} ➔ {timing.split(' --> ')[1]?.slice(3, 8)}
{text}
);
})}
) : (
)}
);
}