Unify the names of the props of ContactEdit and EventEdit.

master
Tom Hacohen 7 years ago
parent 40af8a49d7
commit 7bd3051416

@ -169,7 +169,7 @@ class Pim extends React.PureComponent {
<Container style={{maxWidth: 400}}>
<ContactEdit
initialCollection={(addressBookItems[match.params.itemUid] as any).journalUid}
contact={addressBookItems[match.params.itemUid]}
item={addressBookItems[match.params.itemUid]}
collections={collectionsAddressBook}
onSave={this.onContactSave}
/>
@ -238,7 +238,7 @@ class Pim extends React.PureComponent {
<Container style={{maxWidth: 400}}>
<EventEdit
initialCollection={(calendarItems[match.params.itemUid] as any).journalUid}
event={calendarItems[match.params.itemUid]}
item={calendarItems[match.params.itemUid]}
collections={collectionsCalendar}
onSave={this.onEventSave}
/>

@ -120,7 +120,7 @@ class ContactEdit extends React.PureComponent {
props: {
collections: Array<EteSync.CollectionInfo>,
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<any>) {
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 (
<React.Fragment>
<h2>
{this.props.contact ? 'Edit Contact' : 'New Contact'}
{this.props.item ? 'Edit Contact' : 'New Contact'}
</h2>
<form style={styles.form} onSubmit={this.onSubmit}>
<SelectField
style={styles.fullWidth}
value={this.state.journalUid}
floatingLabelText="Saving to"
disabled={this.props.contact !== undefined}
disabled={this.props.item !== undefined}
onChange={(contact: object, key: number, payload: any) => this.handleChange('journalUid', payload)}
>
{this.props.collections.map((x) => (

@ -31,7 +31,7 @@ class EventEdit extends React.PureComponent {
props: {
collections: Array<EteSync.CollectionInfo>,
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 (
<React.Fragment>
<h2>
{this.props.event ? 'Edit Event' : 'New Event'}
{this.props.item ? 'Edit Event' : 'New Event'}
</h2>
{this.state.error && (
<div>ERROR! {this.state.error}</div>
@ -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) => (

Loading…
Cancel
Save