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

ref: Refactoring

This commit is contained in:
Maksim Eltyshev 2022-08-04 13:31:14 +02:00
parent aa4723d7fe
commit 3f8216dca8
189 changed files with 3781 additions and 3486 deletions

View file

@ -3,56 +3,18 @@ import { connect } from 'react-redux';
import { push } from 'connected-react-router';
import omit from 'lodash/omit';
import {
actionsForCurrentCardSelector,
attachmentsForCurrentCardSelector,
currentCardSelector,
isCurrentUserManagerForCurrentProjectSelector,
isCurrentUserMemberForCurrentBoardSelector,
labelsForCurrentBoardSelector,
labelsForCurrentCardSelector,
membershipsForCurrentBoardSelector,
pathSelector,
projectsToListsForCurrentUserSelector,
tasksForCurrentCardSelector,
usersForCurrentCardSelector,
} from '../selectors';
import {
addLabelToCurrentCard,
addUserToCurrentCard,
createAttachmentInCurrentCard,
createCommentActionInCurrentCard,
createLabelInCurrentBoard,
createTaskInCurrentCard,
deleteAttachment,
deleteCommentAction,
deleteCurrentCard,
deleteLabel,
deleteTask,
fetchActionsInCurrentCard,
fetchBoard,
moveCurrentCard,
moveTask,
removeLabelFromCurrentCard,
removeUserFromCurrentCard,
toggleActionsDetailsInCurrentCard,
transferCurrentCard,
updateAttachment,
updateCommentAction,
updateCurrentCard,
updateLabel,
updateTask,
} from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import Paths from '../constants/Paths';
import CardModal from '../components/CardModal';
const mapStateToProps = (state) => {
const { projectId } = pathSelector(state);
const allProjectsToLists = projectsToListsForCurrentUserSelector(state);
const isCurrentUserManager = isCurrentUserManagerForCurrentProjectSelector(state);
const allBoardMemberships = membershipsForCurrentBoardSelector(state);
const allLabels = labelsForCurrentBoardSelector(state);
const isCurrentUserMember = isCurrentUserMemberForCurrentBoardSelector(state);
const { projectId } = selectors.selectPath(state);
const allProjectsToLists = selectors.selectProjectsToListsForCurrentUser(state);
const isCurrentUserManager = selectors.selectIsCurrentUserManagerForCurrentProject(state);
const allBoardMemberships = selectors.selectMembershipsForCurrentBoard(state);
const allLabels = selectors.selectLabelsForCurrentBoard(state);
const isCurrentUserMember = selectors.selectIsCurrentUserMemberForCurrentBoard(state);
const {
name,
@ -60,19 +22,19 @@ const mapStateToProps = (state) => {
dueDate,
timer,
isSubscribed,
isActionsFetching,
isActionsDetailsVisible,
isActionsDetailsFetching,
isAllActionsFetched,
isActivitiesFetching,
isAllActivitiesFetched,
isActivitiesDetailsVisible,
isActivitiesDetailsFetching,
boardId,
listId,
} = currentCardSelector(state);
} = selectors.selectCurrentCard(state);
const users = usersForCurrentCardSelector(state);
const labels = labelsForCurrentCardSelector(state);
const tasks = tasksForCurrentCardSelector(state);
const attachments = attachmentsForCurrentCardSelector(state);
const actions = actionsForCurrentCardSelector(state);
const users = selectors.selectUsersForCurrentCard(state);
const labels = selectors.selectLabelsForCurrentCard(state);
const tasks = selectors.selectTasksForCurrentCard(state);
const attachments = selectors.selectAttachmentsForCurrentCard(state);
const activities = selectors.selectActivitiesForCurrentCard(state);
return {
name,
@ -80,10 +42,10 @@ const mapStateToProps = (state) => {
dueDate,
timer,
isSubscribed,
isActionsFetching,
isAllActionsFetched,
isActionsDetailsVisible,
isActionsDetailsFetching,
isActivitiesFetching,
isAllActivitiesFetched,
isActivitiesDetailsVisible,
isActivitiesDetailsFetching,
listId,
boardId,
projectId,
@ -91,42 +53,42 @@ const mapStateToProps = (state) => {
labels,
tasks,
attachments,
actions,
activities,
allProjectsToLists,
allBoardMemberships,
allLabels,
canEdit: isCurrentUserMember,
canEditAllCommentActions: isCurrentUserManager,
canEditAllCommentActivities: isCurrentUserManager,
};
};
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onUpdate: updateCurrentCard,
onMove: moveCurrentCard,
onTransfer: transferCurrentCard,
onDelete: deleteCurrentCard,
onUserAdd: addUserToCurrentCard,
onUserRemove: removeUserFromCurrentCard,
onBoardFetch: fetchBoard,
onLabelAdd: addLabelToCurrentCard,
onLabelRemove: removeLabelFromCurrentCard,
onLabelCreate: createLabelInCurrentBoard,
onLabelUpdate: updateLabel,
onLabelDelete: deleteLabel,
onTaskCreate: createTaskInCurrentCard,
onTaskUpdate: updateTask,
onTaskMove: moveTask,
onTaskDelete: deleteTask,
onAttachmentCreate: createAttachmentInCurrentCard,
onAttachmentUpdate: updateAttachment,
onAttachmentDelete: deleteAttachment,
onActionsFetch: fetchActionsInCurrentCard,
onActionsDetailsToggle: toggleActionsDetailsInCurrentCard,
onCommentActionCreate: createCommentActionInCurrentCard,
onCommentActionUpdate: updateCommentAction,
onCommentActionDelete: deleteCommentAction,
onUpdate: entryActions.updateCurrentCard,
onMove: entryActions.moveCurrentCard,
onTransfer: entryActions.transferCurrentCard,
onDelete: entryActions.deleteCurrentCard,
onUserAdd: entryActions.addUserToCurrentCard,
onUserRemove: entryActions.removeUserFromCurrentCard,
onBoardFetch: entryActions.fetchBoard,
onLabelAdd: entryActions.addLabelToCurrentCard,
onLabelRemove: entryActions.removeLabelFromCurrentCard,
onLabelCreate: entryActions.createLabelInCurrentBoard,
onLabelUpdate: entryActions.updateLabel,
onLabelDelete: entryActions.deleteLabel,
onTaskCreate: entryActions.createTaskInCurrentCard,
onTaskUpdate: entryActions.updateTask,
onTaskMove: entryActions.moveTask,
onTaskDelete: entryActions.deleteTask,
onAttachmentCreate: entryActions.createAttachmentInCurrentCard,
onAttachmentUpdate: entryActions.updateAttachment,
onAttachmentDelete: entryActions.deleteAttachment,
onActivitiesFetch: entryActions.fetchActivitiesInCurrentCard,
onActivitiesDetailsToggle: entryActions.toggleActivitiesDetailsInCurrentCard,
onCommentActivityCreate: entryActions.createCommentActivityInCurrentCard,
onCommentActivityUpdate: entryActions.updateCommentActivity,
onCommentActivityDelete: entryActions.deleteCommentActivity,
push,
},
dispatch,