import React, { PropTypes } from 'react'
import map from 'lodash/collection/map'
import size from 'lodash/collection/size'

export default function Degub({students, areas, actions}) {
	console.log('degub.render', [size(students), size(areas), size(actions)])
	return (
		<div>
			<button disabled={students.past.length === 0} onClick={actions.undo}>Undo</button>
			<button disabled={students.future.length === 0} onClick={actions.redo}>Redo</button>
			<ul>
				{map(students.present, (s, i) =>
					<li key={i}>{s.id} {s.name}</li>)}
			</ul>
			<ul>
				{map(areas, (s, i) =>
					<li key={i}>{s.name} ({s.revision})</li>)}
			</ul>
		</div>
	)
}
Degub.propTypes = {
	actions: PropTypes.objectOf(PropTypes.func).isRequired,
	areas: PropTypes.array.isRequired,
	students: PropTypes.shape({ // a history object!
		past: PropTypes.arrayOf(PropTypes.object),
		present: PropTypes.object,
		future: PropTypes.arrayOf(PropTypes.object),
	}),
}

@@ -643,16 +643,17 @@
 v%3E%0A%09)%0A%7D%0A
+%0A
 Degub.pr
@@ -931,12 +931,90 @@
 ct),%0A%09%7D)
+.isRequired,%0A%7D%0A%0ADegub.defaultProps = %7B%0A%09students: %7B%7D,%0A%09areas: %5B%5D,%0A%09actions: %7B%7D
 ,%0A%7D%0A

add defaultprops to Degub