UNPKG

cluedin-widget

Version:

This is the project for creating and managing widgets in CluedIn.

57 lines (51 loc) 2.51 kB
import React, { Component } from 'react' import ProviderIcons from '../entityRelated/providerIcons.jsx' import EntityIcon from '../entityRelated/EntityIcon.jsx' import EntityLink from '../entityRelated/EntityLink.jsx' import EntityAuthors from '../entityRelated/EntityAuthors.jsx' import { makeNoValueRow, makePropHtml, findFromKey, makeLinkHtml, makeBadgeHtml } from '../../helpers/properties.jsx' import EntityValueRow from '../entityRelated/EntityValueRow.jsx' let noStatus = makeNoValueRow( 'Status' ); let noPriority = makeNoValueRow( 'Priority' ); let noUrl = makeNoValueRow( 'Url' ); let noChannel = makeNoValueRow( 'Channel' ); let noMailProp = makeNoValueRow( 'From Email' ); let noNameProp = makeNoValueRow( 'From Name' ); export default class Issue extends Component { render() { const { entity } = this.props; let statusProp = findFromKey( entity.properties, 'status' ); let channel = findFromKey( entity.properties, 'channel' ); let statusHtml = statusProp ? makeBadgeHtml( statusProp ) : noStatus; let channelHtml = channel ? makePropHtml( channel ) : noChannel; return ( <div className="cluedIn_entity_row"> <div className="cluedIn_entity_row_sub"> <ProviderIcons providers={entity.providers}></ProviderIcons> <EntityIcon entityType={entity.data.entityType}></EntityIcon> <EntityLink entity={entity}></EntityLink> </div> <div className="cluedIn_row cluedIn_row_notCentered cluedIn_entity_table"> <div className="cluedIn_col s6"> <EntityValueRow name="Author(s)"> <EntityAuthors entity={entity}></EntityAuthors> </EntityValueRow> </div> <div className="cluedIn_col s6"> <EntityValueRow name="Creation Date"> {entity.data.createdDateFormatted} </EntityValueRow> </div> </div> <div className="cluedIn_row cluedIn_row_notCentered cluedIn_entity_table"> <div className="cluedIn_col s6"> {statusHtml} </div> <div className="cluedIn_col s6"> {channelHtml} </div> </div> </div> ); } }