diff --git a/src/actions/people_actions.js b/src/actions/people_actions.js index b758c2b..1176a7d 100644 --- a/src/actions/people_actions.js +++ b/src/actions/people_actions.js @@ -4,7 +4,8 @@ var Actions = Reflux.createActions([ 'add', 'remove', 'shuffle', - 'nextDriver' + 'nextDriver', + 'selectDriver' ]); export default Actions; diff --git a/src/components/person.js b/src/components/person.js index 3e81a23..0266746 100644 --- a/src/components/person.js +++ b/src/components/person.js @@ -3,10 +3,14 @@ import PeopleActions from '../actions/people_actions'; import ClassNames from 'classnames'; class Person extends React.Component { - handleClick() { + remove() { PeopleActions.remove(this.props.index); } + select() { + PeopleActions.selectDriver(this.props.index); + } + render() { var classes = ClassNames({ active: this.props.isCurrent @@ -14,12 +18,12 @@ class Person extends React.Component { return (
  • - x - {this.props.name} + x + {this.props.name}
  • ); } -}; +} Person.propTypes = { name: React.PropTypes.string.isRequired diff --git a/src/stores/people_store.js b/src/stores/people_store.js index 28b08ec..d94040b 100644 --- a/src/stores/people_store.js +++ b/src/stores/people_store.js @@ -23,7 +23,6 @@ var Store = Reflux.createStore({ }, // Actions - onAdd(name) { if (name.length > 0) { this.people.push(name); @@ -51,6 +50,13 @@ var Store = Reflux.createStore({ this.trigger(); }, + onSelectDriver(index) { + this.currentDriverIndex = index; + + this.commitCurrentDriver(); + this.trigger(); + }, + onNextDriver() { this.currentDriverIndex += 1; if (this.currentDriverIndex >= this.people.length) {