|
|
|
|
@ -1,7 +1,12 @@
|
|
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
import omit from 'lodash/omit';
|
|
|
|
|
|
|
|
|
|
import { makeCardIdsByListIdSelector, makeListByIdSelector } from '../selectors';
|
|
|
|
|
import {
|
|
|
|
|
isAnyFilterActiveForCurrentBoardSelector,
|
|
|
|
|
makeCardIdsByListIdSelector,
|
|
|
|
|
makeListByIdSelector,
|
|
|
|
|
} from '../selectors';
|
|
|
|
|
import { createCard, deleteList, updateList } from '../actions/entry';
|
|
|
|
|
import List from '../components/List';
|
|
|
|
|
|
|
|
|
|
@ -12,6 +17,7 @@ const makeMapStateToProps = () => {
|
|
|
|
|
return (state, { id, index }) => {
|
|
|
|
|
const { name, isPersisted } = listByIdSelector(state, id);
|
|
|
|
|
const cardIds = cardIdsByListIdSelector(state, id);
|
|
|
|
|
const isAnyFilterActive = isAnyFilterActiveForCurrentBoardSelector(state);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
id,
|
|
|
|
|
@ -19,6 +25,7 @@ const makeMapStateToProps = () => {
|
|
|
|
|
name,
|
|
|
|
|
isPersisted,
|
|
|
|
|
cardIds,
|
|
|
|
|
isDeletable: !isAnyFilterActive,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
@ -33,4 +40,9 @@ const mapDispatchToProps = (dispatch, { id }) =>
|
|
|
|
|
dispatch,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default connect(makeMapStateToProps, mapDispatchToProps)(List);
|
|
|
|
|
const mergeProps = (stateProps, dispatchProps) => ({
|
|
|
|
|
...omit(stateProps, 'isDeletable'),
|
|
|
|
|
...(stateProps.isDeletable ? dispatchProps : omit(dispatchProps, 'onDelete')),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default connect(makeMapStateToProps, mapDispatchToProps, mergeProps)(List);
|
|
|
|
|
|