import React from 'react'; import { Account, Contact, AccountStore, ContactGroup } from 'mailspring-exports'; import { ContactProfilePhoto, RetinaImg } from 'mailspring-component-kit'; import * as Icons from './SVGIcons'; import { Store } from './Store'; import { ContactBase, ContactInteractorMetadata } from './ContactInfoMapping'; export const ContactDetailRead = ({ data, groups, contact, metadata, }: { data: ContactBase; groups: ContactGroup[]; contact: Contact; metadata: ContactInteractorMetadata; }) => { return (

{data.name.displayName}

{contact.contactGroups.map(gid => { const group = groups.find(g => g.id === gid); const label = group ? group.name : gid; return (
{ Store.setPerspective({ label, accountId: contact.accountId, groupId: gid, type: 'group', }); }} > {label}
); })}
{ }
); }; const ContactAttributes = ({ data, origin, account, }: { data: ContactBase; origin: string; account: Account; }) => (
{data.nicknames && (
{data.nicknames.map((item, idx) => (
{`“${item.value}”`}
))}
)} {(data.title || data.company) && (
{`${data.title ? `${data.title}, ` : ''}${data.company}`}
)} {data.emailAddresses && (
{data.emailAddresses.map((item, idx) => (
{item.value} {item.type &&
{item.type}
}
))}
)} {data.phoneNumbers && (
{data.phoneNumbers.map((item, idx) => (
{item.value} {item.type &&
{item.type}
}
))}
)} {data.addresses && (
{data.addresses.map((item, idx) => (
{item.formattedValue} {item.type &&
{item.type}
}
))}
)} {data.birthdays && (
{data.birthdays.map((item, idx) => (
{new Date(item.date.year, item.date.month - 1, item.date.day).toLocaleDateString()}
))}
)} {data.relations && (
{data.relations.map((item, idx) => (
{item.person} {item.type &&
{item.type}
}
))}
)} {data.urls && (
{data.urls.map((item, idx) => (
{item.value} {item.type &&
{item.type}
}
))}
)}
{`${origin} (${account ? account.label : 'Unknown Account'})`}
);