diff --git a/package-lock.json b/package-lock.json index bdf01257c5..52f1dfdddb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -129,6 +129,26 @@ "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", "dev": true }, + "@sourcefabric/common": { + "version": "0.0.43", + "resolved": "https://registry.npmjs.org/@sourcefabric/common/-/common-0.0.43.tgz", + "integrity": "sha512-45UWnNsc026jztBDI7u6HHmLqbJaZsIXV7Uui74W4ZydcuDFUJZSIREoQdrbkY1JU1zkNe5LoweukslYx7VI0A==", + "requires": { + "date-fns": "2.7.0", + "lodash": "4.17.19", + "primereact": "^6.0.2", + "react": "16.9.0", + "react-dom": "16.9.0", + "react-sortable-hoc": "^1.11.0" + }, + "dependencies": { + "date-fns": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.7.0.tgz", + "integrity": "sha512-wxYp2PGoUDN5ZEACc61aOtYFvSsJUylIvCjpjDOqM1UDaKIIuMJ9fAnMYFHV3TQaDpfTVxhwNK/GiCaHKuemTA==" + } + } + }, "@superdesk/build-tools": { "version": "file:build-tools", "dev": true, diff --git a/package.json b/package.json index 1fb8de65e5..621ab47336 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "dependencies": { "@metadata/exif": "github:superdesk/exif#431066d", "@popperjs/core": "2.10.2", + "@sourcefabric/common": "0.0.43", "@superdesk/common": "0.0.17", "@types/angular": "1.6.50", "@types/draft-js": "0.11.5", diff --git a/scripts/apps/contacts/components/ContactFooter.tsx b/scripts/apps/contacts/components/ContactFooter.tsx index 5d7564fc4e..1c21022186 100644 --- a/scripts/apps/contacts/components/ContactFooter.tsx +++ b/scripts/apps/contacts/components/ContactFooter.tsx @@ -13,7 +13,7 @@ interface IProps { */ export const ContactFooter: React.FunctionComponent = ({item}) => { return ( - + {gettext('Updated:')} diff --git a/scripts/apps/contacts/components/ContactInfo.tsx b/scripts/apps/contacts/components/ContactInfo.tsx index a22e5b28f8..bccca6f68f 100644 --- a/scripts/apps/contacts/components/ContactInfo.tsx +++ b/scripts/apps/contacts/components/ContactInfo.tsx @@ -1,10 +1,12 @@ +/* eslint-disable react/no-multi-comp */ import React from 'react'; import {ItemContainer} from 'apps/contacts/components'; import {ContactName, Notes, JobTitle} from 'apps/contacts/components/fields'; import {isEmpty, findKey} from 'lodash'; import {gettext} from 'core/utils'; import {IContact} from 'superdesk-api'; -import {ContentDivider, Icon, Spacer} from 'superdesk-ui-framework/react'; +import {ContentDivider, Icon, Spacer, SpacerBlock} from 'superdesk-ui-framework/react'; +import {WithDivider} from '@sourcefabric/common'; interface IProps { item: IContact; @@ -12,6 +14,12 @@ interface IProps { hideHeader?: boolean; } +const ContactDetail: React.FunctionComponent = ({children}: {children: Array}) => ( + + {children} + +); + /** * Media Contact Info - renders contact's information */ @@ -20,114 +28,92 @@ export const ContactInfo: React.FunctionComponent = ({ showIfContactIsInactive, hideHeader, }) => { - const meta = []; - const info = []; - const contactJobTitle = item.job_title ? : null; const contactOrg = item.first_name && item.organisation ? {item.organisation} : null; - if (hideHeader != true) { - info.push( - -
- -
-

- - {contactJobTitle && {contactJobTitle}} -

-
- {contactOrg} - {!item.is_active && showIfContactIsInactive && ( - + { + hideHeader !== true && ( + +
- {gettext('Inactive')} - - )} -
-
, - ); - } + +
+

+ + {contactJobTitle && {contactJobTitle}} +

+
+ {contactOrg} + {!item.is_active && showIfContactIsInactive && ( + + {gettext('Inactive')} + + )} +
+
+ ) + } - meta.push( - - - - - {!isEmpty(item.contact_email) && ()} - - - , - ); + + + + + + )} + > + + + {!isEmpty(item.contact_email) && ()} + - meta.push( - - - - {!isEmpty(item.contact_phone) && findKey(item.contact_phone, 'number') && - () - } - - - , - ); + + + {!isEmpty(item.contact_phone) && findKey(item.contact_phone, 'number') && + () + } + - meta.push( - - - - {item.website && ()} - - - , - ); + + + {item.website && ()} + - meta.push( - - - - {!isEmpty(item.mobile) && findKey(item.mobile, 'number') && - () - } - - - , - ); + + + {!isEmpty(item.mobile) && findKey(item.mobile, 'number') && + () + } + - meta.push( - - - - {item && ()} - - - , - ); + + + {item && ()} + - info.push( - - {meta} - - - {item.notes && ()} - - , - ); - - return ( -
{info}
+ + + {item.notes && ()} + +
+ ); }; diff --git a/scripts/apps/contacts/components/fields/SocialInfo.tsx b/scripts/apps/contacts/components/fields/SocialInfo.tsx index 6178c19aed..22a4c73796 100644 --- a/scripts/apps/contacts/components/fields/SocialInfo.tsx +++ b/scripts/apps/contacts/components/fields/SocialInfo.tsx @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {ItemContainer} from 'apps/contacts/components'; +import {Spacer} from 'superdesk-ui-framework/react'; /** * SocialInfo - to display facebook, twitter etc. information of a contact @@ -10,7 +11,9 @@ export const SocialInfo: React.StatelessComponent = ({item}) => { return (
- {keys.map((k) => (item[k] && ))} + + {keys.map((k) => (item[k] && ))} +
); };