import PropTypes from 'prop-types' import { Alert } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { useState } from 'react' import importOverleafModules from '../../../../macros/import-overleaf-module.macro' const [contactUsModalModules] = importOverleafModules('contactUsModal') const ContactUsModal = contactUsModalModules?.import.default function ErrorBoundaryFallback({ type }) { const { t } = useTranslation() const [showContactUsModal, setShowContactUsModal] = useState(false) function handleContactUsClick() { setShowContactUsModal(true) } function handleContactUsModalHide() { setShowContactUsModal(false) } if (!ContactUsModal) { return (
{`${t('generic_something_went_wrong')}. ${t('please_refresh')}`}
) } // we create each instance of `` individually so `i18next-scanner` can detect hardcoded `i18nKey` values let content if (type === 'pdf') { content = ( <>

{t('pdf_viewer_error')}

]} // eslint-disable-line react/jsx-key, jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid />

) } else if (type === 'logs') { content = ( <>

{t('log_viewer_error')}

]} // eslint-disable-line react/jsx-key, jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid />

) } else { content = ( <>

{t('pdf_preview_error')}

]} // eslint-disable-line react/jsx-key, jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid />

) } return (
{content}
) } ErrorBoundaryFallback.propTypes = { type: PropTypes.oneOf(['preview', 'pdf', 'logs']).isRequired, } export default ErrorBoundaryFallback