<commit_before>import React from 'react';
import Panel from 'react-bootstrap/lib/Panel';

export default React.createClass({
  propTypes: {
    graph: React.PropTypes.object.isRequired,
  },

  getInitialState() {
    return {
      visible: {
        blocked: false,
        inProgress: true,
        ready: true,
        done: false,
      },
    };
  },

  toggleVisible(name) {
    const update = {};
    update[name] = !this.state.visible[name];
    this.setState({
      visible: { ...this.state.visible, ...update },
    });
  },

  render() {
    const graph = this.props.graph;
    const blocked = [];
    const inProgress = [];
    const ready = [];
    const done = [];

    graph.nodes.forEach(node => {
      if (node.done) {
        done.push(node);
      } else if (!node.dependencies.length) {
        if (node.assigned) {
          inProgress.push(node);
        } else {
          ready.push(node);
        }
      } else {
        blocked.push(node);
      }
    });

    const listItems = (name, title, nodes) => {
      if (!nodes.length) {
        return null;
      }

      const visible = this.state.visible[name];
      const header = (
        <h2 onClick={() => this.toggleVisible(name)}>
          {title}
        </h2>
      );

      return <Panel collapsible expanded={visible} header={header}>
        <ul>
          {
            nodes.map(node => <li key={node.name}>{node.title}</li>)
          }
        </ul>
      </Panel>;
    };
    return <div>
      {listItems('blocked', 'Blocked', blocked)}
      {listItems('inProgress', 'In Progress', inProgress)}
      {listItems('ready', 'Ready', ready)}
      {listItems('done', 'Done', done)}
    </div>;
  },
});
<commit_msg>show 'no items'<commit_after>import React from 'react';
import Panel from 'react-bootstrap/lib/Panel';

export default React.createClass({
  propTypes: {
    graph: React.PropTypes.object.isRequired,
  },

  getInitialState() {
    return {
      visible: {
        blocked: false,
        inProgress: true,
        ready: true,
        done: false,
      },
    };
  },

  toggleVisible(name) {
    const update = {};
    update[name] = !this.state.visible[name];
    this.setState({
      visible: { ...this.state.visible, ...update },
    });
  },

  render() {
    const graph = this.props.graph;
    const blocked = [];
    const inProgress = [];
    const ready = [];
    const done = [];

    graph.nodes.forEach(node => {
      if (node.done) {
        done.push(node);
      } else if (!node.dependencies.length) {
        if (node.assigned) {
          inProgress.push(node);
        } else {
          ready.push(node);
        }
      } else {
        blocked.push(node);
      }
    });

    const listItems = (name, title, nodes) => {
      const visible = this.state.visible[name];
      const header = (
        <h2 onClick={() => this.toggleVisible(name)}>
          {title}
        </h2>
      );

      if (!nodes.length) {
        return (
          <Panel collapsible expanded={visible} header={header}>
            <span className="text-muted">no items</span>
          </Panel>
        );
      }

      return <Panel collapsible expanded={visible} header={header}>
        <ul>
          {
            nodes.map(node => <li key={node.name}>{node.title}</li>)
          }
        </ul>
      </Panel>;
    };
    return <div className="container-fluid">
      {listItems('blocked', 'Blocked', blocked)}
      {listItems('inProgress', 'In Progress', inProgress)}
      {listItems('ready', 'Ready', ready)}
      {listItems('done', 'Done', done)}
    </div>;
  },
});

{'fraction_non_alphanumeric': 0.1638888888888889, 'fraction_numerical': 0.0011111111111111111, 'mean_word_length': 1.9540607054963084, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 35, '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': '5292962', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1095, 'n_words': 222}