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'
|
2022-07-13 04:33:47 -04:00
|
|
|
import CompileTimeWarning from './compile-time-warning'
|
2021-09-30 07:29:25 -04:00
|
|
|
import PdfLogsViewer from './pdf-logs-viewer'
|
|
|
|
import PdfViewer from './pdf-viewer'
|
2021-10-06 04:33:24 -04:00
|
|
|
import LoadingSpinner 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-06-21 08:15:26 -04:00
|
|
|
import FasterCompilesFeedback from './faster-compiles-feedback'
|
2021-10-12 04:47:46 -04:00
|
|
|
|
2021-09-03 05:06:28 -04:00
|
|
|
function PdfPreviewPane() {
|
2022-03-23 05:20:30 -04:00
|
|
|
const { pdfUrl } = useCompileContext()
|
|
|
|
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}>
|
2022-03-25 05:45:50 -04:00
|
|
|
<PdfHybridPreviewToolbar />
|
2022-07-13 04:33:47 -04:00
|
|
|
<CompileTimeWarning />
|
2021-10-06 04:33:24 -04:00
|
|
|
<Suspense fallback={<LoadingPreview />}>
|
2021-09-30 07:29:25 -04:00
|
|
|
<div className="pdf-viewer">
|
|
|
|
<PdfViewer />
|
2022-06-21 08:15:26 -04:00
|
|
|
<FasterCompilesFeedback />
|
2021-09-30 07:29:25 -04:00
|
|
|
</div>
|
|
|
|
</Suspense>
|
2021-10-15 05:39:56 -04:00
|
|
|
<PdfLogsViewer />
|
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
|
|
|
function LoadingPreview() {
|
|
|
|
return (
|
|
|
|
<div className="pdf-loading-spinner-container">
|
2022-04-07 04:58:48 -04:00
|
|
|
<LoadingSpinner delay={500} />
|
2021-10-06 04:33:24 -04:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default memo(PdfPreviewPane)
|