diff --git a/src/JournalViewEntries.tsx b/src/JournalViewEntries.tsx index e4bfe42..6e0d174 100644 --- a/src/JournalViewEntries.tsx +++ b/src/JournalViewEntries.tsx @@ -1,5 +1,7 @@ import * as React from 'react'; import { List, ListItem } from 'material-ui/List'; +import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; import IconAdd from 'material-ui/svg-icons/content/add'; import IconDelete from 'material-ui/svg-icons/action/delete'; import IconEdit from 'material-ui/svg-icons/editor/mode-edit'; @@ -13,11 +15,20 @@ export class JournalViewEntries extends React.Component { prevUid: null, }; + state: { + dialog?: string; + }; + props: { journal: EteSync.Journal, entries: Array, }; + constructor(props: any) { + super(props); + this.state = {}; + } + render() { if (this.props.journal === undefined) { return (
Loading
); @@ -35,41 +46,59 @@ export class JournalViewEntries extends React.Component { icon = (); } + let name; + let uid; if (comp.name === 'vcalendar') { const vevent = new ICAL.Event(comp.getFirstSubcomponent('vevent')); - return ( - - ); + name = vevent.summary; + uid = vevent.uid; } else if (comp.name === 'vcard') { const vcard = comp; - const name = vcard.getFirstPropertyValue('fn'); - const uid = vcard.getFirstPropertyValue('uid'); - return ( - - ); + name = vcard.getFirstPropertyValue('fn'); + uid = vcard.getFirstPropertyValue('uid'); } else { - return ( - - ); + name = 'Error processing entry'; + uid = ''; } + return ( + { + this.setState({ + dialog: syncEntry.content + }); + }} + /> + ); }).reverse(); + const actions = [( + { + this.setState({dialog: undefined}); + }} + /> + ), + ]; return (
+ { + this.setState({dialog: undefined}); + }} + > +
{this.state.dialog}
+
{entries} diff --git a/src/api/EteSync.tsx b/src/api/EteSync.tsx index 32a5a42..d2b41ec 100644 --- a/src/api/EteSync.tsx +++ b/src/api/EteSync.tsx @@ -170,11 +170,13 @@ export enum SyncEntryAction { } export class SyncEntry { + uid?: string; action: SyncEntryAction; content: string; - constructor(json?: any) { + constructor(json?: any, uid?: string) { CastJson(json, this); + this.uid = uid; } } @@ -195,7 +197,7 @@ export class Entry extends BaseJournal { this._content = JSON.parse(cryptoManager.decrypt(this._encrypted)); } - return new SyncEntry(this._content); + return new SyncEntry(this._content, this.uid); } verify(cryptoManager: CryptoManager, prevUid: string | null) {