overleaf-cep/services/web/frontend/js/shared/components/generic-error-boundary-fallback.tsx
Tim Down 7abafb01ea Merge pull request #23940 from overleaf/td-react-18
Upgrade to React 18

GitOrigin-RevId: 9b81936e6eea2bccd97fe5c2c5841f0b946371b8
2025-05-02 08:05:29 +00:00

33 lines
977 B
TypeScript

import { FC } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocation } from '../hooks/use-location'
import { DefaultMessage } from './default-message'
import MaterialIcon from './material-icon'
import OLButton from '@/features/ui/components/ol/ol-button'
export const GenericErrorBoundaryFallback: FC<React.PropsWithChildren> = ({
children,
}) => {
const { t } = useTranslation()
const { reload: handleClick } = useLocation()
return (
<div className="error-boundary-container">
<MaterialIcon
accessibilityLabel={`${t('generic_something_went_wrong')} ${t(
'please_refresh'
)}`}
type="warning"
size="2x"
/>
{children || (
<div className="error-message">
<DefaultMessage className="small" style={{ fontWeight: 'bold' }} />
</div>
)}
<OLButton variant="primary" onClick={handleClick}>
{t('refresh')}
</OLButton>
</div>
)
}