2019-08-31 04:07:25 +05:00
|
|
|
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';
|
2022-08-19 14:00:40 +02:00
|
|
|
import { BoardMembershipRoles } from '../constants/Enums';
|
2020-08-04 01:32:46 +05:00
|
|
|
import BoardKanban from '../components/BoardKanban';
|
2019-08-31 04:07:25 +05:00
|
|
|
|
2020-03-25 00:15:47 +05:00
|
|
|
const mapStateToProps = (state) => {
|
2022-08-04 13:31:14 +02:00
|
|
|
const { cardId } = selectors.selectPath(state);
|
2022-08-19 14:00:40 +02:00
|
|
|
const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state);
|
2022-08-04 13:31:14 +02:00
|
|
|
const listIds = selectors.selectListIdsForCurrentBoard(state);
|
2019-08-31 04:07:25 +05:00
|
|
|
|
|
|
|
return {
|
|
|
|
listIds,
|
|
|
|
isCardModalOpened: !!cardId,
|
2022-08-19 14:00:40 +02:00
|
|
|
canEdit: !!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR,
|
2019-08-31 04:07:25 +05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-03-25 00:15:47 +05:00
|
|
|
const mapDispatchToProps = (dispatch) =>
|
2020-02-03 18:42:31 +05:00
|
|
|
bindActionCreators(
|
|
|
|
{
|
2022-08-04 13:31:14 +02:00
|
|
|
onListCreate: entryActions.createListInCurrentBoard,
|
|
|
|
onListMove: entryActions.moveList,
|
|
|
|
onCardMove: entryActions.moveCard,
|
2020-02-03 18:42:31 +05:00
|
|
|
},
|
|
|
|
dispatch,
|
|
|
|
);
|
2019-08-31 04:07:25 +05:00
|
|
|
|
2020-08-04 01:32:46 +05:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(BoardKanban);
|