mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
03e1daa038
Error boundaries for React PDF viewer GitOrigin-RevId: 90052fc183f7ece8125ecfb0410a529cf905c13b
32 lines
837 B
JavaScript
32 lines
837 B
JavaScript
import { memo, Suspense } from 'react'
|
|
import PdfLogsViewer from './pdf-logs-viewer'
|
|
import PdfViewer from './pdf-viewer'
|
|
import { usePdfPreviewContext } from '../contexts/pdf-preview-context'
|
|
import PdfPreviewToolbar from './pdf-preview-toolbar'
|
|
import LoadingSpinner from '../../../shared/components/loading-spinner'
|
|
|
|
function PdfPreviewPane() {
|
|
const { showLogs } = usePdfPreviewContext()
|
|
|
|
return (
|
|
<div className="pdf full-size">
|
|
<PdfPreviewToolbar />
|
|
<Suspense fallback={<LoadingPreview />}>
|
|
<div className="pdf-viewer">
|
|
<PdfViewer />
|
|
</div>
|
|
</Suspense>
|
|
{showLogs && <PdfLogsViewer />}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
function LoadingPreview() {
|
|
return (
|
|
<div className="pdf-loading-spinner-container">
|
|
<LoadingSpinner />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default memo(PdfPreviewPane)
|