<commit_before>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import queryString from 'query-string';
import { Icon } from '@blueprintjs/core';
import { withRouter } from 'react-router';
import { connect } from 'react-redux';
import c from 'classnames';

import { fetchCollection } from 'src/actions';
import { selectCollection } from 'src/selectors';
import getCollectionLink from 'src/util/getCollectionLink';
import { getColor } from 'src/util/colorScheme';

import './Collection.css';


class CollectionLabel extends Component {
  shouldComponentUpdate(nextProps) {
    const { collection = {} } = this.props;
    const { collection: nextCollection = {} } = nextProps;
    return collection.id !== nextCollection.id;
  }

  render() {
    const { collection, icon = true, label = true } = this.props;
    if (collection === undefined || collection.id === undefined) {
      return null;
    }

    return (
      <span className="CollectionLabel" title={collection.label}>
        { collection.secret && !collection.casefile && icon && (
          <Icon icon="lock" />
        )}
        { collection.casefile && icon && (
          <Icon icon="briefcase" style={{color: getColor(collection.id)}} />
        )}
        <span> { label && collection.label } </span>
      </span>
    );
  }
}


class CollectionLink extends Component {
  constructor() {
    super();
    this.onClick = this.onClick.bind(this);
  }

  onClick(event) {
    const { collection, history, location, preview } = this.props;
    const previewType = 'collection';
    event.preventDefault();

    if (preview === true) {
      const parsedHash = queryString.parse(location.hash);
      if (parsedHash['preview:id'] === collection.id && parsedHash['preview:type'] === previewType) {<commit_msg>Put icons on all collections.<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import queryString from 'query-string';
import { Icon } from '@blueprintjs/core';
import { withRouter } from 'react-router';
import { connect } from 'react-redux';
import c from 'classnames';

import { fetchCollection } from 'src/actions';
import { selectCollection } from 'src/selectors';
import getCollectionLink from 'src/util/getCollectionLink';
import { getColor } from 'src/util/colorScheme';

import './Collection.css';


class CollectionLabel extends Component {
  shouldComponentUpdate(nextProps) {
    const { collection = {} } = this.props;
    const { collection: nextCollection = {} } = nextProps;
    return collection.id !== nextCollection.id;
  }

  render() {
    const { collection, icon = true, label = true } = this.props;
    if (collection === undefined || collection.id === undefined) {
      return null;
    }

    let iconName = "database", style = {};
    if (collection.casefile) {
      iconName = "briefcase";
      style = {color: getColor(collection.id)};
    } else if (collection.secret) {
      iconName = "lock";
    }

    return (
      <span className="CollectionLabel" title={collection.label}>
        { icon && (<Icon icon={iconName} style={style} />)}
        <span> { label && collection.label } </span>
      </span>
    );
  }
}


class CollectionLink extends Component {
  constructor() {
    super();
    this.onClick = this.onClick.bind(this);
  }

  onClick(event) {
    const { collection, history, location, preview } = this.props;
    const previewType = 'collection';
    event.preventDefault();

    if (preview === true) {
      const parsedHash = queryString.parse(location.hash);
      if (parsedHash['preview:id'] === collection.id && parsedHash['preview:type'] === previewType) {
{'fraction_non_alphanumeric': 0.14391043145821955, 'fraction_numerical': 0.0, 'mean_word_length': 3.4670731707317075, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '4427072', 'n_tokens_mistral': 1027, 'n_tokens_neox': 1018, 'n_words': 267}