|
|
@@ -1,35 +1,10 @@
|
|
|
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 (
|
|
|
- <div className="pdf-error-alert">
|
|
|
- <Alert bsStyle="danger">
|
|
|
- {`${t('generic_something_went_wrong')}. ${t('please_refresh')}`}
|
|
|
- </Alert>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
// we create each instance of `<Trans/>` individually so `i18next-scanner` can detect hardcoded `i18nKey` values
|
|
|
let content
|
|
|
if (type === 'pdf') {
|
|
|
@@ -38,8 +13,11 @@ function ErrorBoundaryFallback({ type }) {
|
|
|
<p>{t('pdf_viewer_error')}</p>
|
|
|
<p>
|
|
|
<Trans
|
|
|
- i18nKey="try_recompile_project"
|
|
|
- components={[<a href="#" onClick={handleContactUsClick} />]} // eslint-disable-line react/jsx-key, jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid
|
|
|
+ i18nKey="try_recompile_project_or_troubleshoot"
|
|
|
+ components={[
|
|
|
+ // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
|
|
|
+ <a href="/learn/how-to/Resolving_access%2C_loading%2C_and_display_problems" />,
|
|
|
+ ]}
|
|
|
/>
|
|
|
</p>
|
|
|
</>
|
|
|
@@ -50,8 +28,11 @@ function ErrorBoundaryFallback({ type }) {
|
|
|
<p>{t('log_viewer_error')}</p>
|
|
|
<p>
|
|
|
<Trans
|
|
|
- i18nKey="try_recompile_project"
|
|
|
- components={[<a href="#" onClick={handleContactUsClick} />]} // eslint-disable-line react/jsx-key, jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid
|
|
|
+ i18nKey="try_recompile_project_or_troubleshoot"
|
|
|
+ components={[
|
|
|
+ // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
|
|
|
+ <a href="/learn/how-to/Resolving_access%2C_loading%2C_and_display_problems" />,
|
|
|
+ ]}
|
|
|
/>
|
|
|
</p>
|
|
|
</>
|
|
|
@@ -62,8 +43,11 @@ function ErrorBoundaryFallback({ type }) {
|
|
|
<p>{t('pdf_preview_error')}</p>
|
|
|
<p>
|
|
|
<Trans
|
|
|
- i18nKey="try_refresh_page"
|
|
|
- components={[<a href="#" onClick={handleContactUsClick} />]} // eslint-disable-line react/jsx-key, jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid
|
|
|
+ i18nKey="try_recompile_project_or_troubleshoot"
|
|
|
+ components={[
|
|
|
+ // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
|
|
|
+ <a href="/learn/how-to/Resolving_access%2C_loading%2C_and_display_problems" />,
|
|
|
+ ]}
|
|
|
/>
|
|
|
</p>
|
|
|
</>
|
|
|
@@ -73,10 +57,6 @@ function ErrorBoundaryFallback({ type }) {
|
|
|
return (
|
|
|
<div className="pdf-error-alert">
|
|
|
<Alert bsStyle="danger">{content}</Alert>
|
|
|
- <ContactUsModal
|
|
|
- show={showContactUsModal}
|
|
|
- handleHide={handleContactUsModalHide}
|
|
|
- />
|
|
|
</div>
|
|
|
)
|
|
|
}
|