cluedin-widget
Version:
This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.
48 lines (39 loc) • 1.8 kB
JSX
import React, { Component } from 'react'
import iso from '../../../iso';
import config from '../../config'
import CluedInButton from '../generics/cluedinbutton.jsx';
import { FormattedMessage } from 'react-intl';
export default class DomainUser extends Component {
invite() {
const { domainUser, inviteClick } = this.props;
let email = domainUser.Properties.MetadataDictionary[ 'property-user.email' ];
let name = domainUser.Name;
inviteClick( email, name );
}
render() {
const { domainUser } = this.props;
let userClassName;
let content;
let inviteButtonContent;
let inviteMessage = <FormattedMessage id="DomainUser.Invite"></FormattedMessage>
if( domainUser.Properties && domainUser.Properties.MetadataDictionary && domainUser.Properties.MetadataDictionary[ 'property-user.email' ] ) {
inviteButtonContent = (
<div className="cluedIn_domainUsers_inviteBtn"><CluedInButton click={this.invite.bind(this)}
message={inviteMessage}></CluedInButton>
</div>
);
}
if( domainUser.PreviewUrl ) {
let imageUrl = iso.image.addTokenToImage( domainUser.PreviewUrl, config.token );
content = (<div><img className="cluedIn_domainUsers_profileImage"
src={imageUrl}/><strong>{domainUser.Name}</strong>
</div>);
} else {
userClassName = "cluedIn_domainUsers_noPreview";
content = <div><strong>{domainUser.Name}</strong></div>;
}
return <li className={userClassName}>
<div>{content}</div>
{inviteButtonContent}</li>;
}
}