<commit_before>import React from 'react'

export default class DetailTable extends React.Component {

  constructor (props) {
    super(props)

    var entries = []
    let defaultEntries = []

    if (props.type === 'artists') {
      defaultEntries = [
        { id: 'name', name: 'Name' },
        { id: 'dateOfBirth', name: 'Date of Birth' },
        { id: 'dateOfDeath', name: 'Date of Death' },
        { id: 'placeOfBirth', name: 'Place of Birth' },
        { id: 'placeOfDeath', name: 'Place of Death' },
        { id: 'nationality', name: 'Nationality' }
      ]
    } else if (props.type === 'works') {
      defaultEntries = [
        { id: 'title', name: 'Title' },
        { id: 'compositionyear', name: 'Date of Composition' }
      ]
    }
    for (var i = 0; i < defaultEntries.length; i++) {
      let value = props.myData[defaultEntries[i].id]
      if (value) {
        entries.push({
          name: defaultEntries[i].name,
          value: value
        })
      }
    }

    if (props.myData.wiki_link || props.myData.source_link) {
      entries.push({
        name: 'Further Information',
        value: (<a href={props.myData.wiki_link} target='_blank'>Wikipedia</a>)
      })
    }

    if (props.myData['tags']) {
      let mappingKey = 0
      entries.push({
        name: 'Tags',
        value: props.myData.tags.map(name => {
          var clickHandler = function () { this.context.router.transitionTo('/search/' + name) }.bind(this)
          return (
            <span key={mappingKey++} onClick={clickHandler}><div className='label label-default'>{name}</div> </span>
          )
        })
      })
    }

    this.state = {
      entries: entries
    }
  }

  render () {
    let mappingKey = 0
    return (
      <div className='detailbox'>
        <table className='table table-hover'>
          <thead>
            <tr>
              <th colSpan='2'>
                Detailed Information
              </th>
            </tr>
          </thead>
          <tbody>
            {this.state.entries.map(entry => (
              <tr key={mappingKey++}>
                <td style={{ whiteSpace: 'nowrap' }}>
                  {entry.name}<commit_msg>Closes #131<commit_after>import React from 'react'

export default class DetailTable extends React.Component {

  constructor (props) {
    super(props)

    var entries = []
    let defaultEntries = []

    if (props.type === 'artists') {
      defaultEntries = [
        { id: 'name', name: 'Name' },
        { id: 'dateOfBirth', name: 'Date of Birth' },
        { id: 'dateOfDeath', name: 'Date of Death' },
        { id: 'placeOfBirth', name: 'Place of Birth' },
        { id: 'placeOfDeath', name: 'Place of Death' },
        { id: 'nationality', name: 'Nationality' }
      ]
    } else if (props.type === 'works') {
      defaultEntries = [
        { id: 'title', name: 'Title' },
        { id: 'compositionyear', name: 'Date of Composition' }
      ]
    }
    for (var i = 0; i < defaultEntries.length; i++) {
      let value = props.myData[defaultEntries[i].id]
      if (value) {
        entries.push({
          name: defaultEntries[i].name,
          value: value
        })
      }
    }

    if (props.myData.wiki_link || props.myData.source_link) {
      entries.push({
        name: 'Further Information',
        value: (<a href={props.myData.wiki_link} target='_blank'>Wikipedia</a>)
      })
    }

    if (props.myData['tags']) {
      let mappingKey = 0
      entries.push({
        name: 'Tags',
        value: props.myData.tags.map(name => {
          return (
            <span key={mappingKey++}><div className='label label-default'>{name}</div> </span>
          )
        })
      })
    }

    this.state = {
      entries: entries
    }
  }

  render () {
    let mappingKey = 0
    return (
      <div className='detailbox'>
        <table className='table table-hover'>
          <thead>
            <tr>
              <th colSpan='2'>
                Detailed Information
              </th>
            </tr>
          </thead>
          <tbody>
            {this.state.entries.map(entry => (
              <tr key={mappingKey++}>
                <td style={{ whiteSpace: 'nowrap' }}>
                  {entry.name}
{'fraction_non_alphanumeric': 0.15268258095013, 'fraction_numerical': 0.002599858189553297, 'mean_word_length': 1.800794176042356, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6709870', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1270, 'n_words': 293}