diff --git a/src/App.tsx b/src/App.tsx
index 703cc18..cd2e385 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -41,8 +41,12 @@ export function getPalette(part: string): string {
export const routeResolver = new RouteResolver({
home: '',
pim: {
- contacts: 'contacts/:contactUid',
- events: 'events/:contactUid',
+ contacts: {
+ _id: ':contactUid',
+ },
+ events: {
+ _id: ':eventUid',
+ },
},
journals: {
_id: {
diff --git a/src/Pim.tsx b/src/Pim.tsx
index 8bb1112..578e229 100644
--- a/src/Pim.tsx
+++ b/src/Pim.tsx
@@ -1,10 +1,12 @@
import * as React from 'react';
-import { Tabs, Tab } from 'material-ui/Tabs';
+import { Route, Switch } from 'react-router';
import * as EteSync from './api/EteSync';
-import AddressBook from './AddressBook';
-import Calendar from './Calendar';
+import Contact from './Contact';
+import PimMain from './PimMain';
+
+import { routeResolver } from './App';
import { JournalsData, EntriesType, CredentialsData } from './store';
@@ -20,16 +22,6 @@ class Pim extends React.Component {
constructor(props: any) {
super(props);
- this.eventClicked = this.eventClicked.bind(this);
- this.contactClicked = this.contactClicked.bind(this);
- }
-
- eventClicked(contact: any) {
- // FIXME
- }
-
- contactClicked(contact: any) {
- // FIXME
}
render() {
@@ -73,14 +65,26 @@ class Pim extends React.Component {
let calendarItems = syncEntriesToCalendarItemMap(syncEntriesCalendar);
return (
-
-
-
-
-
-
-
-
+
+ (
+
+ )}
+ />
+ (
+
+ )}
+ />
+
);
}
}
diff --git a/src/PimMain.tsx b/src/PimMain.tsx
new file mode 100644
index 0000000..9155799
--- /dev/null
+++ b/src/PimMain.tsx
@@ -0,0 +1,50 @@
+import * as React from 'react';
+import { Tabs, Tab } from 'material-ui/Tabs';
+
+import * as ICAL from 'ical.js';
+
+import AddressBook from './AddressBook';
+import Calendar from './Calendar';
+
+import { routeResolver } from './App';
+
+class Pim extends React.Component {
+ props: {
+ contacts: Array,
+ events: Array,
+ history?: any,
+ };
+
+ constructor(props: any) {
+ super(props);
+ this.eventClicked = this.eventClicked.bind(this);
+ this.contactClicked = this.contactClicked.bind(this);
+ }
+
+ eventClicked(contact: any) {
+ // FIXME
+ }
+
+ contactClicked(contact: ICAL.Component) {
+ const uid = contact.getFirstPropertyValue('uid');
+
+ this.props.history.push(
+ routeResolver.getRoute('pim.contacts._id', { contactUid: uid }));
+ }
+
+ render() {
+
+ return (
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default Pim;