import { useState, useEffect } from 'react'; import { Download, FileText, Check, ExternalLink, Eye, Search, ChevronLeft, ChevronRight, ZoomIn, ZoomOut, BarChart3 } from 'lucide-react'; import { Document, Page, pdfjs } from 'react-pdf'; // Core PDF.js styles import 'react-pdf/dist/Page/AnnotationLayer.css'; import 'react-pdf/dist/Page/TextLayer.css'; // Configure PDF worker pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`; const MOBILE_BREAKPOINT = 1100; function DocumentPreview({ cv, textContent, isPdf, onDownloadCV, analysisResult, scoreBefore, job, onBack }) { const [isMobile, setIsMobile] = useState(window.innerWidth < MOBILE_BREAKPOINT); const [numPages, setNumPages] = useState(null); const [pageNumber, setPageNumber] = useState(1); const [scale, setScale] = useState(1.0); useEffect(() => { const handleResize = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT); window.addEventListener('resize', handleResize); return () => window.removeEventListener('resize', handleResize); }, []); function onDocumentLoadSuccess({ numPages }) { setNumPages(numPages); } const tone = analysisResult?.score >= 80 ? 'success' : 'warning'; const gained = scoreBefore != null && analysisResult?.score > scoreBefore ? analysisResult.score - scoreBefore : 0; // Optimization report sidebar (also the whole view on mobile) const report = (
Couldn't load the PDF preview.
Download instead