diff --git a/src/SideMenu.tsx b/src/SideMenu.tsx index 931bdc9..e178c95 100644 --- a/src/SideMenu.tsx +++ b/src/SideMenu.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { connect } from 'react-redux'; import { withRouter } from 'react-router'; -import { NavLink } from 'react-router-dom'; import { List, ListItem } from 'material-ui/List'; import Subheader from 'material-ui/Subheader'; import Divider from 'material-ui/Divider'; @@ -28,6 +27,7 @@ interface PropsType { interface PropsTypeInner extends PropsType { journals: JournalsType; + history: any; } class SideMenu extends React.Component { @@ -57,7 +57,10 @@ class SideMenu extends React.Component { { + this.props.onCloseDrawerRequest(); + this.props.history.push(routeResolver.getRoute('journals._id', { journalUid: journalUid })); + }} /> ); @@ -79,12 +82,14 @@ class SideMenu extends React.Component { - - } onClick={this.props.onCloseDrawerRequest} /> - + } + onClick={() => { + this.props.onCloseDrawerRequest(); + this.props.history.push(routeResolver.getRoute('home')); + }} + /> {loggedInItems} External Links diff --git a/src/SideMenuJournals.tsx b/src/SideMenuJournals.tsx index 6add32f..0453961 100644 --- a/src/SideMenuJournals.tsx +++ b/src/SideMenuJournals.tsx @@ -1,18 +1,16 @@ import * as React from 'react'; -import { Link } from 'react-router-dom'; import { ListItem } from 'material-ui/List'; import * as EteSync from './api/EteSync'; -import { routeResolver } from './App'; import { JournalsData, CredentialsData } from './store'; class SideMenuJournals extends React.Component { props: { etesync: CredentialsData; journals: JournalsData; - onItemClick: () => void; + onItemClick: (journalUid: string) => void; }; constructor(props: any) { @@ -38,13 +36,8 @@ class SideMenuJournals extends React.Component { let info = journal.getInfo(cryptoManager); ret[info.type] = ret[info.type] || []; ret[info.type].push( - - - {info.displayName} ({journal.uid.slice(0, 5)}) - + this.props.onItemClick(journal.uid)}> + {info.displayName} ({journal.uid.slice(0, 5)}) ); }