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.
81 lines (70 loc) • 2.17 kB
JSX
import React, { Component } from 'react';
import iso from '../../../iso';
import { FormattedMessage } from 'react-intl';
import AllProviderList from './allProviderList.jsx';
import { location } from '../../../core/config';
import Theme from '../../../theme';
import radium from 'radium';
import Gutter from '../../../core/components/generics/Gutter.jsx';
class AddProvider extends Component {
  goToAddProviderWithId() {
  }
  goToAddProvider() {
  }
  render() {
    const {
      providers,
      isLink,
    } = this.props;
    let allProviderContent;
    let providersFiltered;
    let viewAllIntegrationContent;
    let viewAllIntegrationLink = location.goToAppProvider();
    if (providers && providers.length > 0) {
      providersFiltered = providers.filter(iso.provider.filterByMostWellKnownProvider);
      allProviderContent = (
        <div>
          <AllProviderList
            isLink={isLink}
            onProviderClick={this.goToAddProviderWithId.bind(this)}
            providers={providersFiltered}
          />
        </div>
      );
    }
    if (isLink) {
      let link = location.goToAppProvider();
      viewAllIntegrationContent = (
        <a target="_blank" href={link} style={[Theme.buttons.main, Theme.buttons.primary]}>
          <span>
            <i style={Theme.buttons.addon} className="fa fa-plug"></i>
          </span>
          <span>
            <FormattedMessage id="IntegrationReport.ViewAllIntegrations"/>
          </span>
        </a>
      );
    } else {
      viewAllIntegrationContent = (
        <a href={viewAllIntegrationLink} onClick={this.goToAddProvider.bind(this)}
           style={[Theme.buttons.main, Theme.buttons.primary]}>
          <span>
            <i style={Theme.buttons.addon} className="fa fa-plug"></i>
          </span>
          <span>
            <FormattedMessage id="IntegrationReport.ViewAllIntegrations"/>
          </span>
        </a>
      );
    }
    return (
      <div>
        {allProviderContent}
        <Gutter size="small" top={true} center={true}>
          {viewAllIntegrationContent}
        </Gutter>
      </div>
    );
  }
}
export default radium(AddProvider);