import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import selectors from '../selectors'; import entryActions from '../entry-actions'; import BoardActions from '../components/BoardActions'; const mapStateToProps = (state) => { const allUsers = selectors.selectUsers(state); const isCurrentUserManager = selectors.selectIsCurrentUserManagerForCurrentProject(state); const memberships = selectors.selectMembershipsForCurrentBoard(state); const labels = selectors.selectLabelsForCurrentBoard(state); const filterUsers = selectors.selectFilterUsersForCurrentBoard(state); const filterLabels = selectors.selectFilterLabelsForCurrentBoard(state); return { memberships, labels, filterUsers, filterLabels, allUsers, canEditMemberships: isCurrentUserManager, }; }; const mapDispatchToProps = (dispatch) => bindActionCreators( { onMembershipCreate: entryActions.createMembershipInCurrentBoard, onMembershipDelete: entryActions.deleteBoardMembership, onUserToFilterAdd: entryActions.addUserToFilterInCurrentBoard, onUserFromFilterRemove: entryActions.removeUserFromFilterInCurrentBoard, onLabelToFilterAdd: entryActions.addLabelToFilterInCurrentBoard, onLabelFromFilterRemove: entryActions.removeLabelFromFilterInCurrentBoard, onLabelCreate: entryActions.createLabelInCurrentBoard, onLabelUpdate: entryActions.updateLabel, onLabelDelete: entryActions.deleteLabel, }, dispatch, ); export default connect(mapStateToProps, mapDispatchToProps)(BoardActions);