2019-08-31 04:07:25 +05:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import {
|
|
|
|
filterLabelsForCurrentBoardSelector,
|
|
|
|
filterUsersForCurrentBoardSelector,
|
|
|
|
labelsForCurrentBoardSelector,
|
|
|
|
listIdsForCurrentBoardSelector,
|
|
|
|
membershipsForCurrentProjectSelector,
|
|
|
|
pathSelector,
|
|
|
|
} from '../selectors';
|
|
|
|
import {
|
|
|
|
addLabelToFilterInCurrentBoard,
|
|
|
|
addUserToFilterInCurrentBoard,
|
|
|
|
createLabelInCurrentBoard,
|
|
|
|
createListInCurrentBoard,
|
|
|
|
deleteLabel,
|
|
|
|
moveCard,
|
|
|
|
moveList,
|
|
|
|
removeLabelFromFilterInCurrentBoard,
|
|
|
|
removeUserFromFilterInCurrentBoard,
|
|
|
|
updateLabel,
|
|
|
|
} from '../actions/entry';
|
|
|
|
import Board from '../components/Board';
|
|
|
|
|
2020-02-03 18:42:31 +05:00
|
|
|
const mapStateToProps = state => {
|
2019-08-31 04:07:25 +05:00
|
|
|
const { cardId } = pathSelector(state);
|
|
|
|
const allProjectMemberships = membershipsForCurrentProjectSelector(state);
|
|
|
|
const listIds = listIdsForCurrentBoardSelector(state);
|
|
|
|
const allLabels = labelsForCurrentBoardSelector(state);
|
|
|
|
const filterUsers = filterUsersForCurrentBoardSelector(state);
|
|
|
|
const filterLabels = filterLabelsForCurrentBoardSelector(state);
|
|
|
|
|
|
|
|
return {
|
|
|
|
listIds,
|
|
|
|
filterUsers,
|
|
|
|
filterLabels,
|
|
|
|
allProjectMemberships,
|
|
|
|
allLabels,
|
|
|
|
isCardModalOpened: !!cardId,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-02-03 18:42:31 +05:00
|
|
|
const mapDispatchToProps = dispatch =>
|
|
|
|
bindActionCreators(
|
|
|
|
{
|
|
|
|
onListCreate: createListInCurrentBoard,
|
|
|
|
onCardMove: moveCard,
|
|
|
|
onListMove: moveList,
|
|
|
|
onUserToFilterAdd: addUserToFilterInCurrentBoard,
|
|
|
|
onUserFromFilterRemove: removeUserFromFilterInCurrentBoard,
|
|
|
|
onLabelToFilterAdd: addLabelToFilterInCurrentBoard,
|
|
|
|
onLabelFromFilterRemove: removeLabelFromFilterInCurrentBoard,
|
|
|
|
onLabelCreate: createLabelInCurrentBoard,
|
|
|
|
onLabelUpdate: updateLabel,
|
|
|
|
onLabelDelete: deleteLabel,
|
|
|
|
},
|
|
|
|
dispatch,
|
|
|
|
);
|
2019-08-31 04:07:25 +05:00
|
|
|
|
2020-02-03 18:42:31 +05:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Board);
|