1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-29 01:59:42 +02:00
planka/client/src/containers/BoardActionsContainer.js

43 lines
1.6 KiB
JavaScript
Raw Normal View History

import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
2022-08-04 13:31:14 +02:00
import selectors from '../selectors';
import entryActions from '../entry-actions';
import BoardActions from '../components/BoardActions';
const mapStateToProps = (state) => {
2022-08-04 13:31:14 +02:00
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(
{
2022-08-04 13:31:14 +02:00
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);