diff --git a/src/ui/routes/MainRoute.tsx b/src/ui/routes/MainRoute.tsx index 33d99a9..825ce38 100644 --- a/src/ui/routes/MainRoute.tsx +++ b/src/ui/routes/MainRoute.tsx @@ -12,6 +12,7 @@ import { ListItemIcon, ListItemText, makeStyles, + MenuItem, Paper, Toolbar, Typography, @@ -24,6 +25,7 @@ import { Route, Switch, useHistory, + useRouteMatch, } from "react-router-dom"; import { AccountHelper } from "../../helpers/AccountHelper"; import { AccountSettingsRoute } from "./AccountSettingsRoute"; @@ -80,32 +82,42 @@ const useStyles = makeStyles((theme) => ({ })); function Menu() { - const history = useHistory(); - - const openHome = () => history.push("/"); - const openMyAccount = () => - history.push("/accounts/" + AccountHelper.currentAccount.id); - return (
- - - - - - - - - - - - + } uri="/" /> + } + uri={"/accounts/" + AccountHelper.currentAccount.id} + />
); } +function MainMenuItem(p: { + title: string; + icon: React.ReactNode; + uri: string; +}) { + const history = useHistory(); + const openMyAccount = () => history.push(p.uri); + + const selected = + useRouteMatch({ + path: p.uri, + exact: true, + }) != null; + + return ( + + {p.icon} + + + ); +} + export function MainRoute() { const classes = useStyles();