<commit_before>import React from 'react'
import { translate } from 'react-i18next'
import PropTypes from 'prop-types'
import { Link } from 'react-router-dom'

// import Filter from 'common/components/Filter'
import MarkdownSummary from 'common/components/MarkdownSummary'
import DatasetInfo from 'common/components/DatasetInfo'

import styles from './SearchResult.scss'
import noThumbnail from './images/no-thumbnail.svg'

const { GEODATA_API_URL } = process.env

const SearchResult = ({ dataset, addFilter, t }) => (
  <div className={styles.container}>
    <Link to={`/datasets/${dataset.recordId}`} className={styles.dataset}>
      {dataset.metadata.thumbnails && dataset.metadata.thumbnails.length > 0 ? (
        <div className={styles.thumbnail}>
          <img src={`${GEODATA_API_URL}/records/${dataset.recordId}/thumbnails/${dataset.metadata.thumbnails[0].originalUrlHash}`} alt='thumbnail' />
        </div>
      ) : (
        <div className={`${styles.thumbnail} ${styles.noThumbnail}`}>
          <img src={noThumbnail} alt='no image available' />
        </div>
      )}

      <div className={styles.content}>
        <div className={styles.description}>
          <h3>{dataset.metadata.title}</h3>

          {dataset.metadata.inspireTheme && (
            <div className={styles.inspire}>
              <img src={`/assets/inspire-icons/${dataset.metadata.inspireTheme.id}.svg`} alt='Inspire theme' />
            </div>
          )}
        </div>

        {dataset.metadata.description && (
          <MarkdownSummary markdown={dataset.metadata.description} />
        )}

        <div className={styles.footer}>
          <DatasetInfo metadata={dataset.metadata} className={styles.infos} />
        </div>
      </div>

      {/* <div className={styles.filters}>
        <div className={styles.facet}>
          <h5>{t('SearchResult.keywords', { context: dataset.metadata.keywords.length })}</h5>
          <div className={styles.list}>
            {dataset.metadata.keywords.map((keyword, idx) => (
              <Filter
                key={idx}
                onClick={addFilter}
                filter={{ value: keyword, name: 'keyword' }}
              />
            ))}
          </div>
        </div>

        <div className={styles.facet}>
          <h5>{t('SearchResult.organizations', { context: dataset.organizations.length })}</h5>
          <div className={styles.list}>
            {dataset.organizations.map((organization, idx) => (
              <Filter
                key={idx}
                onClick={addFilter}
                filter={{ value: organization, name: 'organization' }}
              />
            ))}
          </div>
        </div>
      </div> */}
    </Link>
  </div>
)

SearchResult.propTypes = {
  dataset: PropTypes.shape({
    recordId: PropTypes.string.isRequired,

    metadata: PropTypes.shape({
      title: PropTypes.string.isRequired,
      description: PropTypes.string,
      keywords: PropTypes.array.isRequired
    }).isRequired,

    organizations: PropTypes.array.isRequired
  }).isRequired,

  addFilter: PropTypes.func.isRequired,

  t: PropTypes.func.isRequired
}

export default translate('Search')(SearchResult)<commit_msg>Use translated inspire themes in search result<commit_after>import React from 'react'
import { translate } from 'react-i18next'
import PropTypes from 'prop-types'
import { Link } from 'react-router-dom'

// import Filter from 'common/components/Filter'
import MarkdownSummary from 'common/components/MarkdownSummary'
import DatasetInfo from 'common/components/DatasetInfo'

import styles from './SearchResult.scss'
import noThumbnail from './images/no-thumbnail.svg'

const { GEODATA_API_URL } = process.env

const SearchResult = ({ dataset, addFilter, t, i18n }) => (
  <div className={styles.container}>
    <Link to={`/datasets/${dataset.recordId}`} className={styles.dataset}>
      {dataset.metadata.thumbnails && dataset.metadata.thumbnails.length > 0 ? (
        <div className={styles.thumbnail}>
          <img src={`${GEODATA_API_URL}/records/${dataset.recordId}/thumbnails/${dataset.metadata.thumbnails[0].originalUrlHash}`} alt='thumbnail' />
        </div>
      ) : (
        <div className={`${styles.thumbnail} ${styles.noThumbnail}`}>
          <img src={noThumbnail} alt='no image available' />
        </div>
      )}

      <div className={styles.content}>
        <div className={styles.description}>
          <h3>{dataset.metadata.title}</h3>

          {dataset.metadata.inspireTheme && (
            <div className={styles.inspire}>
              <img
                src={`/assets/inspire-icons/${dataset.metadata.inspireTheme.id}.svg`}
                title={dataset.metadata.inspireTheme.label[i18n.language]}
                alt={dataset.metadata.inspireTheme.label[i18n.language]}
              />
            </div>
          )}
        </div>

        {dataset.metadata.description && (
          <MarkdownSummary markdown={dataset.metadata.description} />
        )}

        <div className={styles.footer}>
          <DatasetInfo metadata={dataset.metadata} className={styles.infos} />
        </div>
      </div>

      {/* <div className={styles.filters}>
        <div className={styles.facet}>
          <h5>{t('SearchResult.keywords', { context: dataset.metadata.keywords.length })}</h5>
          <div className={styles.list}>
            {dataset.metadata.keywords.map((keyword, idx) => (
              <Filter
                key={idx}
                onClick={addFilter}
                filter={{ value: keyword, name: 'keyword' }}
              />
            ))}
          </div>
        </div>

        <div className={styles.facet}>
          <h5>{t('SearchResult.organizations', { context: dataset.organizations.length })}</h5>
          <div className={styles.list}>
            {dataset.organizations.map((organization, idx) => (
              <Filter
                key={idx}
                onClick={addFilter}
                filter={{ value: organization, name: 'organization' }}
              />
            ))}
          </div>
        </div>
      </div> */}
    </Link>
  </div>
)

SearchResult.propTypes = {
  dataset: PropTypes.shape({
    recordId: PropTypes.string.isRequired,

    metadata: PropTypes.shape({
      title: PropTypes.string.isRequired,
      description: PropTypes.string,
      keywords: PropTypes.array.isRequired
    }).isRequired,

    organizations: PropTypes.array.isRequired
  }).isRequired,

  addFilter: PropTypes.func.isRequired,

  i18n: PropTypes.shape({
    language: PropTypes.string.isRequired
  }).isRequired,
  t: PropTypes.func.isRequired
}

export default translate('Search')(SearchResult)
{'fraction_non_alphanumeric': 0.14633781763826606, 'fraction_numerical': 0.004185351270553065, 'mean_word_length': 2.440102827763496, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 89, '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': '3519466', 'n_tokens_mistral': 1915, 'n_tokens_neox': 1892, 'n_words': 331}