overleaf/services/web/frontend/js/features/pdf-preview/components/pdf-preview-pane.js
Alexandre Bourdin d501bc4820 [web] Compile time warning split test (#8813)
* Implement compile time warning split test

* Add i18n for compile time warning

* Memoize CompileTimeWarning component

* Reuse startFreeTrial() function from account-upgrade

* Improve usage of react bootstrap native properties

* Cleanup compile-time-warning

* Move all logic into CompileTimeWarning component

* Only show compile time warning to project owners

* Handle compile time warning in detached mode and while switching layout

GitOrigin-RevId: 4fc40acfc113f91c81a6744c14c0f8b3ef766e39
2022-07-14 08:03:50 +00:00

39 lines
1.2 KiB
JavaScript

import { memo, Suspense } from 'react'
import classNames from 'classnames'
import CompileTimeWarning from './compile-time-warning'
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'
function PdfPreviewPane() {
const { pdfUrl } = useCompileContext()
const classes = classNames('pdf', 'full-size', {
'pdf-empty': !pdfUrl,
})
return (
<div className={classes}>
<PdfHybridPreviewToolbar />
<CompileTimeWarning />
<Suspense fallback={<LoadingPreview />}>
<div className="pdf-viewer">
<PdfViewer />
<FasterCompilesFeedback />
</div>
</Suspense>
<PdfLogsViewer />
</div>
)
}
function LoadingPreview() {
return (
<div className="pdf-loading-spinner-container">
<LoadingSpinner delay={500} />
</div>
)
}
export default memo(PdfPreviewPane)