1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00

Change user size on card, save card description on click outside, prevent list deletion if any filter is active

This commit is contained in:
Maksim Eltyshev 2020-04-30 05:27:46 +05:00
parent febc614ce8
commit ba2017705b
11 changed files with 74 additions and 38 deletions

View file

@ -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);