mastodon/app/javascript/flavours/glitch/features/report/containers/status_check_box_container.js

20 lines
613 B
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import StatusCheckBox from '../components/status_check_box';
2017-12-04 01:26:40 -06:00
import { toggleStatusReport } from 'flavours/glitch/actions/reports';
import { Set as ImmutableSet } from 'immutable';
const mapStateToProps = (state, { id }) => ({
status: state.getIn(['statuses', id]),
checked: state.getIn(['reports', 'new', 'status_ids'], ImmutableSet()).includes(id),
});
const mapDispatchToProps = (dispatch, { id }) => ({
onToggle (e) {
dispatch(toggleStatusReport(id, e.target.checked));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(StatusCheckBox);