2019-08-31 04:07:25 +05:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import {
|
2021-06-24 01:05:22 +05:00
|
|
|
isCurrentUserMemberForCurrentBoardSelector,
|
2019-08-31 04:07:25 +05:00
|
|
|
listIdsForCurrentBoardSelector,
|
|
|
|
pathSelector,
|
|
|
|
} from '../selectors';
|
2021-06-24 01:05:22 +05:00
|
|
|
import { createListInCurrentBoard, moveCard, moveList } from '../actions/entry';
|
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) => {
|
2019-08-31 04:07:25 +05:00
|
|
|
const { cardId } = pathSelector(state);
|
2021-06-24 01:05:22 +05:00
|
|
|
const isCurrentUserMember = isCurrentUserMemberForCurrentBoardSelector(state);
|
2020-08-04 01:32:46 +05:00
|
|
|
const listIds = listIdsForCurrentBoardSelector(state);
|
2019-08-31 04:07:25 +05:00
|
|
|
|
|
|
|
return {
|
|
|
|
listIds,
|
|
|
|
isCardModalOpened: !!cardId,
|
2021-06-24 01:05:22 +05:00
|
|
|
canEdit: isCurrentUserMember,
|
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(
|
|
|
|
{
|
|
|
|
onListCreate: createListInCurrentBoard,
|
|
|
|
onListMove: moveList,
|
2020-08-04 01:32:46 +05:00
|
|
|
onCardMove: 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);
|