import React, { useState } from 'react'; import { TranscriptComparison, TranscriptComparisonData } from '@/components/transcript/TranscriptComparison'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Shield } from 'lucide-react'; import { TranscriptResult, TranscriptSource, ExtractionMethod, compareTranscriptQuality } from '@/types/transcript.types'; // Mock data for demonstration const createMockTranscriptResult = ( videoId: string, method: ExtractionMethod, transcript: string, wordCount: number, processingTime: number ): TranscriptResult => ({ videoId, transcript, segments: null, metadata: { wordCount, estimatedReadingTime: Math.ceil(wordCount / 200), language: 'en', hasTimestamps: false, extractionMethod: method, processingTimeSeconds: processingTime / 1000, qualityScore: method === ExtractionMethod.WHISPER_AUDIO ? 0.92 : 0.73, confidenceScore: method === ExtractionMethod.WHISPER_AUDIO ? 0.89 : 0.68 }, method, success: true, fromCache: false, error: null }); const mockYouTubeTranscript = `Welcome to our tutorial on advanced machine learning techniques. In todays session we'll explore deep learning algorithms and their practical applications. First lets discuss neural networks and how they process information. Neural networks are inspired by biological neural networks and consist of layers of interconnected nodes. These algorithms can recognize patterns in data and make predictions based on training data. Common applications include image recognition speech processing and natural language understanding. The key advantage of deep learning is its ability to learn complex representations automatically without requiring manual feature engineering.`; const mockWhisperTranscript = `Welcome to our tutorial on advanced machine learning techniques. In today's session, we'll explore deep learning algorithms and their practical applications. First, let's discuss neural networks and how they process information. Neural networks are inspired by biological neural networks and consist of layers of interconnected nodes. These algorithms can recognize patterns in data and make predictions based on training data. Common applications include image recognition, speech processing, and natural language understanding. The key advantage of deep learning is its ability to learn complex representations automatically without requiring manual feature engineering.`; export function TranscriptComparisonDemo() { const [selectedTranscript, setSelectedTranscript] = useState | null>(null); const [showComparison, setShowComparison] = useState(false); const youtubeResult = createMockTranscriptResult( 'dQw4w9WgXcQ', ExtractionMethod.YOUTUBE_API, mockYouTubeTranscript, 67, 3000 ); const whisperResult = createMockTranscriptResult( 'dQw4w9WgXcQ', ExtractionMethod.WHISPER_AUDIO, mockWhisperTranscript, 69, 45000 ); const comparisonData: TranscriptComparisonData = { youtubeTranscript: youtubeResult, whisperTranscript: whisperResult, comparison: compareTranscriptQuality(youtubeResult, whisperResult), highlightedDifferences: [ { type: 'modification', text: "today's vs todays", position: { start: 85, end: 92 }, significance: 'medium', category: 'punctuation' }, { type: 'modification', text: "let's vs lets", position: { start: 201, end: 206 }, significance: 'medium', category: 'punctuation' }, { type: 'addition', text: "Added commas in applications list", position: { start: 485, end: 520 }, significance: 'low', category: 'punctuation' } ] }; const handleSelectTranscript = (source: Exclude) => { setSelectedTranscript(source); console.log('Selected transcript source:', source); }; return (
{/* Header */}
Demo Mode

Transcript Comparison Demo

Preview the dual transcript comparison functionality

YouTube vs AI Whisper • Quality Analysis • Side-by-Side Comparison
{/* Demo Controls */} Demo Controls
{selectedTranscript && ( Selected: {selectedTranscript === 'youtube' ? '📺 YouTube' : '🎯 Whisper'} )}

Mock Data: This demo uses sample transcript data to demonstrate the comparison interface.

Features: Side-by-side comparison, quality metrics, difference highlighting, and transcript selection.

{/* Transcript Comparison */} {showComparison && ( )} {/* Selected Transcript Preview */} {selectedTranscript && ( {selectedTranscript === 'youtube' ? '📺' : '🎯'} Selected Transcript: {selectedTranscript === 'youtube' ? 'YouTube Captions' : 'AI Whisper'}
                    {selectedTranscript === 'youtube' ? mockYouTubeTranscript : mockWhisperTranscript}
                  
Word Count:

{selectedTranscript === 'youtube' ? youtubeResult.metadata?.wordCount : whisperResult.metadata?.wordCount}

Processing Time:

{selectedTranscript === 'youtube' ? '3.0s' : '45.0s'}

Quality Score:

{Math.round((selectedTranscript === 'youtube' ? 0.73 : 0.92) * 100)}%

Method:

{selectedTranscript === 'youtube' ? 'YouTube API' : 'Whisper AI'}

)}
); }