mirror of
https://github.com/plankanban/planka.git
synced 2025-07-20 13:49:43 +02:00
31 lines
765 B
JavaScript
31 lines
765 B
JavaScript
|
import { bindActionCreators } from 'redux';
|
||
|
import { connect } from 'react-redux';
|
||
|
|
||
|
import { currentUserSelector, pathSelector, projectsForCurrentUserSelector } from '../selectors';
|
||
|
import { openAddProjectModal } from '../actions/entry';
|
||
|
import Projects from '../components/Projects';
|
||
|
|
||
|
const mapStateToProps = (state) => {
|
||
|
const { projectId } = pathSelector(state);
|
||
|
const { isAdmin } = currentUserSelector(state);
|
||
|
const projects = projectsForCurrentUserSelector(state);
|
||
|
|
||
|
return {
|
||
|
items: projects,
|
||
|
currentId: projectId,
|
||
|
isEditable: isAdmin,
|
||
|
};
|
||
|
};
|
||
|
|
||
|
const mapDispatchToProps = (dispatch) => bindActionCreators(
|
||
|
{
|
||
|
onAdd: openAddProjectModal,
|
||
|
},
|
||
|
dispatch,
|
||
|
);
|
||
|
|
||
|
export default connect(
|
||
|
mapStateToProps,
|
||
|
mapDispatchToProps,
|
||
|
)(Projects);
|