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.
47 lines (37 loc) • 1.3 kB
JSX
import React, { Component } from 'react'
import { register } from "../../../core/registry";
import Widget from '../../../core/components/generics/widget.jsx'
import Conversation from '../../../core/components/generics/Conversation.jsx'
import { connect } from 'react-redux'
class EntityDiscussion extends Component {
render() {
const { isFetchingEntity, entity } = this.props;
let content;
let isDiscussion = false;
let descriptionMessages;
if( !isFetchingEntity ) {
try {
descriptionMessages = JSON.parse( entity.data.description );
isDiscussion = true;
} catch( e ) {
}
if( isDiscussion ) {
content = <Conversation messages={descriptionMessages}></Conversation>;
} else {
content = entity.data.description;
}
}
return (
<Widget loading={isFetchingEntity} title="Discussion Content">
{content}
</Widget>
);
}
}
function select( state ) {
return {
entity: state.entity.selectedEntity,
isFetchingEntity: state.entity.isFetchingEntity
};
}
register( 'EntityDiscussion', connect( select )( EntityDiscussion ) );