Skip to content

Commit

Permalink
feat: add page not found message
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Jul 7, 2022
1 parent a81a9c7 commit 2c1b381
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/widget/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AppProps, AppProvider } from './AppProvider';
import { AppContainer } from './components/AppContainer';
import { Header } from './components/Header';
import { Initializer } from './components/Initializer';
import { NotFound } from './components/NotFound';
import { MainPage } from './pages/MainPage';
import { SelectTokenPage } from './pages/SelectTokenPage';
import { SelectWalletPage } from './pages/SelectWalletPage';
Expand Down Expand Up @@ -48,6 +49,7 @@ export const AppDefault = () => {
element={<SwapPage />}
/>
<Route path={routes.swap} element={<SwapPage />} />
<Route path="*" element={<NotFound />} />
</Routes>
<Initializer />
</AppContainer>
Expand Down
21 changes: 21 additions & 0 deletions packages/widget/src/components/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Box, Typography } from '@mui/material';
import { useTranslation } from 'react-i18next';

export const NotFound: React.FC = () => {
const { t } = useTranslation();
return (
<Box
sx={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'column',
flex: 1,
padding: 3,
}}
>
<Typography variant="h6">{t('tooltip.notFound.title')}</Typography>
<Typography>{t('tooltip.notFound.text')}</Typography>
</Box>
);
};
4 changes: 4 additions & 0 deletions packages/widget/src/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@
"extensionNotFound": "Please make sure that only the {{name}} browser extension is active before choosing this wallet."
},
"tooltip": {
"notFound": {
"title": "Sorry 🥲",
"text": "We couldn't find this page."
},
"progressToNextUpdate": "Displayed data will auto-refresh after {{value}} seconds. Click this circle to update manually."
}
}

0 comments on commit 2c1b381

Please sign in to comment.