<commit_before>import React from 'react'
import { connect } from 'react-redux'

import '~assets/todo.scss'

import { toogleTodo } from '../store/actions'

import Checkbox from './Checkbox'


const TodoItem = ({ task, onCompleted }) => {

  const classesList = [ 'list-group-item' ]

  if (task.completed) {
    classesList.push('task-completed')
  }

  // console.log(dispatch)

  const TestFunction = (e) => {
    console.log('TestFunction', e)
  }

  return <li
    className={classesList.join(' ')}  
    /* className={
      'list-group-item': true,
      'task-completed': task.completed
    } */
    key={task.id}>
    <Checkbox
      id={`task-${task.id}`}
      label={task.name}
      value={task.completed} onChange={onCompleted} />
  </li>
}

const TodoList = ({ todo, onCompletedTodo }) => {
  // console.log(dispatch)
  const todoNode = todo.map((task, key) => {
    return <TodoItem task={task} key={key} onCompleted={() => onCompletedTodo(task.id)}/>
  })

  return <ul className="list-group">{todoNode}</ul>
}


const mapStateTodos = state => {
  return state
}

const mapStateOnCompleted = dispatch => {
  return {
    onCompletedTodo: id => {
      dispatch(toogleTodo(id))
    }
  }
}


const TodoListConnect = connect(
  mapStateTodos,
  mapStateOnCompleted
) (TodoList)
<commit_msg>implemetando empty msg<commit_after>import React from 'react'
import { connect } from 'react-redux'

import '~assets/todo.scss'

import { toogleTodo } from '../store/actions'

import Checkbox from './Checkbox'


const TodoItem = ({ task, onCompleted }) => {

  const classesList = [ 'list-group-item' ]

  if (task.completed) {
    classesList.push('task-completed')
  }

  // console.log(dispatch)

  const TestFunction = (e) => {
    console.log('TestFunction', e)
  }

  return <li
    className={classesList.join(' ')}  
    /* className={
      'list-group-item': true,
      'task-completed': task.completed
    } */
    key={task.id}>
    <Checkbox
      id={`task-${task.id}`}
      label={task.name}
      value={task.completed} onChange={onCompleted} />
  </li>
}

const TodoList = ({ todo, onCompletedTodo }) => {
  // console.log(dispatch)
  const todoNode = todo.map((task, key) => {
    return <TodoItem task={task} key={key} onCompleted={() => onCompletedTodo(task.id)}/>
  })

  if (!todoNode.length) {
    todoNode.push(<li className="list-group-item text-center">Nenhuma tarefa encontrada</li>)
  }

  return <ul className="list-group">{todoNode}</ul>
}


const mapStateTodos = state => {
  return state
}

const mapStateOnCompleted = dispatch => {
  return {
    onCompletedTodo: id => {
      dispatch(toogleTodo(id))
    }
  }
}


const TodoListConnect = connect(
  mapStateTodos,
  mapStateOnCompleted
) (TodoList)

{'fraction_non_alphanumeric': 0.16423357664233576, 'fraction_numerical': 0.0, 'mean_word_length': 3.2895148669796557, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 33, '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': '6314189', 'n_tokens_mistral': 962, 'n_tokens_neox': 937, 'n_words': 179}