diff --git a/packages/ui/src/app/App.tsx b/packages/ui/src/app/App.tsx index 88a1bf82fd..74d1fd58c0 100644 --- a/packages/ui/src/app/App.tsx +++ b/packages/ui/src/app/App.tsx @@ -7,6 +7,7 @@ import '@/services/i18n' import { ImageReportNotification } from '@/app/components/ImageReportNotification' import { OnBoardingOverlay } from '@/app/components/OnboardingOverlay/OnBoardingOverlay' import { CouncilModule } from '@/app/pages/Council/CouncilModule' +import { ErrorPage } from '@/app/pages/ErrorPage' import { NotFound } from '@/app/pages/NotFound' import { BountyRoutes } from '@/bounty/constants' import { ConnectionStatus } from '@/common/components/ConnectionStatus' @@ -21,7 +22,7 @@ import { ProposalsRoutes } from '@/proposals/constants/routes' import { ValidatorsRoutes } from '@/validators/constants/routes' import { WorkingGroupsRoutes } from '@/working-groups/constants/routes' -import { ErrorFallback } from './components/ErrorFallback' +import { ModalErrorFallback, PageErrorFallback } from './components/ErrorFallback' import { ExtensionNotification } from './components/ExtensionWarning' import { NavBar } from './components/NavBar' import { SideBar } from './components/SideBar' @@ -50,7 +51,7 @@ export const App = () => { - + @@ -70,6 +71,7 @@ export const App = () => { + @@ -78,7 +80,7 @@ export const App = () => { - + diff --git a/packages/ui/src/app/components/ErrorFallback.tsx b/packages/ui/src/app/components/ErrorFallback.tsx index f651d0c1ec..7ea3d2778e 100644 --- a/packages/ui/src/app/components/ErrorFallback.tsx +++ b/packages/ui/src/app/components/ErrorFallback.tsx @@ -1,23 +1,42 @@ import React from 'react' +import { useHistory } from 'react-router-dom' -import { ButtonPrimary, ButtonsGroup } from '@/common/components/buttons' +import { ButtonGhost, ButtonPrimary, ButtonsGroup } from '@/common/components/buttons' import { FailureIcon } from '@/common/components/icons' import { Modal, ModalBody, ModalFooterComponent, ModalHeader } from '@/common/components/Modal' +import { useModal } from '@/common/hooks/useModal' interface FallbackProps { error: Error resetErrorBoundary: (...args: Array) => void } -export const ErrorFallback = ({ error, resetErrorBoundary }: FallbackProps) => { +export const PageErrorFallback = (props: FallbackProps) => { + const { push } = useHistory() + return push('/error')} /> +} + +export const ModalErrorFallback = (props: FallbackProps) => { + const { hideModal } = useModal() + return +} + +const ErrorFallback = ({ error, resetErrorBoundary, onClose }: FallbackProps & { onClose: () => void }) => { + const handleClose = () => { + onClose() + resetErrorBoundary() + } return ( - } title="Something went wrong" onClick={resetErrorBoundary} /> + } title="Something went wrong" onClick={handleClose} />
{error.message}
+ + Close + Try again diff --git a/packages/ui/src/app/pages/ErrorPage.tsx b/packages/ui/src/app/pages/ErrorPage.tsx new file mode 100644 index 0000000000..ed827575ee --- /dev/null +++ b/packages/ui/src/app/pages/ErrorPage.tsx @@ -0,0 +1,7 @@ +import React from 'react' + +import { PageLayout } from '@/app/components/PageLayout' + +export const ErrorPage = () => { + return Something went wrong} /> +}