2021-09-30 07:29:25 -04:00
|
|
|
import { memo, Suspense } from 'react'
|
2022-03-23 05:20:30 -04:00
|
|
|
import classNames from 'classnames'
|
2021-09-30 07:29:25 -04:00
|
|
|
import PdfLogsViewer from './pdf-logs-viewer'
|
|
|
|
import PdfViewer from './pdf-viewer'
|
2023-10-17 04:41:40 -04:00
|
|
|
import { FullSizeLoadingSpinner } from '../../../shared/components/loading-spinner'
|
2021-10-12 04:47:46 -04:00
|
|
|
import PdfHybridPreviewToolbar from './pdf-preview-hybrid-toolbar'
|
2022-03-31 07:22:36 -04:00
|
|
|
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
|
2022-09-01 04:44:47 -04:00
|
|
|
import { PdfPreviewMessages } from './pdf-preview-messages'
|
2024-04-15 05:33:46 -04:00
|
|
|
import CompileTimeWarningUpgradePrompt from './compile-time-warning-upgrade-prompt'
|
2023-09-28 05:56:45 -04:00
|
|
|
import { PdfPreviewProvider } from './pdf-preview-provider'
|
2021-10-12 04:47:46 -04:00
|
|
|
|
2021-09-03 05:06:28 -04:00
|
|
|
function PdfPreviewPane() {
|
2024-04-15 05:33:46 -04:00
|
|
|
const { pdfUrl, hasShortCompileTimeout } = useCompileContext()
|
2022-03-23 05:20:30 -04:00
|
|
|
const classes = classNames('pdf', 'full-size', {
|
|
|
|
'pdf-empty': !pdfUrl,
|
|
|
|
})
|
2021-09-30 07:29:25 -04:00
|
|
|
return (
|
2022-03-23 05:20:30 -04:00
|
|
|
<div className={classes}>
|
2023-09-28 05:56:45 -04:00
|
|
|
<PdfPreviewProvider>
|
|
|
|
<PdfHybridPreviewToolbar />
|
|
|
|
<PdfPreviewMessages>
|
2024-04-15 05:33:46 -04:00
|
|
|
{hasShortCompileTimeout && <CompileTimeWarningUpgradePrompt />}
|
2023-09-28 05:56:45 -04:00
|
|
|
</PdfPreviewMessages>
|
2023-10-17 04:41:40 -04:00
|
|
|
<Suspense fallback={<FullSizeLoadingSpinner delay={500} />}>
|
2023-09-28 05:56:45 -04:00
|
|
|
<div className="pdf-viewer">
|
|
|
|
<PdfViewer />
|
|
|
|
</div>
|
|
|
|
</Suspense>
|
|
|
|
<PdfLogsViewer />
|
|
|
|
</PdfPreviewProvider>
|
2021-09-30 07:29:25 -04:00
|
|
|
</div>
|
|
|
|
)
|
2021-09-03 05:06:28 -04:00
|
|
|
}
|
|
|
|
|
2021-10-06 04:33:24 -04:00
|
|
|
export default memo(PdfPreviewPane)
|