<commit_before>import React, { Component } from 'react';
import { Link, withRouter } from 'react-router';
import { connect } from 'react-redux';

import { getSidebarSetting, getCurrentTasks, getCompletedTasks } from '../../reducers';

import Login from './login';

class Sidebar extends Component {
  renderTaskList(tasks) {
    const { topLevelRoute } = this.props;

    return tasks.map((task, i) => (
      <Link
        to={`${topLevelRoute}/${task.idtask}`}
        key={i}
        className='block strong dark pad1x pad0y truncate'>
        {task.value.description}
      </Link>
    ));
  }

  render() {
    const { sidebar, currentTasks, completedTasks } = this.props;

    let sidebarClass = 'sidebar pin-bottomleft clip col2 animate offcanvas-left fill-navy space-top6';
    if (sidebar) sidebarClass += ' active';

    return (
      <div className={sidebarClass}>
        <div className='scroll-styled pad2y'>
          <Login />
          <h4 className='dark block pad1x space-bottom1'>Current Tasks</h4>
          <nav ref='taskList' className='space-bottom2'>{this.renderTaskList(currentTasks)}</nav>
          <h4 className='dark block pad1x space-bottom1'>Completed Tasks</h4>
          <nav ref='taskList' className='space-bottom2'>{this.renderTaskList(completedTasks)}</nav>
        </div>
      </div>
    );
  }
}

const mapStateToProps = (state, { routes }) => ({
  topLevelRoute: routes[1].name,
  sidebar: getSidebarSetting(state),
  currentTasks: getCurrentTasks(state),
  completedTasks: getCompletedTasks(state),
});

Sidebar = withRouter(connect(
  mapStateToProps
)(Sidebar));
<commit_msg>select task on click; rename currentTasks to activeTasks<commit_after>import React, { Component } from 'react';
import { Link, withRouter } from 'react-router';
import { connect } from 'react-redux';

import { selectTask } from '../../actions';
import { getSidebarSetting, getActiveTasks, getCompletedTasks } from '../../reducers';

import Login from './login';

class Sidebar extends Component {
  renderTaskList(tasks) {
    const { topLevelRoute, selectTask } = this.props;

    return tasks.map((task, i) => (
      <Link
        to={`${topLevelRoute}/${task.idtask}`}
        key={i}
        className='block strong dark pad1x pad0y truncate'
        onClick={() => selectTask({ idtask: task.idtask })}>
        {task.value.description}
      </Link>
    ));
  }

  render() {
    const { sidebar, activeTasks, completedTasks } = this.props;

    let sidebarClass = 'sidebar pin-bottomleft clip col2 animate offcanvas-left fill-navy space-top6';
    if (sidebar) sidebarClass += ' active';

    return (
      <div className={sidebarClass}>
        <div className='scroll-styled pad2y'>
          <Login />
          <h4 className='dark block pad1x space-bottom1'>Current Tasks</h4>
          <nav className='space-bottom2'>{this.renderTaskList(activeTasks)}</nav>
          <h4 className='dark block pad1x space-bottom1'>Completed Tasks</h4>
          <nav className='space-bottom2'>{this.renderTaskList(completedTasks)}</nav>
        </div>
      </div>
    );
  }
}

const mapStateToProps = (state, { routes }) => ({
  topLevelRoute: routes[1].name,
  sidebar: getSidebarSetting(state),
  activeTasks: getActiveTasks(state),
  completedTasks: getCompletedTasks(state),
});

Sidebar = withRouter(connect(
  mapStateToProps,
  { selectTask }
)(Sidebar));

{'fraction_non_alphanumeric': 0.1423076923076923, 'fraction_numerical': 0.009467455621301775, 'mean_word_length': 3.4196078431372547, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 38, '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': '4604542', 'n_tokens_mistral': 1030, 'n_tokens_neox': 1013, 'n_words': 233}