mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
04900349e6
GitOrigin-RevId: ac305633c7c0bc13f5f670b71890cfd30a3cbffd
50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
import { memo, Suspense } from 'react'
|
|
import classNames from 'classnames'
|
|
import PdfLogsViewer from './pdf-logs-viewer'
|
|
import PdfViewer from './pdf-viewer'
|
|
import LoadingSpinner from '../../../shared/components/loading-spinner'
|
|
import PdfHybridPreviewToolbar from './pdf-preview-hybrid-toolbar'
|
|
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
|
|
import FasterCompilesFeedback from './faster-compiles-feedback'
|
|
import { PdfPreviewMessages } from './pdf-preview-messages'
|
|
import CompileTimeWarning from './compile-time-warning'
|
|
import CompileTimeoutMessages from './compile-timeout-messages'
|
|
import { PdfPreviewProvider } from './pdf-preview-provider'
|
|
|
|
function PdfPreviewPane() {
|
|
const { pdfUrl, showNewCompileTimeoutUI } = useCompileContext()
|
|
const classes = classNames('pdf', 'full-size', {
|
|
'pdf-empty': !pdfUrl,
|
|
})
|
|
return (
|
|
<div className={classes}>
|
|
<PdfPreviewProvider>
|
|
<PdfHybridPreviewToolbar />
|
|
<PdfPreviewMessages>
|
|
{showNewCompileTimeoutUI ? (
|
|
<CompileTimeoutMessages />
|
|
) : (
|
|
<CompileTimeWarning />
|
|
)}
|
|
</PdfPreviewMessages>
|
|
<Suspense fallback={<LoadingPreview />}>
|
|
<div className="pdf-viewer">
|
|
<PdfViewer />
|
|
<FasterCompilesFeedback />
|
|
</div>
|
|
</Suspense>
|
|
<PdfLogsViewer />
|
|
</PdfPreviewProvider>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
function LoadingPreview() {
|
|
return (
|
|
<div className="pdf-loading-spinner-container">
|
|
<LoadingSpinner delay={500} />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default memo(PdfPreviewPane)
|