<commit_before>import React, {Component} from 'react';
import styles from './ConferenceFilter.css';
import Link from '../Link';

const YEARS = ['2017', '2018'];
const TYPES = {
  javascript: 'JavaScript',
  ux: 'Design / UX',
  ruby: 'Ruby',
};

export default class ConferenceFilter extends Component {
  getUrl = (filters) => {
    const {year, type} = this.props;

    if (filters.country) {
      return `/${filters.year || year}/${filters.type || type}/${filters.country}`;
    } else {
      return `/${filters.year || year}/${filters.type || type}`;
    }
  };

  render() {
    const {year, type, country, countries} = this.props;

    return (
      <div className={styles.ConferenceFilterWrapper}>
        <div className={styles.ConferenceFilter}>
          {Years(year, this.getUrl)}
        </div>
        <div className={styles.ConferenceFilter}>
          {Types(type, this.getUrl)}
        </div>
        <div className={styles.ConferenceFilter}>
          {Countries(countries, country, this.getUrl)}
        </div>
      </div>
    );
  }
}

function Years(selectedYear, getUrl) {
  return YEARS.map((year) => {
    return (
      <div key={year} className={styles.Filter}>
        <Link
          url={getUrl({year})}
          selected={selectedYear === year}
          routed
        >
          {year}
        </Link>
      </div>
    );
  });
}

function Types(selectedType, getUrl) {
  return Object.keys(TYPES).map((type) => {
    return (
      <div key={type} className={styles.Filter}>
        <Link
          url={getUrl({type})}
          selected={selectedType === type}
          routed
        >
          {TYPES[type]}
        </Link>
      </div>
    );
  });
}

function Countries(countries, selectedCountry, getUrl) {
  const countriesNode = countries.map((country) => {
    return (
      <div key={country} className={styles.Filter}>
        <Link
          url={getUrl({country})}
          selected={selectedCountry === country}
          routed
        >
          {country}
        </Link><commit_msg>Trim spaces in URL<commit_after>import React, {Component} from 'react';
import styles from './ConferenceFilter.css';
import Link from '../Link';

const YEARS = ['2017', '2018'];
const TYPES = {
  javascript: 'JavaScript',
  ux: 'Design / UX',
  ruby: 'Ruby',
};

export default class ConferenceFilter extends Component {
  getUrl = (filters) => {
    const {year, type} = this.props;

    if (filters.country) {
      return `/${filters.year || year}/${filters.type || type}/${filters.country}`;
    } else {
      return `/${filters.year || year}/${filters.type || type}`;
    }
  };

  render() {
    const {year, type, country, countries} = this.props;

    return (
      <div className={styles.ConferenceFilterWrapper}>
        <div className={styles.ConferenceFilter}>
          {Years(year, this.getUrl)}
        </div>
        <div className={styles.ConferenceFilter}>
          {Types(type, this.getUrl)}
        </div>
        <div className={styles.ConferenceFilter}>
          {Countries(countries, country, this.getUrl)}
        </div>
      </div>
    );
  }
}

function Years(selectedYear, getUrl) {
  return YEARS.map((year) => {
    return (
      <div key={year} className={styles.Filter}>
        <Link
          url={getUrl({year})}
          selected={selectedYear === year}
          routed
        >
          {year}
        </Link>
      </div>
    );
  });
}

function Types(selectedType, getUrl) {
  return Object.keys(TYPES).map((type) => {
    return (
      <div key={type} className={styles.Filter}>
        <Link
          url={getUrl({type})}
          selected={selectedType === type}
          routed
        >
          {TYPES[type]}
        </Link>
      </div>
    );
  });
}

function Countries(countries, selectedCountry, getUrl) {
  const countriesNode = countries.map((country) => {
    return (
      <div key={country} className={styles.Filter}>
        <Link
          url={getUrl({country: country.trim()})}
          selected={selectedCountry === country}
          routed
        >
          {country}
        </Link>
{'fraction_non_alphanumeric': 0.16021426832237642, 'fraction_numerical': 0.0038957876795714633, 'mean_word_length': 2.2759170653907494, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 49, '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': '6955102', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1225, 'n_words': 259}