mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
f7ef2532e0
* Only hide the compile logs pane when toggled off * Handle PDF preview on toggle between split and full-width views GitOrigin-RevId: 9ceca8a06a22abfa78f245e1ae5d24af98215906
67 lines
2.1 KiB
JavaScript
67 lines
2.1 KiB
JavaScript
import { useTranslation } from 'react-i18next'
|
|
import PreviewLogsPaneEntry from '../../preview/components/preview-logs-pane-entry'
|
|
import { memo } from 'react'
|
|
import classnames from 'classnames'
|
|
import PdfValidationIssue from './pdf-validation-issue'
|
|
import TimeoutUpgradePrompt from './timeout-upgrade-prompt'
|
|
import PdfPreviewError from './pdf-preview-error'
|
|
import PdfClearCacheButton from './pdf-clear-cache-button'
|
|
import PdfDownloadFilesButton from './pdf-download-files-button'
|
|
import PdfLogsEntries from './pdf-logs-entries'
|
|
import withErrorBoundary from '../../../infrastructure/error-boundary'
|
|
import ErrorBoundaryFallback from './error-boundary-fallback'
|
|
import PdfCodeCheckFailedNotice from '../../preview/components/pdf-code-check-failed-notice'
|
|
import PdfLogsPaneInfoNotice from '../../preview/components/pdf-logs-pane-info-notice'
|
|
import { useCompileContext } from '../../../shared/context/compile-context'
|
|
|
|
function PdfLogsViewer() {
|
|
const {
|
|
codeCheckFailed,
|
|
error,
|
|
logEntries,
|
|
rawLog,
|
|
validationIssues,
|
|
showLogs,
|
|
} = useCompileContext()
|
|
|
|
const { t } = useTranslation()
|
|
|
|
return (
|
|
<div className={classnames('logs-pane', { hidden: !showLogs })}>
|
|
<div className="logs-pane-content">
|
|
<PdfLogsPaneInfoNotice />
|
|
|
|
{codeCheckFailed && <PdfCodeCheckFailedNotice />}
|
|
|
|
{error && <PdfPreviewError error={error} />}
|
|
|
|
{error === 'timedout' && <TimeoutUpgradePrompt />}
|
|
|
|
{validationIssues &&
|
|
Object.entries(validationIssues).map(([name, issue]) => (
|
|
<PdfValidationIssue key={name} name={name} issue={issue} />
|
|
))}
|
|
|
|
{logEntries?.all && <PdfLogsEntries entries={logEntries.all} />}
|
|
|
|
{rawLog && (
|
|
<PreviewLogsPaneEntry
|
|
headerTitle={t('raw_logs')}
|
|
rawContent={rawLog}
|
|
entryAriaLabel={t('raw_logs_description')}
|
|
level="raw"
|
|
/>
|
|
)}
|
|
|
|
<div className="logs-pane-actions">
|
|
<PdfClearCacheButton />
|
|
<PdfDownloadFilesButton />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default withErrorBoundary(memo(PdfLogsViewer), () => (
|
|
<ErrorBoundaryFallback type="logs" />
|
|
))
|