import { isRouteErrorResponse, useNavigate, useRouteError } from 'react-router'; import { RainbowButton } from './buttons'; import { AnimatedDudeWithWire } from './graphics/dude'; import { LayoutWithSky } from './layout'; import { Routes } from '../../lib/links'; import { t } from '@vegaprotocol/i18n'; export const ErrorBoundary = () => { const error = useRouteError(); const navigate = useNavigate(); const title = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : 'Something went wrong'; const code = isRouteErrorResponse(error) ? error.status : 0; const messages: Record = { 0: 'An unknown error occurred.', 404: "The page you're looking for doesn't exists.", }; return (

{title}

{Object.keys(messages).includes(code.toString()) ? (

{messages[code]}

) : null}

navigate('..')} variant="border" className="text-xs" > {t('Go back and try again')}

); }; export const NotFound = () => { const navigate = useNavigate(); return (

{'Not found'}

{t("The page you're looking for doesn't exists.")}

navigate(Routes.REFERRALS)} variant="border" className="text-xs" > {t('Go back and try again')}

); };