mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
a4992f6970
AI Error Assistant Feedback Notification GitOrigin-RevId: 340427cdca2db75b80f36a0b281af5403faa6f20
43 lines
1.6 KiB
JavaScript
43 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 { FullSizeLoadingSpinner } from '../../../shared/components/loading-spinner'
|
|
import PdfHybridPreviewToolbar from './pdf-preview-hybrid-toolbar'
|
|
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
|
|
import { PdfPreviewMessages } from './pdf-preview-messages'
|
|
import CompileTimeWarningUpgradePrompt from './compile-time-warning-upgrade-prompt'
|
|
import { PdfPreviewProvider } from './pdf-preview-provider'
|
|
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
|
|
|
const pdfPreviewPromotions = importOverleafModules('pdfPreviewPromotions')
|
|
|
|
function PdfPreviewPane() {
|
|
const { pdfUrl, hasShortCompileTimeout } = useCompileContext()
|
|
const classes = classNames('pdf', 'full-size', {
|
|
'pdf-empty': !pdfUrl,
|
|
})
|
|
return (
|
|
<div className={classes}>
|
|
<PdfPreviewProvider>
|
|
<PdfHybridPreviewToolbar />
|
|
<PdfPreviewMessages>
|
|
{pdfPreviewPromotions.map(
|
|
({ import: { default: Component }, path }) => (
|
|
<Component key={path} />
|
|
)
|
|
)}
|
|
{hasShortCompileTimeout && <CompileTimeWarningUpgradePrompt />}
|
|
</PdfPreviewMessages>
|
|
<Suspense fallback={<FullSizeLoadingSpinner delay={500} />}>
|
|
<div className="pdf-viewer">
|
|
<PdfViewer />
|
|
</div>
|
|
</Suspense>
|
|
<PdfLogsViewer />
|
|
</PdfPreviewProvider>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default memo(PdfPreviewPane)
|