From 7bd3051416bea9ea9d03aa712d4140933eba547a Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 18 Dec 2017 15:04:59 +0000 Subject: [PATCH] Unify the names of the props of ContactEdit and EventEdit. --- src/Pim/index.tsx | 4 ++-- src/components/ContactEdit.tsx | 16 ++++++++-------- src/components/EventEdit.tsx | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Pim/index.tsx b/src/Pim/index.tsx index f68fc7e..2072f5a 100644 --- a/src/Pim/index.tsx +++ b/src/Pim/index.tsx @@ -169,7 +169,7 @@ class Pim extends React.PureComponent { @@ -238,7 +238,7 @@ class Pim extends React.PureComponent { diff --git a/src/components/ContactEdit.tsx b/src/components/ContactEdit.tsx index 31d4f63..4a1e213 100644 --- a/src/components/ContactEdit.tsx +++ b/src/components/ContactEdit.tsx @@ -120,7 +120,7 @@ class ContactEdit extends React.PureComponent { props: { collections: Array, initialCollection?: string, - contact?: ContactType, + item?: ContactType, onSave: (contact: ContactType, journalUid: string, originalContact?: ContactType) => void; }; @@ -140,8 +140,8 @@ class ContactEdit extends React.PureComponent { journalUid: '', }; - if (this.props.contact !== undefined) { - const contact = this.props.contact; + if (this.props.item !== undefined) { + const contact = this.props.item; this.state.uid = contact.uid; this.state.fn = contact.fn ? contact.fn : ''; @@ -248,8 +248,8 @@ class ContactEdit extends React.PureComponent { onSubmit(e: React.FormEvent) { e.preventDefault(); - let contact = (this.props.contact) ? - this.props.contact.clone() + let contact = (this.props.item) ? + this.props.item.clone() : new ContactType(new ICAL.Component(['vcard', [], []])) ; @@ -293,7 +293,7 @@ class ContactEdit extends React.PureComponent { setProperty('title', this.state.title); setProperty('note', this.state.note); - this.props.onSave(contact, this.state.journalUid, this.props.contact); + this.props.onSave(contact, this.state.journalUid, this.props.item); } render() { @@ -313,14 +313,14 @@ class ContactEdit extends React.PureComponent { return (

- {this.props.contact ? 'Edit Contact' : 'New Contact'} + {this.props.item ? 'Edit Contact' : 'New Contact'}

this.handleChange('journalUid', payload)} > {this.props.collections.map((x) => ( diff --git a/src/components/EventEdit.tsx b/src/components/EventEdit.tsx index 08a5332..5d10a43 100644 --- a/src/components/EventEdit.tsx +++ b/src/components/EventEdit.tsx @@ -31,7 +31,7 @@ class EventEdit extends React.PureComponent { props: { collections: Array, initialCollection?: string, - event?: EventType, + item?: EventType, onSave: (event: EventType, journalUid: string, originalEvent?: EventType) => void; }; @@ -48,8 +48,8 @@ class EventEdit extends React.PureComponent { journalUid: '', }; - if (this.props.event !== undefined) { - const event = this.props.event; + if (this.props.item !== undefined) { + const event = this.props.item; const allDay = event.startDate.isDate; let endDate = event.endDate.clone(); @@ -128,8 +128,8 @@ class EventEdit extends React.PureComponent { endDate.adjust(1, 0, 0, 0); } - let event = (this.props.event) ? - this.props.event.clone() + let event = (this.props.item) ? + this.props.item.clone() : new EventType() ; @@ -142,7 +142,7 @@ class EventEdit extends React.PureComponent { event.component.updatePropertyWithValue('last-modified', ICAL.Time.now()); - this.props.onSave(event, this.state.journalUid, this.props.event); + this.props.onSave(event, this.state.journalUid, this.props.item); } render() { @@ -162,7 +162,7 @@ class EventEdit extends React.PureComponent { return (

- {this.props.event ? 'Edit Event' : 'New Event'} + {this.props.item ? 'Edit Event' : 'New Event'}

{this.state.error && (
ERROR! {this.state.error}
@@ -180,7 +180,7 @@ class EventEdit extends React.PureComponent { style={styles.fullWidth} value={this.state.journalUid} floatingLabelText="Saving to" - disabled={this.props.event !== undefined} + disabled={this.props.item !== undefined} onChange={(event: object, key: number, payload: any) => this.handleChange('journalUid', payload)} > {this.props.collections.map((x) => (