|
|
@ -1,6 +1,10 @@
|
|
|
|
import * as React from 'react';
|
|
|
|
import * as React from 'react';
|
|
|
|
import { Location, History } from 'history';
|
|
|
|
import { Location, History } from 'history';
|
|
|
|
import { Route, Switch } from 'react-router';
|
|
|
|
import { Route, Switch } from 'react-router';
|
|
|
|
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import IconButton from '@material-ui/core/IconButton';
|
|
|
|
|
|
|
|
import IconAdd from '@material-ui/icons/Add';
|
|
|
|
|
|
|
|
|
|
|
|
import Journal from './Journal';
|
|
|
|
import Journal from './Journal';
|
|
|
|
import JournalEdit from './JournalEdit';
|
|
|
|
import JournalEdit from './JournalEdit';
|
|
|
@ -10,7 +14,7 @@ import AppBarOverride from '../widgets/AppBarOverride';
|
|
|
|
import { routeResolver } from '../App';
|
|
|
|
import { routeResolver } from '../App';
|
|
|
|
|
|
|
|
|
|
|
|
import { store, JournalsData, UserInfoData, CredentialsData } from '../store';
|
|
|
|
import { store, JournalsData, UserInfoData, CredentialsData } from '../store';
|
|
|
|
import { addJournal, updateJournal } from '../store/actions';
|
|
|
|
import { addJournal, deleteJournal, updateJournal } from '../store/actions';
|
|
|
|
import { SyncInfo } from '../SyncGate';
|
|
|
|
import { SyncInfo } from '../SyncGate';
|
|
|
|
|
|
|
|
|
|
|
|
import * as EteSync from '../api/EteSync';
|
|
|
|
import * as EteSync from '../api/EteSync';
|
|
|
@ -40,7 +44,15 @@ class Journals extends React.PureComponent {
|
|
|
|
exact={true}
|
|
|
|
exact={true}
|
|
|
|
render={({ history }) => (
|
|
|
|
render={({ history }) => (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
<AppBarOverride title="Journals" />
|
|
|
|
<AppBarOverride title="Journals">
|
|
|
|
|
|
|
|
<IconButton
|
|
|
|
|
|
|
|
component={Link}
|
|
|
|
|
|
|
|
title="New"
|
|
|
|
|
|
|
|
{...{to: routeResolver.getRoute('journals.new')}}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<IconAdd />
|
|
|
|
|
|
|
|
</IconButton>
|
|
|
|
|
|
|
|
</AppBarOverride>
|
|
|
|
<JournalsList
|
|
|
|
<JournalsList
|
|
|
|
userInfo={this.props.userInfo}
|
|
|
|
userInfo={this.props.userInfo}
|
|
|
|
etesync={this.props.etesync}
|
|
|
|
etesync={this.props.etesync}
|
|
|
@ -50,6 +62,17 @@ class Journals extends React.PureComponent {
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Route
|
|
|
|
|
|
|
|
path={routeResolver.getRoute('journals.new')}
|
|
|
|
|
|
|
|
render={() => (
|
|
|
|
|
|
|
|
<JournalEdit
|
|
|
|
|
|
|
|
syncInfo={this.props.syncInfo}
|
|
|
|
|
|
|
|
onSave={this.onItemSave}
|
|
|
|
|
|
|
|
onDelete={this.onItemDelete}
|
|
|
|
|
|
|
|
onCancel={this.onCancel}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
<Route
|
|
|
|
path={routeResolver.getRoute('journals._id')}
|
|
|
|
path={routeResolver.getRoute('journals._id')}
|
|
|
|
render={({match}) => {
|
|
|
|
render={({match}) => {
|
|
|
@ -112,7 +135,13 @@ class Journals extends React.PureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onItemDelete(info: EteSync.CollectionInfo) {
|
|
|
|
onItemDelete(info: EteSync.CollectionInfo) {
|
|
|
|
return;
|
|
|
|
const journal = new EteSync.Journal();
|
|
|
|
|
|
|
|
const cryptoManager = new EteSync.CryptoManager(this.props.etesync.encryptionKey, info.uid);
|
|
|
|
|
|
|
|
journal.setInfo(cryptoManager, info);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
store.dispatch<any>(deleteJournal(this.props.etesync, journal)).then(() =>
|
|
|
|
|
|
|
|
this.props.history.push(routeResolver.getRoute('journals'))
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onCancel() {
|
|
|
|
onCancel() {
|
|
|
|