diff --git a/src/Pim/index.tsx b/src/Pim/index.tsx index 2072f5a..e4a0c35 100644 --- a/src/Pim/index.tsx +++ b/src/Pim/index.tsx @@ -4,6 +4,8 @@ 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 { withRouter } from 'react-router'; + import * as EteSync from '../api/EteSync'; import { createSelector } from 'reselect'; @@ -90,6 +92,100 @@ const ItemChangeLog = pure((props: any) => { ); }); +const CollectionRoutes = withRouter( + class CollectionRoutesInner extends React.PureComponent { + props: { + syncInfo: SyncInfo, + routePrefix: string, + collections: Array, + componentEdit: any, + componentView: any, + items: {[key: string]: any}, + onItemSave: (item: Object, journalUid: string, originalContact?: Object) => void; + }; + + render() { + const props = this.props; + const ComponentEdit = props.componentEdit; + const ComponentView = props.componentView; + + return ( + + ( + + + + )} + /> + ( + + + + )} + /> + ( + + + + )} + /> + ( + +
+ } + onClick={() => + history.push(routeResolver.getRoute( + props.routePrefix + '._id.log', + {itemUid: match.params.itemUid})) + } + /> + + } + onClick={() => + history.push(routeResolver.getRoute( + props.routePrefix + '._id.edit', + {itemUid: match.params.itemUid})) + } + /> +
+ +
+ )} + /> +
+ ); + } + } +); + class Pim extends React.PureComponent { props: { etesync: CredentialsData; @@ -154,141 +250,31 @@ class Pim extends React.PureComponent { )} /> ( - - - - )} - /> - ( - - - - )} - /> - ( - - - - )} - /> - ( - -
- } - onClick={() => - history.push(routeResolver.getRoute( - 'pim.contacts._id.log', - {itemUid: match.params.itemUid})) - } - /> - - } - onClick={() => - history.push(routeResolver.getRoute( - 'pim.contacts._id.edit', - {itemUid: match.params.itemUid})) - } - /> -
- -
- )} - /> - ( - - - - )} - /> - ( - - - - )} - /> - ( - - - + path={routeResolver.getRoute('pim.contacts')} + render={() => ( + )} /> ( - -
- } - onClick={() => - history.push(routeResolver.getRoute( - 'pim.events._id.log', - {itemUid: match.params.itemUid})) - } - /> - - } - onClick={() => - history.push(routeResolver.getRoute( - 'pim.events._id.edit', - {itemUid: match.params.itemUid})) - } - /> -
- -
+ path={routeResolver.getRoute('pim.events')} + render={() => ( + )} />