/** * Transcription Display Component * * Shows progressive transcription with: * - Yellow text for fixed sentences (completed, won't change) * - Cyan dim text for active transcription (in-progress) */ import { useEffect, useRef } from 'react'; export default function TranscriptionDisplay({ fixedText, activeText, timestamp, isRecording, autoScroll = true, onAutoScrollToggle }) { const containerRef = useRef(null); // Auto-scroll to bottom when new text appears (if enabled) useEffect(() => { if (autoScroll && containerRef.current) { containerRef.current.scrollTop = containerRef.current.scrollHeight; } }, [fixedText, activeText, autoScroll]); const formatTimestamp = (seconds) => { const mins = Math.floor(seconds / 60); const secs = (seconds % 60).toFixed(1); return `${mins}:${secs.padStart(4, '0')}`; }; return (
{/* Header */}

Live Transcription

{isRecording && (
Recording
)} {timestamp > 0 && ( {formatTimestamp(timestamp)} )}
{/* Transcription Text */}
{!fixedText && !activeText && !isRecording && (

Click "Start Recording" to begin transcription...

)} {!fixedText && !activeText && isRecording && (

Listening...

)} {/* Fixed text (yellow) - sentences that won't change */} {fixedText && ( {fixedText} )} {/* Space between fixed and active */} {fixedText && activeText && ' '} {/* Active text (cyan dim) - current partial transcription */} {activeText && ( {activeText} )}
{/* Legend + Auto-scroll Toggle */}
Fixed sentences
Active transcription
{/* Auto-scroll Toggle */} {onAutoScrollToggle && ( )}
{/* Technical Details */}

Smart progressive streaming: Growing window (0-15s) → Sentence-aware sliding (>15s)

); }