Implement a common interface for pim types.
parent
bfa186dc35
commit
074fc8e6c0
|
@ -13,7 +13,7 @@ import { pure } from 'recompose';
|
|||
|
||||
import { History } from 'history';
|
||||
|
||||
import { ContactType, EventType } from '../pim-types';
|
||||
import { PimType, ContactType, EventType } from '../pim-types';
|
||||
|
||||
import Container from '../widgets/Container';
|
||||
|
||||
|
@ -72,7 +72,7 @@ const ItemChangeLog = pure((props: any) => {
|
|||
uid,
|
||||
} = props;
|
||||
|
||||
const journalItem = syncInfo.get((items[uid] as any).journalUid);
|
||||
const journalItem = syncInfo.get(items[uid].journalUid);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
@ -94,9 +94,9 @@ const CollectionRoutes = withRouter(
|
|||
collections: Array<EteSync.CollectionInfo>,
|
||||
componentEdit: any,
|
||||
componentView: any,
|
||||
items: {[key: string]: any},
|
||||
onItemSave: (item: Object, journalUid: string, originalContact?: Object) => void;
|
||||
onItemDelete: (item: Object, journalUid: string) => void;
|
||||
items: {[key: string]: PimType},
|
||||
onItemSave: (item: PimType, journalUid: string, originalContact?: PimType) => void;
|
||||
onItemDelete: (item: PimType, journalUid: string) => void;
|
||||
onItemCancel: () => void;
|
||||
};
|
||||
|
||||
|
@ -204,7 +204,7 @@ class Pim extends React.PureComponent {
|
|||
this.onItemSave = this.onItemSave.bind(this);
|
||||
}
|
||||
|
||||
onItemSave(item: any, journalUid: string, originalEvent?: any) {
|
||||
onItemSave(item: PimType, journalUid: string, originalEvent?: PimType) {
|
||||
const syncJournal = this.props.syncInfo.get(journalUid);
|
||||
|
||||
if (syncJournal === undefined) {
|
||||
|
@ -221,7 +221,7 @@ class Pim extends React.PureComponent {
|
|||
});
|
||||
}
|
||||
|
||||
onItemDelete(item: any, journalUid: string) {
|
||||
onItemDelete(item: PimType, journalUid: string) {
|
||||
const syncJournal = this.props.syncInfo.get(journalUid);
|
||||
|
||||
if (syncJournal === undefined) {
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
import * as ICAL from 'ical.js';
|
||||
|
||||
export class EventType extends ICAL.Event {
|
||||
export interface PimType {
|
||||
uid: string;
|
||||
toIcal(): string;
|
||||
clone(): PimType;
|
||||
}
|
||||
|
||||
export class EventType extends ICAL.Event implements PimType {
|
||||
color: string;
|
||||
|
||||
static fromVCalendar(comp: ICAL.Component) {
|
||||
|
@ -33,7 +39,7 @@ export class EventType extends ICAL.Event {
|
|||
}
|
||||
}
|
||||
|
||||
export class ContactType {
|
||||
export class ContactType implements PimType {
|
||||
comp: ICAL.Component;
|
||||
|
||||
constructor(comp: ICAL.Component) {
|
||||
|
|
Loading…
Reference in New Issue