mirror of
https://github.com/plankanban/planka.git
synced 2025-12-28 17:24:59 +03:00
ref: Remove board types, refactoring
This commit is contained in:
34
client/src/containers/BoardContainer.js
Executable file
34
client/src/containers/BoardContainer.js
Executable file
@@ -0,0 +1,34 @@
|
||||
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,
|
||||
},
|
||||
dispatch,
|
||||
);
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Board);
|
||||
Reference in New Issue
Block a user