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.
56 lines (43 loc) • 1.35 kB
JSX
import React, { Component } from 'react';
import StarRatingComponent from 'react-star-rating-component';
export const hasLastChangedBy = (entity) => {
return entity.data.lastChangedBy;
};
export class EntityLastChangedBy extends Component {
render() {
const { entity } = this.props;
let dateContent;
let location;
if (entity.data.modifiedDateFormatted) {
dateContent = (<span>{entity.data.modifiedDateFormatted}</span>);
}
if (entity.data.uris) {
const uris = entity.data.uris.filter((uri) => {
return uri.origin;
});
if (uris.length === 1) {
location = (
<span>in <a href={entity.data.uris[0].uri}>{entity.data.uris[0].origin}</a></span>
);
}
if (uris.length > 1) {
let locations = uris.map((uri, index) => {
let link = (<a href={uri.uri}>{uri.origin}</a>);
if (index === (uris.length-1)) {
return (<span key={index} >{link} </span>);
}
return (<span key={index} >{link}, </span>);
});
location = (<span>in {locations}</span>);
}
}
if (entity.data.lastChangedBy) {
return (
<div>
Last changed by {entity.data.lastChangedBy.name} {location} {dateContent}
</div>
);
}
return (<span></span>);
}
}