import PropTypes from 'prop-types'
import { useTranslation, Trans } from 'react-i18next'
import { memo } from 'react'
import PdfLogEntry from './pdf-log-entry'
function PdfPreviewError({ error }) {
const { t } = useTranslation()
switch (error) {
case 'rendering-error':
return (
{t('something_went_wrong_rendering_pdf')}
)
case 'clsi-maintenance':
return (
{t('clsi_maintenance')}
)
case 'clsi-unavailable':
return (
{t('clsi_unavailable')}
)
case 'too-recently-compiled':
return (
{t('too_recently_compiled')}
)
case 'terminated':
return (
{t('compile_terminated_by_user')}
)
case 'rate-limited':
return (
{t('project_flagged_too_many_compiles')}
)
case 'compile-in-progress':
return (
{t('pdf_compile_try_again')}
)
case 'auto-compile-disabled':
return (
{t('autocompile_disabled_reason')}
)
case 'project-too-large':
return (
{t('project_too_much_editable_text')}
)
case 'timedout':
return (
{t('proj_timed_out_reason')}
)
case 'failure':
return (
{t('no_pdf_error_explanation')}
- {t('no_pdf_error_reason_unrecoverable_error')}
-
}}
/>
-
}}
/>
)
case 'clear-cache':
return (
{t('somthing_went_wrong_compiling')}
)
case 'validation-problems':
return null // handled elsewhere
case 'error':
default:
return (
{t('somthing_went_wrong_compiling')}
)
}
}
PdfPreviewError.propTypes = {
error: PropTypes.string.isRequired,
}
export default memo(PdfPreviewError)
function ErrorLogEntry({ title, children }) {
const { t } = useTranslation()
return (
)
}
ErrorLogEntry.propTypes = {
title: PropTypes.string.isRequired,
children: PropTypes.any.isRequired,
}