You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
975 B
JavaScript
36 lines
975 B
JavaScript
import { bindActionCreators } from 'redux';
|
|
import { connect } from 'react-redux';
|
|
|
|
import {
|
|
boardsForCurrentProjectSelector,
|
|
isCurrentUserManagerForCurrentProjectSelector,
|
|
pathSelector,
|
|
} from '../selectors';
|
|
import { createBoardInCurrentProject, deleteBoard, moveBoard, updateBoard } from '../actions/entry';
|
|
import Boards from '../components/Boards';
|
|
|
|
const mapStateToProps = (state) => {
|
|
const { boardId } = pathSelector(state);
|
|
const boards = boardsForCurrentProjectSelector(state);
|
|
const isCurrentUserManager = isCurrentUserManagerForCurrentProjectSelector(state);
|
|
|
|
return {
|
|
items: boards,
|
|
currentId: boardId,
|
|
canEdit: isCurrentUserManager,
|
|
};
|
|
};
|
|
|
|
const mapDispatchToProps = (dispatch) =>
|
|
bindActionCreators(
|
|
{
|
|
onCreate: createBoardInCurrentProject,
|
|
onUpdate: updateBoard,
|
|
onMove: moveBoard,
|
|
onDelete: deleteBoard,
|
|
},
|
|
dispatch,
|
|
);
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Boards);
|