2023-06-01 15:58:21 -04:00
|
|
|
import { FC } from 'react'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import Icon from './icon'
|
|
|
|
import { useLocation } from '../hooks/use-location'
|
|
|
|
import { DefaultMessage } from './default-message'
|
2024-10-11 05:23:33 -04:00
|
|
|
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
|
|
import MaterialIcon from './material-icon'
|
|
|
|
import OLButton from '@/features/ui/components/ol/ol-button'
|
2023-06-01 15:58:21 -04:00
|
|
|
|
|
|
|
export const GenericErrorBoundaryFallback: FC = ({ children }) => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { reload: handleClick } = useLocation()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="error-boundary-container">
|
2024-10-11 05:23:33 -04:00
|
|
|
<BootstrapVersionSwitcher
|
|
|
|
bs3={
|
|
|
|
<Icon
|
|
|
|
accessibilityLabel={`${t('generic_something_went_wrong')} ${t(
|
|
|
|
'please_refresh'
|
|
|
|
)}`}
|
|
|
|
type="exclamation-triangle fa-2x"
|
|
|
|
fw
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
bs5={
|
|
|
|
<MaterialIcon
|
|
|
|
accessibilityLabel={`${t('generic_something_went_wrong')} ${t(
|
|
|
|
'please_refresh'
|
|
|
|
)}`}
|
|
|
|
type="warning"
|
|
|
|
size="2x"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
/>
|
2023-06-01 15:58:21 -04:00
|
|
|
{children || (
|
2024-10-11 05:23:33 -04:00
|
|
|
<div className="error-message">
|
2023-06-01 15:58:21 -04:00
|
|
|
<DefaultMessage className="small" style={{ fontWeight: 'bold' }} />
|
|
|
|
</div>
|
|
|
|
)}
|
2024-10-11 05:23:33 -04:00
|
|
|
<OLButton variant="primary" onClick={handleClick}>
|
2023-06-01 15:58:21 -04:00
|
|
|
{t('refresh')}
|
2024-10-11 05:23:33 -04:00
|
|
|
</OLButton>
|
2023-06-01 15:58:21 -04:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|