import PropTypes from 'prop-types' import { useTranslation, Trans } from 'react-i18next' import { memo, useCallback } from 'react' import { Button } from 'react-bootstrap' import PdfLogEntry from './pdf-log-entry' import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context' import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error' import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge' 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 case 'failure': return ( {t('no_pdf_error_explanation')} ) case 'clear-cache': return ( {t('somthing_went_wrong_compiling')} ) case 'pdf-viewer-loading-error': return ( , // eslint-disable-next-line jsx-a11y/anchor-has-content , // eslint-disable-next-line jsx-a11y/anchor-has-content , ]} /> ) 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, headerIcon, children }) { const { t } = useTranslation() return ( ) } ErrorLogEntry.propTypes = { title: PropTypes.string.isRequired, headerIcon: PropTypes.element, children: PropTypes.any.isRequired, } function TimedOutLogEntry() { const { t } = useTranslation() const { enableStopOnFirstError } = useStopOnFirstError({ eventSource: 'timeout', }) const { startCompile, lastCompileOptions, setAnimateCompileDropdownArrow } = useCompileContext() const handleEnableStopOnFirstErrorClick = useCallback(() => { enableStopOnFirstError() startCompile({ stopOnFirstError: true }) setAnimateCompileDropdownArrow(true) }, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow]) return (

{t('project_timed_out_intro')}

  • , ]} />
  • , ]} /> {!lastCompileOptions.stopOnFirstError && ( <> {' '} , ]} />{' '} )}

, ]} />

) } TimedOutLogEntry.propTypes = {}