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.
60 lines (55 loc) • 2.16 kB
JSX
import React, { Component } from 'react';
import EntityAuthors from '../entityRelated/EntityAuthors.jsx';
import { makeNoValueRow, makePropHtml, findFromKey, makeBadgeHtml } from '../../helpers/properties.jsx';
import EntityValueRow from '../entityRelated/EntityValueRow.jsx';
import EntityDefaultHeader from '../entityRelated/EntityDefaultHeader.jsx';
let noEnd = makeNoValueRow('Status');
let noStart = makeNoValueRow('Rating');
let noLocation = makeNoValueRow('Email');
let noOrganizerName = makeNoValueRow('Title');
export default class Issue extends Component {
  render() {
    const { entity, openInNewTab, q } = this.props;
    let startProp = findFromKey(entity.properties, 'status');
    let endProp = findFromKey(entity.properties, 'rating');
    let locationProp = findFromKey(entity.properties, 'email');
    let organizerProp = findFromKey(entity.properties, 'title');
    let startHtml = startProp ? makeBadgeHtml(startProp) : noStart;
    let endHtml = endProp ? makePropHtml(endProp) : noEnd;
    let locationHtml = locationProp ? makePropHtml(locationProp) : noLocation;
    let organizerHtml = organizerProp ? makePropHtml(organizerProp) : noOrganizerName;
    /*
    *  <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">
     {startHtml}
     </div>
     <div className="cluedIn_col s6">
     {endHtml}
     </div>
     <div className="cluedIn_col s6">
     {locationHtml}
     </div>
     <div className="cluedIn_col s6">
     {organizerHtml}
     </div>
     </div>
    * */
    return (
      <div className="cluedIn_entity_row">
        <EntityDefaultHeader q={q} openInNewTab={openInNewTab} entity={entity}></EntityDefaultHeader>
      </div>
    );
  }
}