import React, { useEffect, useRef } from 'react'; import { Article } from '../types'; import { FileText } from 'lucide-react'; interface ReaderViewProps { article?: Article | null; } export const ReaderView: React.FC = ({ article }) => { const scrollRef = useRef(null); // Auto-scroll to active segment useEffect(() => { if (!article || article.status !== 'PLAYING') return; const activeEl = document.getElementById(`segment-${article.currentSegmentIndex}`); if (activeEl && scrollRef.current) { activeEl.scrollIntoView({ behavior: 'smooth', block: 'center' }); } }, [article?.currentSegmentIndex, article?.status]); if (!article) { return (

Select an article to read along

The text will appear here while you listen.

); } return (

{article.title}

{new URL(article.url).hostname}
{article.segments.length > 0 ? ( article.segments.map((segment, idx) => { const isActive = article.currentSegmentIndex === idx; return (
{segment.text}
); }) ) : ( // Loading State skeleton
{[1,2,3,4].map(i => (
))}

Extracting article content...

)}
); };