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.
planka_custom/client/src/containers/BoardContainer.js

36 lines
1.1 KiB
JavaScript

import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import { BoardMembershipRoles } from '../constants/Enums';
import Board from '../components/Board';
const mapStateToProps = (state) => {
const { cardId } = selectors.selectPath(state);
const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state);
const listIds = selectors.selectListIdsForCurrentBoard(state);
const isCurrentUserEditor =
!!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR;
return {
listIds,
isCardModalOpened: !!cardId,
canEdit: isCurrentUserEditor,
};
};
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onListCreate: entryActions.createListInCurrentBoard,
onListMove: entryActions.moveList,
onCardMove: entryActions.moveCard,
onCardCopy: entryActions.copyCard,
},
dispatch,
);
export default connect(mapStateToProps, mapDispatchToProps)(Board);