Get rid of the useless HOC.

master
Tom Hacohen 7 years ago
parent e6778f5ace
commit 425923aa6a

@ -10,6 +10,8 @@ import JournalAddressBook from './JournalAddressBook';
import JournalCalendar from './JournalCalendar';
import LoadingIndicator from './LoadingIndicator';
import { syncEntriesToItemMap } from './journal-processors';
import { store, StoreState, JournalsData, EntriesType, CredentialsData, fetchEntries } from './store';
interface PropsType {
@ -71,7 +73,7 @@ class Journal extends React.Component {
itemsView = <JournalCalendar journal={journal} entries={syncEntries} />;
itemsTitle = 'Events';
} else if (collectionInfo.type === 'ADDRESS_BOOK') {
itemsView = <JournalAddressBook journal={journal} entries={syncEntries} />;
itemsView = <JournalAddressBook journal={journal} entries={syncEntriesToItemMap(syncEntries)} />;
itemsTitle = 'Contacts';
} else {
itemsView = <div>Unsupported type</div>;

@ -5,8 +5,6 @@ import * as ICAL from 'ical.js';
import * as EteSync from './api/EteSync';
import { syncEntryToEntriesProps } from './journal-processors';
import { routeResolver } from './App';
import AddressBook from './AddressBook';
@ -65,4 +63,4 @@ class JournalAddressBook extends React.Component {
}
}
export default syncEntryToEntriesProps(withRouter(JournalAddressBook));
export default withRouter(JournalAddressBook);

@ -1,5 +1,3 @@
import * as React from 'react';
import * as ICAL from 'ical.js';
import * as EteSync from './api/EteSync';
@ -22,21 +20,3 @@ export function syncEntriesToItemMap(entries: EteSync.SyncEntry[]) {
return items;
}
// FIXME: Figure out how to correctly use the props type
export function syncEntryToEntriesProps(WrappedComponent: any) {
return class extends React.Component {
props: any;
render() {
let items = syncEntriesToItemMap(this.props.entries);
return (
<WrappedComponent
{...this.props}
entries={items}
/>
);
}
};
}

Loading…
Cancel
Save