2017-02-14 14:59:26 -05:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import StatusCheckBox from '../components/status_check_box';
|
|
|
|
import { toggleStatusReport } from '../../../actions/reports';
|
2017-07-10 19:00:14 -04:00
|
|
|
import { Set as ImmutableSet } from 'immutable';
|
2017-02-14 14:59:26 -05:00
|
|
|
|
|
|
|
const mapStateToProps = (state, { id }) => ({
|
|
|
|
status: state.getIn(['statuses', id]),
|
2017-07-10 19:00:14 -04:00
|
|
|
checked: state.getIn(['reports', 'new', 'status_ids'], ImmutableSet()).includes(id),
|
2017-02-14 14:59:26 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch, { id }) => ({
|
|
|
|
|
|
|
|
onToggle (e) {
|
|
|
|
dispatch(toggleStatusReport(id, e.target.checked));
|
2017-05-20 11:31:47 -04:00
|
|
|
},
|
2017-02-14 14:59:26 -05:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(StatusCheckBox);
|