<commit_before>import { PropTypes }, React from 'react'
import { propTypes as actionsTypes } from '../constants/Todos'
import { propTypes as stateTypes } from '../constants/TodoSkel'
import SingleFormInput from './SingleFormInput'

const Todo = props => {
	const todo = props.children
	const done = (todo.done ? "[x]" : "[ ]")
	const entry = {}

	if (props.editing){
		entry = 
			<SingleFormInput
				onSubmit={ e => { props.actions.setEdited(todo, e.value) } }
				onChange={ e => { props.actions.edit(todo, e.value) } }
				noButton={true}
				value={todo.content}
				focus={todo.focus}
			/>
		)
	}
	else {
		entry = (
			<code onDoubleClick={ e => { props.actions.setEditing(todo) } }>
				{todo.content}
			</code>
		)
	}

	return (
		<div>
			{entry}
			<button onClick={ e => { props.actions.doIt(todo) } }>{done}</button>
			<button onClick={ e => { props.actions.del(todo) } }>DELETE</button>
		</div>
	)
}

Todo.propTypes = {
	editing:	PropTypes.bool,
	children:	stateTypes,
	actions:	actionsTypes
}

export default Todo<commit_msg>add isRequired in Todo.propTypes<commit_after>import { PropTypes }, React from 'react'
import { propTypes as actionsTypes } from '../constants/Todos'
import { propTypes as stateTypes } from '../constants/TodoSkel'
import SingleFormInput from './SingleFormInput'

const Todo = props => {
	const todo = props.children
	const done = (todo.done ? "[x]" : "[ ]")
	const entry = {}

	if (props.editing){
		entry = 
			<SingleFormInput
				onSubmit={ e => { props.actions.setEdited(todo, e.value) } }
				onChange={ e => { props.actions.edit(todo, e.value) } }
				noButton={true}
				value={todo.content}
				focus={todo.focus}
			/>
		)
	}
	else {
		entry = (
			<code onDoubleClick={ e => { props.actions.setEditing(todo) } }>
				{todo.content}
			</code>
		)
	}

	return (
		<div>
			{entry}
			<button onClick={ e => { props.actions.doIt(todo) } }>{done}</button>
			<button onClick={ e => { props.actions.del(todo) } }>DELETE</button>
		</div>
	)
}

Todo.propTypes = {
	editing:	PropTypes.bool,
	children:	stateTypes.isRequired,
	actions:	actionsTypes.isRequired
}

export default Todo
{'fraction_non_alphanumeric': 0.16674495068107092, 'fraction_numerical': 0.0, 'mean_word_length': 3.3917525773195876, 'pattern_counts': {'":': 0, '<': 21, '<?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': '2093303', 'n_tokens_mistral': 851, 'n_tokens_neox': 774, 'n_words': 162}