import PropTypes from 'prop-types' import { useTranslation, Trans } from 'react-i18next' import PreviewLogsPaneEntry from './preview-logs-pane-entry' import Icon from '../../../shared/components/icon' import { useEditorContext } from '../../../shared/context/editor-context' import StartFreeTrialButton from '../../../shared/components/start-free-trial-button' function PreviewError({ name }) { const { hasPremiumCompile, isProjectOwner } = useEditorContext({ isProjectOwner: PropTypes.bool, }) const { t } = useTranslation() let errorTitle let errorContent if (name === 'error') { errorTitle = t('server_error') errorContent = <>{t('somthing_went_wrong_compiling')}> } else if (name === 'renderingError') { errorTitle = t('pdf_rendering_error') errorContent = <>{t('something_went_wrong_rendering_pdf')}> } else if (name === 'clsiMaintenance') { errorTitle = t('server_error') errorContent = <>{t('clsi_maintenance')}> } else if (name === 'clsiUnavailable') { errorTitle = t('server_error') errorContent = <>{t('clsi_unavailable')}> } else if (name === 'tooRecentlyCompiled') { errorTitle = t('server_error') errorContent = <>{t('too_recently_compiled')}> } else if (name === 'compileTerminated') { errorTitle = t('terminated') errorContent = <>{t('compile_terminated_by_user')}> } else if (name === 'rateLimited') { errorTitle = t('pdf_compile_rate_limit_hit') errorContent = <>{t('project_flagged_too_many_compiles')}> } else if (name === 'compileInProgress') { errorTitle = t('pdf_compile_in_progress_error') errorContent = <>{t('pdf_compile_try_again')}> } else if (name === 'timedout') { errorTitle = t('timedout') errorContent = ( <> {t('proj_timed_out_reason')}
> ) } else if (name === 'autoCompileDisabled') { errorTitle = t('autocompile_disabled') errorContent = <>{t('autocompile_disabled_reason')}> } else if (name === 'projectTooLarge') { errorTitle = t('project_too_large') errorContent = <>{t('project_too_much_editable_text')}> } else if (name === 'failure') { errorTitle = t('no_pdf_error_title') errorContent = ( <>{t('free_accounts_have_timeout_upgrade_to_increase')}
{t('plus_upgraded_accounts_receive')}: