Clean up the sidemenu.

master
Tom Hacohen 7 years ago
parent 25402639b6
commit 588bec69cc

@ -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 {
<SideMenuJournals
etesync={this.props.etesync}
journals={this.props.journals.value}
onItemClick={this.props.onCloseDrawerRequest}
onItemClick={(journalUid: string) => {
this.props.onCloseDrawerRequest();
this.props.history.push(routeResolver.getRoute('journals._id', { journalUid: journalUid }));
}}
/>
</React.Fragment>
);
@ -79,12 +82,14 @@ class SideMenu extends React.Component {
</div>
</div>
<List>
<NavLink
to={routeResolver.getRoute('home')}
exact={true}
>
<ListItem primaryText="Main" leftIcon={<ActionHome />} onClick={this.props.onCloseDrawerRequest} />
</NavLink>
<ListItem
primaryText="Main"
leftIcon={<ActionHome />}
onClick={() => {
this.props.onCloseDrawerRequest();
this.props.history.push(routeResolver.getRoute('home'));
}}
/>
{loggedInItems}
<Divider />
<Subheader>External Links</Subheader>

@ -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(
<ListItem key={journal.uid}>
<Link
to={routeResolver.getRoute('journals._id', { journalUid: journal.uid })}
onClick={this.props.onItemClick}
>
<ListItem key={journal.uid} onClick={() => this.props.onItemClick(journal.uid)}>
{info.displayName} ({journal.uid.slice(0, 5)})
</Link>
</ListItem>
);
}

Loading…
Cancel
Save