<commit_before>import { Link } from 'react-router-dom';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import c from 'classnames';

import getPath from 'src/util/getPath';
import { fetchCollection } from 'src/actions';
import { selectCollection } from 'src/selectors';

class CollectionLabel extends Component {
  render() {
    const { collection, icon = true } = this.props;

    return (
      <React.Fragment>
        { collection.secret && icon && (<i className='fa fa-fw fa-lock' />) }
        { collection.label }
      </React.Fragment>
    );
  }
}

class CollectionLink extends Component {
  render() {
    const { collection, icon = true, className, preview } = this.props;

    if (preview === true) {
      // Displays in preview sidebar
      return (
        <a href={`#preview:id=${collection.id}&preview:type=collection`}
           className={c('CollectionLink', className)}>
          <Collection.Label collection={collection} icon={icon} />
        </a>
      );
    } else {
      return (
        <Link to={getPath(collection.links.ui)}
              className={c('CollectionLink', className)}>
          <Collection.Label collection={collection} icon={icon} />
        </Link>
      );
    }
  }
}

class CollectionLoad extends Component {
  componentDidMount() {
    this.fetchIfNeeded();
  }

  componentDidUpdate() {
    this.fetchIfNeeded();
  }

  fetchIfNeeded() {
    const { id, collection } = this.props;
    if (collection === undefined) {
      this.props.fetchCollection({ id });
    }
  }

  render() {
    const { collection, children, renderWhenLoading } = this.props;<commit_msg>changed link that goes to path for collection<commit_after>import { Link } from 'react-router-dom';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import c from 'classnames';

import getPath from 'src/util/getPath';
import { fetchCollection } from 'src/actions';
import { selectCollection } from 'src/selectors';

class CollectionLabel extends Component {
  render() {
    const { collection, icon = true } = this.props;

    return (
      <React.Fragment>
        { collection.secret && icon && (<i className='fa fa-fw fa-lock' />) }
        { collection.label }
      </React.Fragment>
    );
  }
}

class CollectionLink extends Component {
  render() {
    const { collection, icon = true, className, preview } = this.props;

    if (preview === true) {
      // Displays in preview sidebar
      return (
        <a href={`#preview:id=${collection.id}&preview:type=collection`}
           className={c('CollectionLink', className)}>
          <Collection.Label collection={collection} icon={icon} />
        </a>
      );
    } else {
      return (
        <Link to={`/search?filter:collection_id=${collection.id}#preview:id=${collection.id}&preview:type=collection`}
              className={c('CollectionLink', className)}>
          <Collection.Label collection={collection} icon={icon} />
        </Link>
      );
    }
  }
}

class CollectionLoad extends Component {
  componentDidMount() {
    this.fetchIfNeeded();
  }

  componentDidUpdate() {
    this.fetchIfNeeded();
  }

  fetchIfNeeded() {
    const { id, collection } = this.props;
    if (collection === undefined) {
      this.props.fetchCollection({ id });
    }
  }

  render() {
    const { collection, children, renderWhenLoading } = this.props;
{'fraction_non_alphanumeric': 0.14256970393791318, 'fraction_numerical': 0.0, 'mean_word_length': 2.9322033898305087, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '3734154', 'n_tokens_mistral': 999, 'n_tokens_neox': 987, 'n_words': 236}