From 35b3ce7f95bcd1d1d873a6dd7d9fac77110c708f Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 18 Dec 2017 14:27:34 +0000 Subject: [PATCH] Add a button to show an item's (contact/event) change history Fixes #1 --- src/App.tsx | 2 ++ src/Pim/index.tsx | 81 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 564a42d..3568e94 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -53,6 +53,7 @@ export const routeResolver = new RouteResolver({ _id: { _base: ':contactUid', edit: 'edit', + log: 'log', }, new: 'new', }, @@ -60,6 +61,7 @@ export const routeResolver = new RouteResolver({ _id: { _base: ':eventUid', edit: 'edit', + log: 'log', }, new: 'new', }, diff --git a/src/Pim/index.tsx b/src/Pim/index.tsx index 5c7ea33..5764004 100644 --- a/src/Pim/index.tsx +++ b/src/Pim/index.tsx @@ -2,10 +2,12 @@ import * as React from 'react'; import { Route, Switch } from 'react-router'; import RaisedButton from 'material-ui/RaisedButton'; import IconEdit from 'material-ui/svg-icons/editor/mode-edit'; +import IconChangeHistory from 'material-ui/svg-icons/action/change-history'; import * as EteSync from '../api/EteSync'; import { createSelector } from 'reselect'; +import { pure } from 'recompose'; import { History } from 'history'; @@ -13,6 +15,7 @@ import { ContactType, EventType } from '../pim-types'; import Container from '../widgets/Container'; +import JournalEntries from '../components/JournalEntries'; import ContactEdit from '../components/ContactEdit'; import Contact from '../components/Contact'; import EventEdit from '../components/EventEdit'; @@ -65,6 +68,28 @@ const itemsSelector = createSelector( return { collectionsAddressBook, collectionsCalendar, addressBookItems, calendarItems }; }, ); + +const ItemChangeLog = pure((props: any) => { + const { + syncInfo, + items, + uid, + } = props; + + const journalItem = syncInfo.get((items[uid] as any).journalUid); + + return ( + +

Item Change History

+ +
+ ); +}); + class Pim extends React.PureComponent { props: { etesync: CredentialsData; @@ -151,16 +176,40 @@ class Pim extends React.PureComponent { )} /> + ( + + + + )} + /> ( -
+
+ } + onClick={() => + history.push(routeResolver.getRoute( + 'pim.contacts._id.log', + {contactUid: match.params.contactUid})) + } + /> + } onClick={() => history.push(routeResolver.getRoute( @@ -196,16 +245,40 @@ class Pim extends React.PureComponent { )} /> + ( + + + + )} + /> ( -
+
+ } + onClick={() => + history.push(routeResolver.getRoute( + 'pim.events._id.log', + {eventUid: match.params.eventUid})) + } + /> + } onClick={() => history.push(routeResolver.getRoute(