text: import React, { Component } from 'react';
  import * as PropTypes from 'prop-types';
  import { Route, withRouter } from 'react-router-dom';
  import { compose } from 'ramda';
  import { createFragmentContainer } from 'react-relay';
  import graphql from 'babel-plugin-relay/macro';
  import { withStyles } from '@material-ui/core/styles';
  import inject18n from '../../../../components/i18n';
  import EntityStixCoreRelationships from '../../common/stix_core_relationships/EntityStixCoreRelationships';
  import StixDomainObjectKnowledge from '../../common/stix_domain_objects/StixDomainObjectKnowledge';
  import StixCoreRelationship from '../../common/stix_core_relationships/StixCoreRelationship';
  import RegionPopover from './RegionPopover';
  import StixDomainObjectHeader from '../../common/stix_domain_objects/StixDomainObjectHeader';
  import StixCoreObjectKnowledgeBar from '../../common/stix_core_objects/StixCoreObjectKnowledgeBar';
  
  const styles = () => ({
    container: {
      margin: 0,
      padding: '0 200px 0 0',
    },
  });
  
  class RegionKnowledgeComponent extends Component {
    render() {
      const { classes, region } = this.props;
      const link = `/dashboard/entities/regions/${region.id}/knowledge`;
      return (
        <div className={classes.container}>
          <StixDomainObjectHeader
            stixDomainObject={region}
            PopoverComponent={<RegionPopover />}
            variant="noaliases"
          />
          <StixCoreObjectKnowledgeBar
            stixCoreObjectLink={link}
            availableSections={[
              'countries',
              'threat_actors',
              'intrusion_sets',
              'campaigns',
              'incidents',
              'malwares',
              'observables',
              'sightings',
            ]}
          />
          <Route
            exact
            path="/dashboard/entities/regions/:regionId/knowledge/relations/:relationId"
            render={(routeProps) => (
              <StixCoreRelationship
                entityId={region.id}
                paddingRight={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/entities/regions/:regionId/knowledge/overview"
            render={(routeProps) => (
              <StixDomainObjectKnowledge
                stixDomainObjectId={region.id}
                stixDomainObjectType="Region"
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/entities/regions/:regionId/knowledge/countries"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={region.id}
                relationshipTypes={['located-at']}
                targetStixDomainObjectTypes={['Country']}
                entityLink={link}
                isRelationReversed={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/entities/regions/:regionId/knowledge/threat_actors"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={region.id}
                relationshipTypes={['targets']}
                targetStixDomainObjectTypes={['Threat-Actor']}
                entityLink={link}
                isRelationReversed={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/entities/regions/:regionId/knowledge/intrusion_sets"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={region.id}
                relationshipTypes={['targets']}
                targetStixDomainObjectTypes={['Intrusion-Set']}
                entityLink={link}
                isRelationReversed={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/entities/regions/:regionId/knowledge/campaigns"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={region.id}
                relationshipTypes={['targets']}
                targetStixDomainObjectTypes={['Campaign']}
                entityLink={link}
                isRelationReversed={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/entities/regions/:regionId/knowledge/incidents"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={region.id}
                relationshipTypes={['targets']}
                targetStixDomainObjectTypes={['X-OpenCTI-Incident']}
                entityLink={link}
                isRelationReversed={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/entities/regions/:regionId/knowledge/malwares"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={region.id}
                relationshipTypes={['targets']}
                targetStixDomainObjectTypes={['Malware']}
                entityLink={link}
                isRelationReversed={true}
                {...routeProps}
              />
            )}
          />
        </div>
      );
    }
  }
  
  RegionKnowledgeComponent.propTypes = {
    region: PropTypes.object,
    classes: PropTypes.object,
    t: PropTypes.func,
  };
  
  const RegionKnowledge = createFragmentContainer(RegionKnowledgeComponent, {
    region: graphql`
      fragment RegionKnowledge_region on Region {
        id
        name
        x_opencti_aliases
      }
    `,
  });
  
  export default compose(
    inject18n,
    withRouter,
    withStyles(styles),
  )(RegionKnowledge);
  