<commit_before>import React from 'react';
import { connect } from 'react-redux';

import SchemaIcon from './SchemaIcon';

const ListItem = ({ name, schema, properties, collection }) => (
  <tr className={`result result--${schema}`}>
    <td className="result__name">
      <span className="result__icon">
        <SchemaIcon schemaId={schema} />
      </span>
      <span title={name}>{ name }</span>
    </td>
    <td className="result__collection">
      {collection ?
        <span title={collection.label}>
          <span className="pt-icon pt-icon-globe" /> {collection.label}
        </span> :
        <span className="pt-skeleton">Loading collection</span>}
    </td>
    <td>
      {properties.map(property => (
        <span className="result-property" data-property={property.name} key={property.name}>
          <span className={`pt-icon pt-icon-${property.icon}`} /> {property.label}
        </span>
      ))}
    </td>
  </tr>
);

const SearchResultListItem = ({ result, collection, countries }) => {
  const schemaProperties = {
    'Document': () => [],
    'Company': () => [],
    'LegalEntity': () => [],
    'Land': () => [],
    'Person': ({ nationality, address }) => [
      {name: 'nationality', icon: 'flag', label: countries[nationality]},
      {name: 'address', icon: 'map', label: address}
    ]
  };

  const properties = schemaProperties[result.schema](result.properties)<commit_msg>Link search results to entities.<commit_after>import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';

import SchemaIcon from './SchemaIcon';

function getPath(url) {
  return new URL(url).pathname;
}

const ListItem = ({ name, schema, properties, collection, ui }) => (
  <tr className={`result result--${schema}`}>
    <td className="result__name">
      <Link to={getPath(ui)}>
        <span className="result__icon">
          <SchemaIcon schemaId={schema} />
        </span>
        <span title={name}>{ name }</span>
      </Link>
    </td>
    <td className="result__collection">
      {collection ?
        <span title={collection.label}>
          <span className="pt-icon pt-icon-globe" /> {collection.label}
        </span> :
        <span className="pt-skeleton">Loading collection</span>}
    </td>
    <td>
      {properties.map(property => (
        <span className="result-property" data-property={property.name} key={property.name}>
          <span className={`pt-icon pt-icon-${property.icon}`} /> {property.label}
        </span>
      ))}
    </td>
  </tr>
);

const SearchResultListItem = ({ result, collection, countries }) => {
  const schemaProperties = {
    'Document': () => [],
    'Company': () => [],
    'LegalEntity': () => [],
    'Land': () => [],
    'Person': ({ nationality, address }) => [
      {name: 'nationality', icon: 'flag', label: countries[nationality]},
      {name: 'address', icon: 'map', label: address}
    ]
  };

  const properties = schemaProperties[result.schema](result.properties)
{'fraction_non_alphanumeric': 0.18681318681318682, 'fraction_numerical': 0.0, 'mean_word_length': 3.0815217391304346, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 63, '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': '6525588', 'n_tokens_mistral': 895, 'n_tokens_neox': 887, 'n_words': 194}