diff --git a/src/Contact.tsx b/src/Contact.tsx
index 626a3b0..b726697 100644
--- a/src/Contact.tsx
+++ b/src/Contact.tsx
@@ -19,39 +19,59 @@ class Contact extends React.Component {
}
const contact = this.props.contact;
- const uid = contact.comp.getFirstPropertyValue('uid');
- const name = contact.comp.getFirstPropertyValue('fn');
+ const name = contact.fn;
- const phoneNumbers = contact.comp.getAllProperties('tel').map((prop, idx) => {
- const json = prop.toJSON();
- const values = prop.getValues().map((val) => (
- }
- rightIcon={}
- href={'tel:' + val}
- primaryText={val}
- secondaryText={json[1].type}
- />
- ));
- return values;
- });
+ let lists = [];
- const emails = contact.comp.getAllProperties('email').map((prop, idx) => {
- const json = prop.toJSON();
- const values = prop.getValues().map((val) => (
- }
- href={'mailto:' + val}
- primaryText={val}
- secondaryText={json[1].type}
- />
- ));
- return values;
- });
+ function getAllType(
+ propName: string,
+ props: any,
+ valueToHref?: (value: string) => string,
+ primaryTransform?: (value: string) => string,
+ secondaryTransform?: (value: string) => string) {
+
+ return contact.comp.getAllProperties(propName).map((prop, idx) => {
+ const json = prop.toJSON();
+ const values = prop.getValues().map((val) => (
+
+ ));
+ return values;
+ });
+ }
+
+ lists.push(getAllType(
+ 'tel',
+ {
+ leftIcon: ,
+ rightIcon:
+ },
+ (x) => ('tel:' + x),
+ ));
- const skips = ['tel', 'email', 'prodid', 'uid', 'fn', 'n', 'version', 'photo'];
+ lists.push(getAllType(
+ 'email',
+ {
+ leftIcon: ,
+ },
+ (x) => ('mailto:' + x),
+ ));
+
+ lists.push(getAllType(
+ 'impp',
+ {
+ insetChildren: true,
+ },
+ (x) => x,
+ (x) => (x.substring(x.indexOf(':') + 1)),
+ ));
+
+ const skips = ['tel', 'email', 'impp', 'prodid', 'uid', 'fn', 'n', 'version', 'photo'];
const theRest = contact.comp.getAllProperties().filter((prop) => (
skips.indexOf(prop.name) === -1
)).map((prop, idx) => {
@@ -87,9 +107,11 @@ class Contact extends React.Component {
return (
{name}
- {uid}
- {listIfNotEmpty(phoneNumbers)}
- {listIfNotEmpty(emails)}
+ {lists.map((list, idx) => (
+
+ {listIfNotEmpty(list)}
+
+ ))}
{theRest}