1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59: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

@ -1,22 +0,0 @@
import ActionTypes from '../constants/ActionTypes';
export const handleActionCreate = (action) => ({
type: ActionTypes.ACTION_CREATE_HANDLE,
payload: {
action,
},
});
export const handleActionUpdate = (action) => ({
type: ActionTypes.ACTION_UPDATE_HANDLE,
payload: {
action,
},
});
export const handleActionDelete = (action) => ({
type: ActionTypes.ACTION_DELETE_HANDLE,
payload: {
action,
},
});

View file

@ -1,50 +0,0 @@
import ActionTypes from '../constants/ActionTypes';
export const fetchActions = (cardId) => ({
type: ActionTypes.ACTIONS_FETCH,
payload: {
cardId,
},
});
fetchActions.success = (cardId, actions, users) => ({
type: ActionTypes.ACTIONS_FETCH__SUCCESS,
payload: {
cardId,
actions,
users,
},
});
fetchActions.failure = (cardId, error) => ({
type: ActionTypes.ACTIONS_FETCH__FAILURE,
payload: {
cardId,
error,
},
});
export const toggleActionsDetails = (cardId, isVisible) => ({
type: ActionTypes.ACTIONS_DETAILS_TOGGLE,
payload: {
cardId,
isVisible,
},
});
toggleActionsDetails.success = (cardId, actions, users) => ({
type: ActionTypes.ACTIONS_DETAILS_TOGGLE__SUCCESS,
payload: {
cardId,
actions,
users,
},
});
toggleActionsDetails.failure = (cardId, error) => ({
type: ActionTypes.ACTIONS_DETAILS_TOGGLE__FAILURE,
payload: {
cardId,
error,
},
});

View file

@ -0,0 +1,79 @@
import ActionTypes from '../constants/ActionTypes';
const fetchActivities = (cardId) => ({
type: ActionTypes.ACTIVITIES_FETCH,
payload: {
cardId,
},
});
fetchActivities.success = (cardId, activities, users) => ({
type: ActionTypes.ACTIVITIES_FETCH__SUCCESS,
payload: {
cardId,
activities,
users,
},
});
fetchActivities.failure = (cardId, error) => ({
type: ActionTypes.ACTIVITIES_FETCH__FAILURE,
payload: {
cardId,
error,
},
});
const toggleActivitiesDetails = (cardId, isVisible) => ({
type: ActionTypes.ACTIVITIES_DETAILS_TOGGLE,
payload: {
cardId,
isVisible,
},
});
toggleActivitiesDetails.success = (cardId, activities, users) => ({
type: ActionTypes.ACTIVITIES_DETAILS_TOGGLE__SUCCESS,
payload: {
cardId,
activities,
users,
},
});
toggleActivitiesDetails.failure = (cardId, error) => ({
type: ActionTypes.ACTIVITIES_DETAILS_TOGGLE__FAILURE,
payload: {
cardId,
error,
},
});
const handleActivityCreate = (activity) => ({
type: ActionTypes.ACTIVITY_CREATE_HANDLE,
payload: {
activity,
},
});
const handleActivityUpdate = (activity) => ({
type: ActionTypes.ACTIVITY_UPDATE_HANDLE,
payload: {
activity,
},
});
const handleActivityDelete = (activity) => ({
type: ActionTypes.ACTIVITY_DELETE_HANDLE,
payload: {
activity,
},
});
export default {
fetchActivities,
toggleActivitiesDetails,
handleActivityCreate,
handleActivityUpdate,
handleActivityDelete,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createAttachment = (attachment) => ({
const createAttachment = (attachment) => ({
type: ActionTypes.ATTACHMENT_CREATE,
payload: {
attachment,
@ -23,14 +23,14 @@ createAttachment.failure = (localId, error) => ({
},
});
export const handleAttachmentCreate = (attachment) => ({
const handleAttachmentCreate = (attachment) => ({
type: ActionTypes.ATTACHMENT_CREATE_HANDLE,
payload: {
attachment,
},
});
export const updateAttachment = (id, data) => ({
const updateAttachment = (id, data) => ({
type: ActionTypes.ATTACHMENT_UPDATE,
payload: {
id,
@ -53,14 +53,14 @@ updateAttachment.failure = (id, error) => ({
},
});
export const handleAttachmentUpdate = (attachment) => ({
const handleAttachmentUpdate = (attachment) => ({
type: ActionTypes.ATTACHMENT_UPDATE_HANDLE,
payload: {
attachment,
},
});
export const deleteAttachment = (id) => ({
const deleteAttachment = (id) => ({
type: ActionTypes.ATTACHMENT_DELETE,
payload: {
id,
@ -82,9 +82,18 @@ deleteAttachment.failure = (id, error) => ({
},
});
export const handleAttachmentDelete = (attachment) => ({
const handleAttachmentDelete = (attachment) => ({
type: ActionTypes.ATTACHMENT_DELETE_HANDLE,
payload: {
attachment,
},
});
export default {
createAttachment,
handleAttachmentCreate,
updateAttachment,
handleAttachmentUpdate,
deleteAttachment,
handleAttachmentDelete,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createBoardMembership = (boardMembership) => ({
const createBoardMembership = (boardMembership) => ({
type: ActionTypes.BOARD_MEMBERSHIP_CREATE,
payload: {
boardMembership,
@ -23,7 +23,7 @@ createBoardMembership.failure = (localId, error) => ({
},
});
export const handleBoardMembershipCreate = (
const handleBoardMembershipCreate = (
boardMembership,
project,
board,
@ -38,6 +38,7 @@ export const handleBoardMembershipCreate = (
cardLabels,
tasks,
attachments,
deletedNotifications,
) => ({
type: ActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE,
payload: {
@ -55,6 +56,7 @@ export const handleBoardMembershipCreate = (
cardLabels,
tasks,
attachments,
deletedNotifications,
},
});
@ -67,7 +69,7 @@ handleBoardMembershipCreate.fetchProject = (id, currentUserId, currentBoardId) =
},
});
export const deleteBoardMembership = (id) => ({
const deleteBoardMembership = (id) => ({
type: ActionTypes.BOARD_MEMBERSHIP_DELETE,
payload: {
id,
@ -89,9 +91,16 @@ deleteBoardMembership.failure = (id, error) => ({
},
});
export const handleBoardMembershipDelete = (boardMembership) => ({
const handleBoardMembershipDelete = (boardMembership) => ({
type: ActionTypes.BOARD_MEMBERSHIP_DELETE_HANDLE,
payload: {
boardMembership,
},
});
export default {
createBoardMembership,
handleBoardMembershipCreate,
deleteBoardMembership,
handleBoardMembershipDelete,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createBoard = (board) => ({
const createBoard = (board) => ({
type: ActionTypes.BOARD_CREATE,
payload: {
board,
@ -24,14 +24,14 @@ createBoard.failure = (localId, error) => ({
},
});
export const handleBoardCreate = (board) => ({
const handleBoardCreate = (board) => ({
type: ActionTypes.BOARD_CREATE_HANDLE,
payload: {
board,
},
});
export const fetchBoard = (id) => ({
const fetchBoard = (id) => ({
type: ActionTypes.BOARD_FETCH,
payload: {
id,
@ -75,7 +75,7 @@ fetchBoard.failure = (id, error) => ({
},
});
export const updateBoard = (id, data) => ({
const updateBoard = (id, data) => ({
type: ActionTypes.BOARD_UPDATE,
payload: {
id,
@ -98,14 +98,14 @@ updateBoard.failure = (id, error) => ({
},
});
export const handleBoardUpdate = (board) => ({
const handleBoardUpdate = (board) => ({
type: ActionTypes.BOARD_UPDATE_HANDLE,
payload: {
board,
},
});
export const deleteBoard = (id) => ({
const deleteBoard = (id) => ({
type: ActionTypes.BOARD_DELETE,
payload: {
id,
@ -127,9 +127,19 @@ deleteBoard.failure = (id, error) => ({
},
});
export const handleBoardDelete = (board) => ({
const handleBoardDelete = (board) => ({
type: ActionTypes.BOARD_DELETE_HANDLE,
payload: {
board,
},
});
export default {
createBoard,
handleBoardCreate,
fetchBoard,
updateBoard,
handleBoardUpdate,
deleteBoard,
handleBoardDelete,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createCard = (card) => ({
const createCard = (card) => ({
type: ActionTypes.CARD_CREATE,
payload: {
card,
@ -23,14 +23,14 @@ createCard.failure = (localId, error) => ({
},
});
export const handleCardCreate = (card) => ({
const handleCardCreate = (card) => ({
type: ActionTypes.CARD_CREATE_HANDLE,
payload: {
card,
},
});
export const updateCard = (id, data) => ({
const updateCard = (id, data) => ({
type: ActionTypes.CARD_UPDATE,
payload: {
id,
@ -53,14 +53,14 @@ updateCard.failure = (id, error) => ({
},
});
export const handleCardUpdate = (card) => ({
const handleCardUpdate = (card) => ({
type: ActionTypes.CARD_UPDATE_HANDLE,
payload: {
card,
},
});
export const deleteCard = (id) => ({
const deleteCard = (id) => ({
type: ActionTypes.CARD_DELETE,
payload: {
id,
@ -82,9 +82,18 @@ deleteCard.failure = (id, error) => ({
},
});
export const handleCardDelete = (card) => ({
const handleCardDelete = (card) => ({
type: ActionTypes.CARD_DELETE_HANDLE,
payload: {
card,
},
});
export default {
createCard,
handleCardCreate,
updateCard,
handleCardUpdate,
deleteCard,
handleCardDelete,
};

View file

@ -1,69 +0,0 @@
import ActionTypes from '../constants/ActionTypes';
export const createCommentAction = (action) => ({
type: ActionTypes.COMMENT_ACTION_CREATE,
payload: {
action,
},
});
createCommentAction.success = (localId, action) => ({
type: ActionTypes.COMMENT_ACTION_CREATE__SUCCESS,
payload: {
localId,
action,
},
});
createCommentAction.failure = (localId, error) => ({
type: ActionTypes.COMMENT_ACTION_CREATE__FAILURE,
payload: {
localId,
error,
},
});
export const updateCommentAction = (id, data) => ({
type: ActionTypes.COMMENT_ACTION_UPDATE,
payload: {
id,
data,
},
});
updateCommentAction.success = (action) => ({
type: ActionTypes.COMMENT_ACTION_UPDATE__SUCCESS,
payload: {
action,
},
});
updateCommentAction.failure = (id, error) => ({
type: ActionTypes.COMMENT_ACTION_UPDATE__FAILURE,
payload: {
id,
error,
},
});
export const deleteCommentAction = (id) => ({
type: ActionTypes.COMMENT_ACTION_DELETE,
payload: {
id,
},
});
deleteCommentAction.success = (action) => ({
type: ActionTypes.COMMENT_ACTION_DELETE__SUCCESS,
payload: {
action,
},
});
deleteCommentAction.failure = (id, error) => ({
type: ActionTypes.COMMENT_ACTION_DELETE__FAILURE,
payload: {
id,
error,
},
});

View file

@ -0,0 +1,75 @@
import ActionTypes from '../constants/ActionTypes';
const createCommentActivity = (activity) => ({
type: ActionTypes.COMMENT_ACTIVITY_CREATE,
payload: {
activity,
},
});
createCommentActivity.success = (localId, activity) => ({
type: ActionTypes.COMMENT_ACTIVITY_CREATE__SUCCESS,
payload: {
localId,
activity,
},
});
createCommentActivity.failure = (localId, error) => ({
type: ActionTypes.COMMENT_ACTIVITY_CREATE__FAILURE,
payload: {
localId,
error,
},
});
const updateCommentActivity = (id, data) => ({
type: ActionTypes.COMMENT_ACTIVITY_UPDATE,
payload: {
id,
data,
},
});
updateCommentActivity.success = (activity) => ({
type: ActionTypes.COMMENT_ACTIVITY_UPDATE__SUCCESS,
payload: {
activity,
},
});
updateCommentActivity.failure = (id, error) => ({
type: ActionTypes.COMMENT_ACTIVITY_UPDATE__FAILURE,
payload: {
id,
error,
},
});
const deleteCommentActivity = (id) => ({
type: ActionTypes.COMMENT_ACTIVITY_DELETE,
payload: {
id,
},
});
deleteCommentActivity.success = (activity) => ({
type: ActionTypes.COMMENT_ACTIVITY_DELETE__SUCCESS,
payload: {
activity,
},
});
deleteCommentActivity.failure = (id, error) => ({
type: ActionTypes.COMMENT_ACTIVITY_DELETE__FAILURE,
payload: {
id,
error,
},
});
export default {
createCommentActivity,
updateCommentActivity,
deleteCommentActivity,
};

View file

@ -1,7 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
// eslint-disable-next-line import/prefer-default-export
export const initializeCore = (
const initializeCore = (
user,
board,
users,
@ -16,7 +15,7 @@ export const initializeCore = (
cardLabels,
tasks,
attachments,
actions,
activities,
notifications,
) => ({
type: ActionTypes.CORE_INITIALIZE,
@ -35,7 +34,17 @@ export const initializeCore = (
cardLabels,
tasks,
attachments,
actions,
activities,
notifications,
},
});
const logout = () => ({
type: ActionTypes.LOGOUT,
payload: {},
});
export default {
initializeCore,
logout,
};

View file

@ -1,22 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const handleActionCreate = (action) => ({
type: EntryActionTypes.ACTION_CREATE_HANDLE,
payload: {
action,
},
});
export const handleActionUpdate = (action) => ({
type: EntryActionTypes.ACTION_UPDATE_HANDLE,
payload: {
action,
},
});
export const handleActionDelete = (action) => ({
type: EntryActionTypes.ACTION_DELETE_HANDLE,
payload: {
action,
},
});

View file

@ -1,13 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const fetchActionsInCurrentCard = () => ({
type: EntryActionTypes.ACTIONS_IN_CURRENT_CARD_FETCH,
payload: {},
});
export const toggleActionsDetailsInCurrentCard = (isVisible) => ({
type: EntryActionTypes.ACTIONS_DETAILS_IN_CURRENT_CARD_TOGGLE,
payload: {
isVisible,
},
});

View file

@ -1,29 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const createMembershipInCurrentBoard = (data) => ({
type: EntryActionTypes.MEMBERSHIP_IN_CURRENT_BOARD_CREATE,
payload: {
data,
},
});
export const handleBoardMembershipCreate = (boardMembership) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE,
payload: {
boardMembership,
},
});
export const deleteBoardMembership = (id) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_DELETE,
payload: {
id,
},
});
export const handleBoardMembershipDelete = (boardMembership) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_DELETE_HANDLE,
payload: {
boardMembership,
},
});

View file

@ -1,23 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const createCommentActionInCurrentCard = (data) => ({
type: EntryActionTypes.COMMENT_ACTION_IN_CURRENT_CARD_CREATE,
payload: {
data,
},
});
export const updateCommentAction = (id, data) => ({
type: EntryActionTypes.COMMENT_ACTION_UPDATE,
payload: {
id,
data,
},
});
export const deleteCommentAction = (id) => ({
type: EntryActionTypes.COMMENT_ACTION_DELETE,
payload: {
id,
},
});

View file

@ -1,7 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
// eslint-disable-next-line import/prefer-default-export
export const initializeCore = () => ({
type: EntryActionTypes.CORE_INITIALIZE,
payload: {},
});

View file

@ -1,18 +0,0 @@
export * from './socket';
export * from './login';
export * from './core';
export * from './modal';
export * from './user';
export * from './project';
export * from './project-manager';
export * from './board';
export * from './board-membership';
export * from './label';
export * from './list';
export * from './card';
export * from './task';
export * from './attachment';
export * from './actions';
export * from './action';
export * from './comment-action';
export * from './notification';

View file

@ -1,18 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const authenticate = (data) => ({
type: EntryActionTypes.AUTHENTICATE,
payload: {
data,
},
});
export const clearAuthenticateError = () => ({
type: EntryActionTypes.AUTHENTICATE_ERROR_CLEAR,
payload: {},
});
export const logout = () => ({
type: EntryActionTypes.LOGOUT,
payload: {},
});

View file

@ -1,22 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const handleNotificationCreate = (notification) => ({
type: EntryActionTypes.NOTIFICATION_CREATE_HANDLE,
payload: {
notification,
},
});
export const deleteNotification = (id) => ({
type: EntryActionTypes.NOTIFICATION_DELETE,
payload: {
id,
},
});
export const handleNotificationDelete = (notification) => ({
type: EntryActionTypes.NOTIFICATION_DELETE_HANDLE,
payload: {
notification,
},
});

View file

@ -1,29 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const createManagerInCurrentProject = (data) => ({
type: EntryActionTypes.MANAGER_IN_CURRENT_PROJECT_CREATE,
payload: {
data,
},
});
export const handleProjectManagerCreate = (projectManager) => ({
type: EntryActionTypes.PROJECT_MANAGER_CREATE_HANDLE,
payload: {
projectManager,
},
});
export const deleteProjectManager = (id) => ({
type: EntryActionTypes.PROJECT_MANAGER_DELETE,
payload: {
id,
},
});
export const handleProjectManagerDelete = (projectManager) => ({
type: EntryActionTypes.PROJECT_MANAGER_DELETE_HANDLE,
payload: {
projectManager,
},
});

View file

@ -1,11 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const handleSocketDisconnect = () => ({
type: EntryActionTypes.SOCKET_DISCONNECT_HANDLE,
payload: {},
});
export const handleSocketReconnect = () => ({
type: EntryActionTypes.SOCKET_RECONNECT_HANDLE,
payload: {},
});

View file

@ -1,19 +1,39 @@
export * from './router';
export * from './socket';
export * from './login';
export * from './core';
export * from './modal';
export * from './user';
export * from './project';
export * from './project-manager';
export * from './board';
export * from './board-membership';
export * from './label';
export * from './list';
export * from './card';
export * from './task';
export * from './attachment';
export * from './actions';
export * from './action';
export * from './comment-action';
export * from './notification';
import router from './router';
import socket from './socket';
import login from './login';
import core from './core';
import modals from './modals';
import users from './users';
import projects from './projects';
import projectManagers from './project-managers';
import boards from './boards';
import boardMemberships from './board-memberships';
import labels from './labels';
import lists from './lists';
import cards from './cards';
import tasks from './tasks';
import attachments from './attachments';
import activities from './activities';
import commentActivities from './comment-activities';
import notifications from './notifications';
export default {
...router,
...socket,
...login,
...core,
...modals,
...users,
...projects,
...projectManagers,
...boards,
...boardMemberships,
...labels,
...lists,
...cards,
...tasks,
...attachments,
...activities,
...commentActivities,
...notifications,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createLabel = (label) => ({
const createLabel = (label) => ({
type: ActionTypes.LABEL_CREATE,
payload: {
label,
@ -23,14 +23,14 @@ createLabel.failure = (localId, error) => ({
},
});
export const handleLabelCreate = (label) => ({
const handleLabelCreate = (label) => ({
type: ActionTypes.LABEL_CREATE_HANDLE,
payload: {
label,
},
});
export const updateLabel = (id, data) => ({
const updateLabel = (id, data) => ({
type: ActionTypes.LABEL_UPDATE,
payload: {
id,
@ -53,14 +53,14 @@ updateLabel.failure = (id, error) => ({
},
});
export const handleLabelUpdate = (label) => ({
const handleLabelUpdate = (label) => ({
type: ActionTypes.LABEL_UPDATE_HANDLE,
payload: {
label,
},
});
export const deleteLabel = (id) => ({
const deleteLabel = (id) => ({
type: ActionTypes.LABEL_DELETE,
payload: {
id,
@ -82,14 +82,14 @@ deleteLabel.failure = (id, error) => ({
},
});
export const handleLabelDelete = (label) => ({
const handleLabelDelete = (label) => ({
type: ActionTypes.LABEL_DELETE_HANDLE,
payload: {
label,
},
});
export const addLabelToCard = (id, cardId) => ({
const addLabelToCard = (id, cardId) => ({
type: ActionTypes.LABEL_TO_CARD_ADD,
payload: {
id,
@ -113,14 +113,14 @@ addLabelToCard.failure = (id, cardId, error) => ({
},
});
export const handleLabelToCardAdd = (cardLabel) => ({
const handleLabelToCardAdd = (cardLabel) => ({
type: ActionTypes.LABEL_TO_CARD_ADD_HANDLE,
payload: {
cardLabel,
},
});
export const removeLabelFromCard = (id, cardId) => ({
const removeLabelFromCard = (id, cardId) => ({
type: ActionTypes.LABEL_FROM_CARD_REMOVE,
payload: {
id,
@ -144,14 +144,14 @@ removeLabelFromCard.failure = (id, cardId, error) => ({
},
});
export const handleLabelFromCardRemove = (cardLabel) => ({
const handleLabelFromCardRemove = (cardLabel) => ({
type: ActionTypes.LABEL_FROM_CARD_REMOVE_HANDLE,
payload: {
cardLabel,
},
});
export const addLabelToBoardFilter = (id, boardId) => ({
const addLabelToBoardFilter = (id, boardId) => ({
type: ActionTypes.LABEL_TO_BOARD_FILTER_ADD,
payload: {
id,
@ -159,10 +159,25 @@ export const addLabelToBoardFilter = (id, boardId) => ({
},
});
export const removeLabelFromBoardFilter = (id, boardId) => ({
const removeLabelFromBoardFilter = (id, boardId) => ({
type: ActionTypes.LABEL_FROM_BOARD_FILTER_REMOVE,
payload: {
id,
boardId,
},
});
export default {
createLabel,
handleLabelCreate,
updateLabel,
handleLabelUpdate,
deleteLabel,
handleLabelDelete,
addLabelToCard,
handleLabelToCardAdd,
removeLabelFromCard,
handleLabelFromCardRemove,
addLabelToBoardFilter,
removeLabelFromBoardFilter,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createList = (list) => ({
const createList = (list) => ({
type: ActionTypes.LIST_CREATE,
payload: {
list,
@ -23,14 +23,14 @@ createList.failure = (localId, error) => ({
},
});
export const handleListCreate = (list) => ({
const handleListCreate = (list) => ({
type: ActionTypes.LIST_CREATE_HANDLE,
payload: {
list,
},
});
export const updateList = (id, data) => ({
const updateList = (id, data) => ({
type: ActionTypes.LIST_UPDATE,
payload: {
id,
@ -53,14 +53,14 @@ updateList.failure = (id, error) => ({
},
});
export const handleListUpdate = (list) => ({
const handleListUpdate = (list) => ({
type: ActionTypes.LIST_UPDATE_HANDLE,
payload: {
list,
},
});
export const deleteList = (id) => ({
const deleteList = (id) => ({
type: ActionTypes.LIST_DELETE,
payload: {
id,
@ -82,9 +82,18 @@ deleteList.failure = (id, error) => ({
},
});
export const handleListDelete = (list) => ({
const handleListDelete = (list) => ({
type: ActionTypes.LIST_DELETE_HANDLE,
payload: {
list,
},
});
export default {
createList,
handleListCreate,
updateList,
handleListUpdate,
deleteList,
handleListDelete,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const authenticate = (data) => ({
const authenticate = (data) => ({
type: ActionTypes.AUTHENTICATE,
payload: {
data,
@ -21,12 +21,12 @@ authenticate.failure = (error) => ({
},
});
export const clearAuthenticateError = () => ({
const clearAuthenticateError = () => ({
type: ActionTypes.AUTHENTICATE_ERROR_CLEAR,
payload: {},
});
export const logout = () => ({
type: ActionTypes.LOGOUT,
payload: {},
});
export default {
authenticate,
clearAuthenticateError,
};

View file

@ -1,13 +1,18 @@
import ActionTypes from '../constants/ActionTypes';
export const openModal = (type) => ({
const openModal = (type) => ({
type: ActionTypes.MODAL_OPEN,
payload: {
type,
},
});
export const closeModal = () => ({
const closeModal = () => ({
type: ActionTypes.MODAL_CLOSE,
payload: {},
});
export default {
openModal,
closeModal,
};

View file

@ -1,16 +1,16 @@
import ActionTypes from '../constants/ActionTypes';
export const handleNotificationCreate = (notification, users, cards, actions) => ({
const handleNotificationCreate = (notification, users, cards, activities) => ({
type: ActionTypes.NOTIFICATION_CREATE_HANDLE,
payload: {
notification,
users,
cards,
actions,
activities,
},
});
export const deleteNotification = (id) => ({
const deleteNotification = (id) => ({
type: ActionTypes.NOTIFICATION_DELETE,
payload: {
id,
@ -32,9 +32,15 @@ deleteNotification.failure = (id, error) => ({
},
});
export const handleNotificationDelete = (notification) => ({
const handleNotificationDelete = (notification) => ({
type: ActionTypes.NOTIFICATION_DELETE_HANDLE,
payload: {
notification,
},
});
export default {
handleNotificationCreate,
deleteNotification,
handleNotificationDelete,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createProjectManager = (projectManager) => ({
const createProjectManager = (projectManager) => ({
type: ActionTypes.PROJECT_MANAGER_CREATE,
payload: {
projectManager,
@ -23,7 +23,7 @@ createProjectManager.failure = (localId, error) => ({
},
});
export const handleProjectManagerCreate = (
const handleProjectManagerCreate = (
projectManager,
project,
board,
@ -38,6 +38,7 @@ export const handleProjectManagerCreate = (
cardLabels,
tasks,
attachments,
deletedNotifications,
) => ({
type: ActionTypes.PROJECT_MANAGER_CREATE_HANDLE,
payload: {
@ -55,6 +56,7 @@ export const handleProjectManagerCreate = (
cardLabels,
tasks,
attachments,
deletedNotifications,
},
});
@ -67,7 +69,7 @@ handleProjectManagerCreate.fetchProject = (id, currentUserId, currentBoardId) =>
},
});
export const deleteProjectManager = (id, isCurrentUser, isCurrentProject) => ({
const deleteProjectManager = (id, isCurrentUser, isCurrentProject) => ({
type: ActionTypes.PROJECT_MANAGER_DELETE,
payload: {
id,
@ -91,7 +93,7 @@ deleteProjectManager.failure = (id, error) => ({
},
});
export const handleProjectManagerDelete = (projectManager, isCurrentUser, isCurrentProject) => ({
const handleProjectManagerDelete = (projectManager, isCurrentUser, isCurrentProject) => ({
type: ActionTypes.PROJECT_MANAGER_DELETE_HANDLE,
payload: {
projectManager,
@ -99,3 +101,10 @@ export const handleProjectManagerDelete = (projectManager, isCurrentUser, isCurr
isCurrentProject,
},
});
export default {
createProjectManager,
handleProjectManagerCreate,
deleteProjectManager,
handleProjectManagerDelete,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createProject = (data) => ({
const createProject = (data) => ({
type: ActionTypes.PROJECT_CREATE,
payload: {
data,
@ -22,7 +22,7 @@ createProject.failure = (error) => ({
},
});
export const handleProjectCreate = (project, users, projectManagers, boards, boardMemberships) => ({
const handleProjectCreate = (project, users, projectManagers, boards, boardMemberships) => ({
type: ActionTypes.PROJECT_CREATE_HANDLE,
payload: {
project,
@ -33,7 +33,7 @@ export const handleProjectCreate = (project, users, projectManagers, boards, boa
},
});
export const updateProject = (id, data) => ({
const updateProject = (id, data) => ({
type: ActionTypes.PROJECT_UPDATE,
payload: {
id,
@ -56,14 +56,14 @@ updateProject.failure = (id, error) => ({
},
});
export const handleProjectUpdate = (project) => ({
const handleProjectUpdate = (project) => ({
type: ActionTypes.PROJECT_UPDATE_HANDLE,
payload: {
project,
},
});
export const updateProjectBackgroundImage = (id) => ({
const updateProjectBackgroundImage = (id) => ({
type: ActionTypes.PROJECT_BACKGROUND_IMAGE_UPDATE,
payload: {
id,
@ -85,7 +85,7 @@ updateProjectBackgroundImage.failure = (id, error) => ({
},
});
export const deleteProject = (id) => ({
const deleteProject = (id) => ({
type: ActionTypes.PROJECT_DELETE,
payload: {
id,
@ -107,9 +107,19 @@ deleteProject.failure = (id, error) => ({
},
});
export const handleProjectDelete = (project) => ({
const handleProjectDelete = (project) => ({
type: ActionTypes.PROJECT_DELETE_HANDLE,
payload: {
project,
},
});
export default {
createProject,
handleProjectCreate,
updateProject,
handleProjectUpdate,
updateProjectBackgroundImage,
deleteProject,
handleProjectDelete,
};

View file

@ -1,7 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
// eslint-disable-next-line import/prefer-default-export
export const handleLocationChange = (
const handleLocationChange = (
board,
users,
projects,
@ -13,7 +12,7 @@ export const handleLocationChange = (
cardLabels,
tasks,
attachments,
notifications,
deletedNotifications,
) => ({
type: ActionTypes.LOCATION_CHANGE_HANDLE,
payload: {
@ -28,7 +27,7 @@ export const handleLocationChange = (
cardLabels,
tasks,
attachments,
notifications,
deletedNotifications,
},
});
@ -38,3 +37,7 @@ handleLocationChange.fetchBoard = (id) => ({
id,
},
});
export default {
handleLocationChange,
};

View file

@ -1,11 +1,11 @@
import ActionTypes from '../constants/ActionTypes';
export const handleSocketDisconnect = () => ({
const handleSocketDisconnect = () => ({
type: ActionTypes.SOCKET_DISCONNECT_HANDLE,
payload: {},
});
export const handleSocketReconnect = (
const handleSocketReconnect = (
user,
board,
users,
@ -20,7 +20,7 @@ export const handleSocketReconnect = (
cardLabels,
tasks,
attachments,
actions,
activities,
notifications,
) => ({
type: ActionTypes.SOCKET_RECONNECT_HANDLE,
@ -39,7 +39,7 @@ export const handleSocketReconnect = (
cardLabels,
tasks,
attachments,
actions,
activities,
notifications,
},
});
@ -51,3 +51,8 @@ handleSocketReconnect.fetchCore = (currentUserId, currentBoardId) => ({
currentBoardId,
},
});
export default {
handleSocketDisconnect,
handleSocketReconnect,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createTask = (task) => ({
const createTask = (task) => ({
type: ActionTypes.TASK_CREATE,
payload: {
task,
@ -23,14 +23,14 @@ createTask.failure = (localId, error) => ({
},
});
export const handleTaskCreate = (task) => ({
const handleTaskCreate = (task) => ({
type: ActionTypes.TASK_CREATE_HANDLE,
payload: {
task,
},
});
export const updateTask = (id, data) => ({
const updateTask = (id, data) => ({
type: ActionTypes.TASK_UPDATE,
payload: {
id,
@ -53,14 +53,14 @@ updateTask.failure = (id, error) => ({
},
});
export const handleTaskUpdate = (task) => ({
const handleTaskUpdate = (task) => ({
type: ActionTypes.TASK_UPDATE_HANDLE,
payload: {
task,
},
});
export const deleteTask = (id) => ({
const deleteTask = (id) => ({
type: ActionTypes.TASK_DELETE,
payload: {
id,
@ -82,9 +82,18 @@ deleteTask.failure = (id, error) => ({
},
});
export const handleTaskDelete = (task) => ({
const handleTaskDelete = (task) => ({
type: ActionTypes.TASK_DELETE_HANDLE,
payload: {
task,
},
});
export default {
createTask,
handleTaskCreate,
updateTask,
handleTaskUpdate,
deleteTask,
handleTaskDelete,
};

View file

@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createUser = (data) => ({
const createUser = (data) => ({
type: ActionTypes.USER_CREATE,
payload: {
data,
@ -21,19 +21,19 @@ createUser.failure = (error) => ({
},
});
export const handleUserCreate = (user) => ({
const handleUserCreate = (user) => ({
type: ActionTypes.USER_CREATE_HANDLE,
payload: {
user,
},
});
export const clearUserCreateError = () => ({
const clearUserCreateError = () => ({
type: ActionTypes.USER_CREATE_ERROR_CLEAR,
payload: {},
});
export const updateUser = (id, data) => ({
const updateUser = (id, data) => ({
type: ActionTypes.USER_UPDATE,
payload: {
id,
@ -56,7 +56,7 @@ updateUser.failure = (id, error) => ({
},
});
export const handleUserUpdate = (user, users, isCurrent) => ({
const handleUserUpdate = (user, users, isCurrent) => ({
type: ActionTypes.USER_UPDATE_HANDLE,
payload: {
user,
@ -65,7 +65,7 @@ export const handleUserUpdate = (user, users, isCurrent) => ({
},
});
export const updateUserEmail = (id, data) => ({
const updateUserEmail = (id, data) => ({
type: ActionTypes.USER_EMAIL_UPDATE,
payload: {
id,
@ -88,14 +88,14 @@ updateUserEmail.failure = (id, error) => ({
},
});
export const clearUserEmailUpdateError = (id) => ({
const clearUserEmailUpdateError = (id) => ({
type: ActionTypes.USER_EMAIL_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
export const updateUserPassword = (id, data) => ({
const updateUserPassword = (id, data) => ({
type: ActionTypes.USER_PASSWORD_UPDATE,
payload: {
id,
@ -118,14 +118,14 @@ updateUserPassword.failure = (id, error) => ({
},
});
export const clearUserPasswordUpdateError = (id) => ({
const clearUserPasswordUpdateError = (id) => ({
type: ActionTypes.USER_PASSWORD_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
export const updateUserUsername = (id, data) => ({
const updateUserUsername = (id, data) => ({
type: ActionTypes.USER_USERNAME_UPDATE,
payload: {
id,
@ -148,14 +148,14 @@ updateUserUsername.failure = (id, error) => ({
},
});
export const clearUserUsernameUpdateError = (id) => ({
const clearUserUsernameUpdateError = (id) => ({
type: ActionTypes.USER_USERNAME_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
export const updateUserAvatar = (id) => ({
const updateUserAvatar = (id) => ({
type: ActionTypes.USER_AVATAR_UPDATE,
payload: {
id,
@ -177,7 +177,7 @@ updateUserAvatar.failure = (id, error) => ({
},
});
export const deleteUser = (id) => ({
const deleteUser = (id) => ({
type: ActionTypes.USER_DELETE,
payload: {
id,
@ -199,14 +199,14 @@ deleteUser.failure = (id, error) => ({
},
});
export const handleUserDelete = (user) => ({
const handleUserDelete = (user) => ({
type: ActionTypes.USER_DELETE_HANDLE,
payload: {
user,
},
});
export const addUserToCard = (id, cardId, isCurrent) => ({
const addUserToCard = (id, cardId, isCurrent) => ({
type: ActionTypes.USER_TO_CARD_ADD,
payload: {
id,
@ -231,14 +231,14 @@ addUserToCard.failure = (id, cardId, error) => ({
},
});
export const handleUserToCardAdd = (cardMembership) => ({
const handleUserToCardAdd = (cardMembership) => ({
type: ActionTypes.USER_TO_CARD_ADD_HANDLE,
payload: {
cardMembership,
},
});
export const removeUserFromCard = (id, cardId) => ({
const removeUserFromCard = (id, cardId) => ({
type: ActionTypes.USER_FROM_CARD_REMOVE,
payload: {
id,
@ -262,14 +262,14 @@ removeUserFromCard.failure = (id, cardId, error) => ({
},
});
export const handleUserFromCardRemove = (cardMembership) => ({
const handleUserFromCardRemove = (cardMembership) => ({
type: ActionTypes.USER_FROM_CARD_REMOVE_HANDLE,
payload: {
cardMembership,
},
});
export const addUserToBoardFilter = (id, boardId) => ({
const addUserToBoardFilter = (id, boardId) => ({
type: ActionTypes.USER_TO_BOARD_FILTER_ADD,
payload: {
id,
@ -277,10 +277,33 @@ export const addUserToBoardFilter = (id, boardId) => ({
},
});
export const removeUserFromBoardFilter = (id, boardId) => ({
const removeUserFromBoardFilter = (id, boardId) => ({
type: ActionTypes.USER_FROM_BOARD_FILTER_REMOVE,
payload: {
id,
boardId,
},
});
export default {
createUser,
handleUserCreate,
clearUserCreateError,
updateUser,
handleUserUpdate,
updateUserEmail,
clearUserEmailUpdateError,
updateUserPassword,
clearUserPasswordUpdateError,
updateUserUsername,
clearUserUsernameUpdateError,
updateUserAvatar,
deleteUser,
handleUserDelete,
addUserToCard,
handleUserToCardAdd,
removeUserFromCard,
handleUserFromCardRemove,
addUserToBoardFilter,
removeUserFromBoardFilter,
};

View file

@ -1,36 +0,0 @@
import socket from './socket';
/* Transformers */
export const transformAction = (action) => ({
...action,
createdAt: new Date(action.createdAt),
});
/* Actions */
const getActions = (cardId, data) =>
socket.get(`/cards/${cardId}/actions`, data).then((body) => ({
...body,
items: body.items.map(transformAction),
}));
/* Event handlers */
const makeHandleActionCreate = (next) => (body) => {
next({
...body,
item: transformAction(body.item),
});
};
const makeHandleActionUpdate = makeHandleActionCreate;
const makeHandleActionDelete = makeHandleActionCreate;
export default {
getActions,
makeHandleActionCreate,
makeHandleActionUpdate,
makeHandleActionDelete,
};

36
client/src/api/activities.js Executable file
View file

@ -0,0 +1,36 @@
import socket from './socket';
/* Transformers */
export const transformActivity = (activity) => ({
...activity,
createdAt: new Date(activity.createdAt),
});
/* Actions */
const getActivities = (cardId, data) =>
socket.get(`/cards/${cardId}/actions`, data).then((body) => ({
...body,
items: body.items.map(transformActivity),
}));
/* Event handlers */
const makeHandleActivityCreate = (next) => (body) => {
next({
...body,
item: transformActivity(body.item),
});
};
const makeHandleActivityUpdate = makeHandleActivityCreate;
const makeHandleActivityDelete = makeHandleActivityCreate;
export default {
getActivities,
makeHandleActivityCreate,
makeHandleActivityUpdate,
makeHandleActivityDelete,
};

View file

@ -78,14 +78,9 @@ const makeHandleCardCreate = (next) => (body) => {
});
};
const makeHandleCardUpdate = (next) => (body) => {
next({
...body,
item: transformCard(body.item),
});
};
const makeHandleCardUpdate = makeHandleCardCreate;
const makeHandleCardDelete = makeHandleCardUpdate;
const makeHandleCardDelete = makeHandleCardCreate;
export default {
getCards,

View file

@ -1,28 +0,0 @@
import socket from './socket';
import { transformAction } from './actions';
/* Actions */
const createCommentAction = (cardId, data) =>
socket.post(`/cards/${cardId}/comment-actions`, data).then((body) => ({
...body,
item: transformAction(body.item),
}));
const updateCommentAction = (id, data) =>
socket.patch(`/comment-actions/${id}`, data).then((body) => ({
...body,
item: transformAction(body.item),
}));
const deleteCommentAction = (id) =>
socket.delete(`/comment-actions/${id}`).then((body) => ({
...body,
item: transformAction(body.item),
}));
export default {
createCommentAction,
updateCommentAction,
deleteCommentAction,
};

View file

@ -0,0 +1,28 @@
import socket from './socket';
import { transformActivity } from './activities';
/* Actions */
const createCommentActivity = (cardId, data) =>
socket.post(`/cards/${cardId}/comment-actions`, data).then((body) => ({
...body,
item: transformActivity(body.item),
}));
const updateCommentActivity = (id, data) =>
socket.patch(`/comment-actions/${id}`, data).then((body) => ({
...body,
item: transformActivity(body.item),
}));
const deleteCommentActivity = (id) =>
socket.delete(`/comment-actions/${id}`).then((body) => ({
...body,
item: transformActivity(body.item),
}));
export default {
createCommentActivity,
updateCommentActivity,
deleteCommentActivity,
};

View file

@ -13,8 +13,8 @@ import cardMemberships from './card-memberships';
import cardLabels from './card-labels';
import tasks from './tasks';
import attachments from './attachments';
import actions from './actions';
import commentActions from './comment-actions';
import activities from './activities';
import commentActivities from './comment-activities';
import notifications from './notifications';
export { http, socket };
@ -33,7 +33,7 @@ export default {
...cardLabels,
...tasks,
...attachments,
...actions,
...commentActions,
...activities,
...commentActivities,
...notifications,
};

View file

@ -1,33 +1,61 @@
import omit from 'lodash/omit';
import socket from './socket';
import { transformCard } from './cards';
import { transformAction } from './actions';
import { transformActivity } from './activities';
/* Transformers */
export const transformNotification = (notification) => ({
...omit(notification, 'actionId'),
activityId: notification.actionId,
});
/* Actions */
const getNotifications = () =>
socket.get('/notifications').then((body) => ({
...body,
items: body.items.map(transformNotification),
included: {
...body.included,
...omit(body.included, 'actions'),
cards: body.included.cards.map(transformCard),
actions: body.included.actions.map(transformAction),
activities: body.included.actions.map(transformActivity),
},
}));
const getNotification = (id) =>
socket.get(`/notifications/${id}`).then((body) => ({
...body,
item: transformNotification(body.item),
included: {
...body.included,
...omit(body.included, 'actions'),
cards: body.included.cards.map(transformCard),
actions: body.included.actions.map(transformAction),
activities: body.included.actions.map(transformActivity),
},
}));
const updateNotifications = (ids, data) => socket.patch(`/notifications/${ids.join(',')}`, data);
const updateNotifications = (ids, data) =>
socket.patch(`/notifications/${ids.join(',')}`, data).then((body) => ({
...body,
items: body.items.map(transformNotification),
}));
/* Event handlers */
const makeHandleNotificationCreate = (next) => (body) => {
next({
...body,
item: transformNotification(body.item),
});
};
const makeHandleNotificationUpdate = makeHandleNotificationCreate;
export default {
getNotifications,
getNotification,
updateNotifications,
makeHandleNotificationCreate,
makeHandleNotificationUpdate,
};

View file

@ -1,3 +0,0 @@
import Actions from './Actions';
export default Actions;

View file

@ -3,13 +3,13 @@ import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Button, Comment, Icon, Loader, Visibility } from 'semantic-ui-react';
import { ActionTypes } from '../../../constants/Enums';
import { ActivityTypes } from '../../../constants/Enums';
import CommentAdd from './CommentAdd';
import Item from './Item';
import styles from './Actions.module.scss';
import styles from './Activities.module.scss';
const Actions = React.memo(
const Activities = React.memo(
({
items,
isFetching,
@ -60,7 +60,7 @@ const Actions = React.memo(
<div className={styles.wrapper}>
<Comment.Group>
{items.map((item) =>
item.type === ActionTypes.COMMENT_CARD ? (
item.type === ActivityTypes.COMMENT_CARD ? (
<Item.Comment
key={item.id}
data={item.data}
@ -94,7 +94,7 @@ const Actions = React.memo(
},
);
Actions.propTypes = {
Activities.propTypes = {
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
isFetching: PropTypes.bool.isRequired,
isAllFetched: PropTypes.bool.isRequired,
@ -109,4 +109,4 @@ Actions.propTypes = {
onCommentDelete: PropTypes.func.isRequired,
};
export default Actions;
export default Activities;

View file

@ -4,7 +4,7 @@ import classNames from 'classnames';
import { useTranslation, Trans } from 'react-i18next';
import { Comment } from 'semantic-ui-react';
import { ActionTypes } from '../../../constants/Enums';
import { ActivityTypes } from '../../../constants/Enums';
import ItemComment from './ItemComment';
import User from '../../User';
@ -16,7 +16,7 @@ const Item = React.memo(({ type, data, createdAt, user }) => {
let contentNode;
switch (type) {
case ActionTypes.CREATE_CARD:
case ActivityTypes.CREATE_CARD:
contentNode = (
<Trans
i18nKey="common.userAddedThisCardToList"
@ -34,7 +34,7 @@ const Item = React.memo(({ type, data, createdAt, user }) => {
);
break;
case ActionTypes.MOVE_CARD:
case ActivityTypes.MOVE_CARD:
contentNode = (
<Trans
i18nKey="common.userMovedThisCardFromListToList"

View file

@ -0,0 +1,3 @@
import Activities from './Activities';
export default Activities;

View file

@ -11,7 +11,7 @@ import Tasks from './Tasks';
import Attachments from './Attachments';
import AttachmentAddZone from './AttachmentAddZone';
import AttachmentAddPopup from './AttachmentAddPopup';
import Actions from './Actions';
import Activities from './Activities';
import User from '../User';
import Label from '../Label';
import DueDate from '../DueDate';
@ -32,10 +32,10 @@ const CardModal = React.memo(
dueDate,
timer,
isSubscribed,
isActionsFetching,
isAllActionsFetched,
isActionsDetailsVisible,
isActionsDetailsFetching,
isActivitiesFetching,
isAllActivitiesFetched,
isActivitiesDetailsVisible,
isActivitiesDetailsFetching,
listId,
boardId,
projectId,
@ -43,12 +43,12 @@ const CardModal = React.memo(
labels,
tasks,
attachments,
actions,
activities,
allProjectsToLists,
allBoardMemberships,
allLabels,
canEdit,
canEditAllCommentActions,
canEditAllCommentActivities,
onUpdate,
onMove,
onTransfer,
@ -68,11 +68,11 @@ const CardModal = React.memo(
onAttachmentCreate,
onAttachmentUpdate,
onAttachmentDelete,
onActionsFetch,
onActionsDetailsToggle,
onCommentActionCreate,
onCommentActionUpdate,
onCommentActionDelete,
onActivitiesFetch,
onActivitiesDetailsToggle,
onCommentActivityCreate,
onCommentActivityUpdate,
onCommentActivityDelete,
onClose,
}) => {
const [t] = useTranslation();
@ -357,19 +357,19 @@ const CardModal = React.memo(
</div>
</div>
)}
<Actions
items={actions}
isFetching={isActionsFetching}
isAllFetched={isAllActionsFetched}
isDetailsVisible={isActionsDetailsVisible}
isDetailsFetching={isActionsDetailsFetching}
<Activities
items={activities}
isFetching={isActivitiesFetching}
isAllFetched={isAllActivitiesFetched}
isDetailsVisible={isActivitiesDetailsVisible}
isDetailsFetching={isActivitiesDetailsFetching}
canEdit={canEdit}
canEditAllComments={canEditAllCommentActions}
onFetch={onActionsFetch}
onDetailsToggle={onActionsDetailsToggle}
onCommentCreate={onCommentActionCreate}
onCommentUpdate={onCommentActionUpdate}
onCommentDelete={onCommentActionDelete}
canEditAllComments={canEditAllCommentActivities}
onFetch={onActivitiesFetch}
onDetailsToggle={onActivitiesDetailsToggle}
onCommentCreate={onCommentActivityCreate}
onCommentUpdate={onCommentActivityUpdate}
onCommentDelete={onCommentActivityDelete}
/>
</Grid.Column>
{canEdit && (
@ -490,10 +490,10 @@ CardModal.propTypes = {
dueDate: PropTypes.instanceOf(Date),
timer: PropTypes.object, // eslint-disable-line react/forbid-prop-types
isSubscribed: PropTypes.bool.isRequired,
isActionsFetching: PropTypes.bool.isRequired,
isAllActionsFetched: PropTypes.bool.isRequired,
isActionsDetailsVisible: PropTypes.bool.isRequired,
isActionsDetailsFetching: PropTypes.bool.isRequired,
isActivitiesFetching: PropTypes.bool.isRequired,
isAllActivitiesFetched: PropTypes.bool.isRequired,
isActivitiesDetailsVisible: PropTypes.bool.isRequired,
isActivitiesDetailsFetching: PropTypes.bool.isRequired,
listId: PropTypes.string.isRequired,
boardId: PropTypes.string.isRequired,
projectId: PropTypes.string.isRequired,
@ -502,13 +502,13 @@ CardModal.propTypes = {
labels: PropTypes.array.isRequired,
tasks: PropTypes.array.isRequired,
attachments: PropTypes.array.isRequired,
actions: PropTypes.array.isRequired,
activities: PropTypes.array.isRequired,
allProjectsToLists: PropTypes.array.isRequired,
allBoardMemberships: PropTypes.array.isRequired,
allLabels: PropTypes.array.isRequired,
/* eslint-enable react/forbid-prop-types */
canEdit: PropTypes.bool.isRequired,
canEditAllCommentActions: PropTypes.bool.isRequired,
canEditAllCommentActivities: PropTypes.bool.isRequired,
onUpdate: PropTypes.func.isRequired,
onMove: PropTypes.func.isRequired,
onTransfer: PropTypes.func.isRequired,
@ -528,11 +528,11 @@ CardModal.propTypes = {
onAttachmentCreate: PropTypes.func.isRequired,
onAttachmentUpdate: PropTypes.func.isRequired,
onAttachmentDelete: PropTypes.func.isRequired,
onActionsFetch: PropTypes.func.isRequired,
onActionsDetailsToggle: PropTypes.func.isRequired,
onCommentActionCreate: PropTypes.func.isRequired,
onCommentActionUpdate: PropTypes.func.isRequired,
onCommentActionDelete: PropTypes.func.isRequired,
onActivitiesFetch: PropTypes.func.isRequired,
onActivitiesDetailsToggle: PropTypes.func.isRequired,
onCommentActivityCreate: PropTypes.func.isRequired,
onCommentActivityUpdate: PropTypes.func.isRequired,
onCommentActivityDelete: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
};

View file

@ -7,7 +7,7 @@ import { withPopup } from '../../lib/popup';
import { Popup } from '../../lib/custom-ui';
import Paths from '../../constants/Paths';
import { ActionTypes } from '../../constants/Enums';
import { ActivityTypes } from '../../constants/Enums';
import User from '../User';
import styles from './NotificationsPopup.module.scss';
@ -23,42 +23,42 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
);
const renderItemContent = useCallback(
({ action, card }) => {
switch (action.type) {
case ActionTypes.MOVE_CARD:
({ activity, card }) => {
switch (activity.type) {
case ActivityTypes.MOVE_CARD:
return (
<Trans
i18nKey="common.userMovedCardFromListToList"
values={{
user: action.user.name,
user: activity.user.name,
card: card.name,
fromList: action.data.fromList.name,
toList: action.data.toList.name,
fromList: activity.data.fromList.name,
toList: activity.data.toList.name,
}}
>
{action.user.name}
{activity.user.name}
{' moved '}
<Link to={Paths.CARDS.replace(':id', card.id)} onClick={onClose}>
{card.name}
</Link>
{' from '}
{action.data.fromList.name}
{activity.data.fromList.name}
{' to '}
{action.data.toList.name}
{activity.data.toList.name}
</Trans>
);
case ActionTypes.COMMENT_CARD:
case ActivityTypes.COMMENT_CARD:
return (
<Trans
i18nKey="common.userLeftNewCommentToCard"
values={{
user: action.user.name,
comment: action.data.text,
user: activity.user.name,
comment: activity.data.text,
card: card.name,
}}
>
{action.user.name}
{` left a new comment «${action.data.text}» to `}
{activity.user.name}
{` left a new comment «${activity.data.text}» to `}
<Link to={Paths.CARDS.replace(':id', card.id)} onClick={onClose}>
{card.name}
</Link>
@ -79,11 +79,11 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
{items.length > 0
? items.map((item) => (
<div key={item.id} className={styles.wrapper}>
{item.card && item.action ? (
{item.card && item.activity ? (
<>
<User
name={item.action.user.name}
avatarUrl={item.action.user.avatarUrl}
name={item.activity.user.name}
avatarUrl={item.activity.user.avatarUrl}
size="large"
/>
<span className={styles.content}>{renderItemContent(item)}</span>

View file

@ -101,7 +101,7 @@ const ActionsStep = React.memo(
<UserPasswordEditStep
defaultData={user.passwordUpdateForm.data}
isSubmitting={user.passwordUpdateForm.isSubmitting}
error={user.emailUpdateForm.error}
error={user.passwordUpdateForm.error}
onUpdate={onPasswordUpdate}
onMessageDismiss={onPasswordUpdateMessageDismiss}
onBack={handleBack}

View file

@ -17,18 +17,17 @@ export default {
AUTHENTICATE__FAILURE: 'AUTHENTICATE__FAILURE',
AUTHENTICATE_ERROR_CLEAR: 'AUTHENTICATE_ERROR_CLEAR',
LOGOUT: 'LOGOUT',
/* Core */
CORE_INITIALIZE: 'CORE_INITIALIZE',
LOGOUT: 'LOGOUT',
/* Modal */
/* Modals */
MODAL_OPEN: 'MODAL_OPEN',
MODAL_CLOSE: 'MODAL_CLOSE',
/* User */
/* Users */
USER_CREATE: 'USER_CREATE',
USER_CREATE__SUCCESS: 'USER_CREATE__SUCCESS',
@ -69,7 +68,7 @@ export default {
USER_TO_BOARD_FILTER_ADD: 'USER_TO_BOARD_FILTER_ADD',
USER_FROM_BOARD_FILTER_REMOVE: 'USER_FROM_BOARD_FILTER_REMOVE',
/* Project */
/* Projects */
PROJECT_CREATE: 'PROJECT_CREATE',
PROJECT_CREATE__SUCCESS: 'PROJECT_CREATE__SUCCESS',
@ -87,7 +86,7 @@ export default {
PROJECT_DELETE__FAILURE: 'PROJECT_DELETE__FAILURE',
PROJECT_DELETE_HANDLE: 'PROJECT_DELETE_HANDLE',
/* Project manager */
/* Project managers */
PROJECT_MANAGER_CREATE: 'PROJECT_MANAGER_CREATE',
PROJECT_MANAGER_CREATE__SUCCESS: 'PROJECT_MANAGER_CREATE__SUCCESS',
@ -99,7 +98,7 @@ export default {
PROJECT_MANAGER_DELETE__FAILURE: 'PROJECT_MANAGER_DELETE__FAILURE',
PROJECT_MANAGER_DELETE_HANDLE: 'PROJECT_MANAGER_DELETE_HANDLE',
/* Board */
/* Boards */
BOARD_CREATE: 'BOARD_CREATE',
BOARD_CREATE__SUCCESS: 'BOARD_CREATE__SUCCESS',
@ -117,7 +116,7 @@ export default {
BOARD_DELETE__FAILURE: 'BOARD_DELETE__FAILURE',
BOARD_DELETE_HANDLE: 'BOARD_DELETE_HANDLE',
/* Board membership */
/* Board memberships */
BOARD_MEMBERSHIP_CREATE: 'BOARD_MEMBERSHIP_CREATE',
BOARD_MEMBERSHIP_CREATE__SUCCESS: 'BOARD_MEMBERSHIP_CREATE__SUCCESS',
@ -129,7 +128,7 @@ export default {
BOARD_MEMBERSHIP_DELETE__FAILURE: 'BOARD_MEMBERSHIP_DELETE__FAILURE',
BOARD_MEMBERSHIP_DELETE_HANDLE: 'BOARD_MEMBERSHIP_DELETE_HANDLE',
/* Label */
/* Labels */
LABEL_CREATE: 'LABEL_CREATE',
LABEL_CREATE__SUCCESS: 'LABEL_CREATE__SUCCESS',
@ -154,7 +153,7 @@ export default {
LABEL_TO_BOARD_FILTER_ADD: 'LABEL_TO_BOARD_FILTER_ADD',
LABEL_FROM_BOARD_FILTER_REMOVE: 'LABEL_FROM_BOARD_FILTER_REMOVE',
/* List */
/* Lists */
LIST_CREATE: 'LIST_CREATE',
LIST_CREATE__SUCCESS: 'LIST_CREATE__SUCCESS',
@ -169,7 +168,7 @@ export default {
LIST_DELETE__FAILURE: 'LIST_DELETE__FAILURE',
LIST_DELETE_HANDLE: 'LIST_DELETE_HANDLE',
/* Card */
/* Cards */
CARD_CREATE: 'CARD_CREATE',
CARD_CREATE__SUCCESS: 'CARD_CREATE__SUCCESS',
@ -190,7 +189,7 @@ export default {
CARD_DELETE__FAILURE: 'CARD_DELETE__FAILURE',
CARD_DELETE_HANDLE: 'CARD_DELETE_HANDLE',
/* Task */
/* Tasks */
TASK_CREATE: 'TASK_CREATE',
TASK_CREATE__SUCCESS: 'TASK_CREATE__SUCCESS',
@ -205,7 +204,7 @@ export default {
TASK_DELETE__FAILURE: 'TASK_DELETE__FAILURE',
TASK_DELETE_HANDLE: 'TASK_DELETE_HANDLE',
/* Attachment */
/* Attachments */
ATTACHMENT_CREATE: 'ATTACHMENT_CREATE',
ATTACHMENT_CREATE__SUCCESS: 'ATTACHMENT_CREATE__SUCCESS',
@ -220,34 +219,31 @@ export default {
ATTACHMENT_DELETE__FAILURE: 'ATTACHMENT_DELETE__FAILURE',
ATTACHMENT_DELETE_HANDLE: 'ATTACHMENT_DELETE_HANDLE',
/* Actions */
/* Activities */
ACTIONS_FETCH: 'ACTIONS_FETCH',
ACTIONS_FETCH__SUCCESS: 'ACTIONS_FETCH__SUCCESS',
ACTIONS_FETCH__FAILURE: 'ACTIONS_FETCH__FAILURE',
ACTIONS_DETAILS_TOGGLE: 'ACTIONS_DETAILS_TOGGLE',
ACTIONS_DETAILS_TOGGLE__SUCCESS: 'ACTIONS_DETAILS_TOGGLE__SUCCESS',
ACTIONS_DETAILS_TOGGLE__FAILURE: 'ACTIONS_DETAILS_TOGGLE__FAILURE',
ACTIVITIES_FETCH: 'ACTIVITIES_FETCH',
ACTIVITIES_FETCH__SUCCESS: 'ACTIVITIES_FETCH__SUCCESS',
ACTIVITIES_FETCH__FAILURE: 'ACTIVITIES_FETCH__FAILURE',
ACTIVITIES_DETAILS_TOGGLE: 'ACTIVITIES_DETAILS_TOGGLE',
ACTIVITIES_DETAILS_TOGGLE__SUCCESS: 'ACTIVITIES_DETAILS_TOGGLE__SUCCESS',
ACTIVITIES_DETAILS_TOGGLE__FAILURE: 'ACTIVITIES_DETAILS_TOGGLE__FAILURE',
ACTIVITY_CREATE_HANDLE: 'ACTIVITY_CREATE_HANDLE',
ACTIVITY_UPDATE_HANDLE: 'ACTIVITY_UPDATE_HANDLE',
ACTIVITY_DELETE_HANDLE: 'ACTIVITY_DELETE_HANDLE',
/* Action */
/* Comment activities */
ACTION_CREATE_HANDLE: 'ACTION_CREATE_HANDLE',
ACTION_UPDATE_HANDLE: 'ACTION_UPDATE_HANDLE',
ACTION_DELETE_HANDLE: 'ACTION_DELETE_HANDLE',
COMMENT_ACTIVITY_CREATE: 'COMMENT_ACTIVITY_CREATE',
COMMENT_ACTIVITY_CREATE__SUCCESS: 'COMMENT_ACTIVITY_CREATE__SUCCESS',
COMMENT_ACTIVITY_CREATE__FAILURE: 'COMMENT_ACTIVITY_CREATE__FAILURE',
COMMENT_ACTIVITY_UPDATE: 'COMMENT_ACTIVITY_UPDATE',
COMMENT_ACTIVITY_UPDATE__SUCCESS: 'COMMENT_ACTIVITY_UPDATE__SUCCESS',
COMMENT_ACTIVITY_UPDATE__FAILURE: 'COMMENT_ACTIVITY_UPDATE__FAILURE',
COMMENT_ACTIVITY_DELETE: 'COMMENT_ACTIVITY_DELETE',
COMMENT_ACTIVITY_DELETE__SUCCESS: 'COMMENT_ACTIVITY_DELETE__SUCCESS',
COMMENT_ACTIVITY_DELETE__FAILURE: 'COMMENT_ACTIVITY_DELETE__FAILURE',
/* Comment action */
COMMENT_ACTION_CREATE: 'COMMENT_ACTION_CREATE',
COMMENT_ACTION_CREATE__SUCCESS: 'COMMENT_ACTION_CREATE__SUCCESS',
COMMENT_ACTION_CREATE__FAILURE: 'COMMENT_ACTION_CREATE__FAILURE',
COMMENT_ACTION_UPDATE: 'COMMENT_ACTION_UPDATE',
COMMENT_ACTION_UPDATE__SUCCESS: 'COMMENT_ACTION_UPDATE__SUCCESS',
COMMENT_ACTION_UPDATE__FAILURE: 'COMMENT_ACTION_UPDATE__FAILURE',
COMMENT_ACTION_DELETE: 'COMMENT_ACTION_DELETE',
COMMENT_ACTION_DELETE__SUCCESS: 'COMMENT_ACTION_DELETE__SUCCESS',
COMMENT_ACTION_DELETE__FAILURE: 'COMMENT_ACTION_DELETE__FAILURE',
/* Notification */
/* Notifications */
NOTIFICATION_CREATE_HANDLE: 'NOTIFICATION_CREATE_HANDLE',
NOTIFICATION_DELETE: 'NOTIFICATION_DELETE',

View file

@ -13,7 +13,7 @@ const ACCESS_TOKEN_KEY = 'accessToken';
const ACCESS_TOKEN_EXPIRES = 365;
const POSITION_GAP = 65535;
const ACTIONS_LIMIT = 50;
const ACTIVITIES_LIMIT = 50;
export default {
SERVER_BASE_URL,
@ -21,5 +21,5 @@ export default {
ACCESS_TOKEN_KEY,
ACCESS_TOKEN_EXPIRES,
POSITION_GAP,
ACTIONS_LIMIT,
ACTIVITIES_LIMIT,
};

View file

@ -12,18 +12,18 @@ export default {
AUTHENTICATE: `${PREFIX}/AUTHENTICATE`,
AUTHENTICATE_ERROR_CLEAR: `${PREFIX}/AUTHENTICATE_ERROR_CLEAR`,
LOGOUT: `${PREFIX}/LOGOUT`,
/* Core */
CORE_INITIALIZE: `${PREFIX}/CORE_INITIALIZE`,
LOGOUT: `${PREFIX}/LOGOUT`,
/* Modal */
/* Modals */
MODAL_OPEN: `${PREFIX}/MODAL_OPEN`,
MODAL_CLOSE: `${PREFIX}/MODAL_CLOSE`,
/* User */
/* Users */
USER_CREATE: `${PREFIX}/USER_CREATE`,
USER_CREATE_HANDLE: `${PREFIX}/USER_CREATE_HANDLE`,
@ -56,7 +56,7 @@ export default {
USER_TO_FILTER_IN_CURRENT_BOARD_ADD: `${PREFIX}/USER_TO_FILTER_IN_CURRENT_BOARD_ADD`,
USER_FROM_FILTER_IN_CURRENT_BOARD_REMOVE: `${PREFIX}/USER_FROM_FILTER_IN_CURRENT_BOARD_REMOVE`,
/* Project */
/* Projects */
PROJECT_CREATE: `${PREFIX}/PROJECT_CREATE`,
PROJECT_CREATE_HANDLE: `${PREFIX}/PROJECT_CREATE_HANDLE`,
@ -66,14 +66,14 @@ export default {
CURRENT_PROJECT_DELETE: `${PREFIX}/CURRENT_PROJECT_DELETE`,
PROJECT_DELETE_HANDLE: `${PREFIX}/PROJECT_DELETE_HANDLE`,
/* Project manager */
/* Project managers */
MANAGER_IN_CURRENT_PROJECT_CREATE: `${PREFIX}/MANAGER_IN_CURRENT_PROJECT_CREATE`,
PROJECT_MANAGER_CREATE_HANDLE: `${PREFIX}/PROJECT_MANAGER_CREATE_HANDLE`,
PROJECT_MANAGER_DELETE: `${PREFIX}/PROJECT_MANAGER_DELETE`,
PROJECT_MANAGER_DELETE_HANDLE: `${PREFIX}/PROJECT_MANAGER_DELETE_HANDLE`,
/* Board */
/* Boards */
BOARD_IN_CURRENT_PROJECT_CREATE: `${PREFIX}/BOARD_IN_CURRENT_PROJECT_CREATE`,
BOARD_CREATE_HANDLE: `${PREFIX}/BOARD_CREATE_HANDLE`,
@ -84,14 +84,14 @@ export default {
BOARD_DELETE: `${PREFIX}/BOARD_DELETE`,
BOARD_DELETE_HANDLE: `${PREFIX}/BOARD_DELETE_HANDLE`,
/* Board membership */
/* Board memberships */
MEMBERSHIP_IN_CURRENT_BOARD_CREATE: `${PREFIX}/MEMBERSHIP_IN_CURRENT_BOARD_CREATE`,
BOARD_MEMBERSHIP_CREATE_HANDLE: `${PREFIX}/BOARD_MEMBERSHIP_CREATE_HANDLE`,
BOARD_MEMBERSHIP_DELETE: `${PREFIX}/BOARD_MEMBERSHIP_DELETE`,
BOARD_MEMBERSHIP_DELETE_HANDLE: `${PREFIX}/BOARD_MEMBERSHIP_DELETE_HANDLE`,
/* Label */
/* Labels */
LABEL_IN_CURRENT_BOARD_CREATE: `${PREFIX}/LABEL_IN_CURRENT_BOARD_CREATE`,
LABEL_CREATE_HANDLE: `${PREFIX}/LABEL_CREATE_HANDLE`,
@ -108,7 +108,7 @@ export default {
LABEL_TO_FILTER_IN_CURRENT_BOARD_ADD: `${PREFIX}/LABEL_TO_FILTER_IN_CURRENT_BOARD_ADD`,
LABEL_FROM_FILTER_IN_CURRENT_BOARD_REMOVE: `${PREFIX}/LABEL_FROM_FILTER_IN_CURRENT_BOARD_REMOVE`,
/* List */
/* Lists */
LIST_IN_CURRENT_BOARD_CREATE: `${PREFIX}/LIST_IN_CURRENT_BOARD_CREATE`,
LIST_CREATE_HANDLE: `${PREFIX}/LIST_CREATE_HANDLE`,
@ -118,7 +118,7 @@ export default {
LIST_DELETE: `${PREFIX}/LIST_DELETE`,
LIST_DELETE_HANDLE: `${PREFIX}/LIST_DELETE_HANDLE`,
/* Card */
/* Cards */
CARD_CREATE: `${PREFIX}/CARD_CREATE`,
CARD_CREATE_HANDLE: `${PREFIX}/CARD_CREATE_HANDLE`,
@ -133,7 +133,7 @@ export default {
CURRENT_CARD_DELETE: `${PREFIX}/CURRENT_CARD_DELETE`,
CARD_DELETE_HANDLE: `${PREFIX}/CARD_DELETE_HANDLE`,
/* Task */
/* Tasks */
TASK_IN_CURRENT_CARD_CREATE: `${PREFIX}/TASK_IN_CURRENT_CARD_CREATE`,
TASK_CREATE_HANDLE: `${PREFIX}/TASK_CREATE_HANDLE`,
@ -143,7 +143,7 @@ export default {
TASK_DELETE: `${PREFIX}/TASK_DELETE`,
TASK_DELETE_HANDLE: `${PREFIX}/TASK_DELETE_HANDLE`,
/* Attachment */
/* Attachments */
ATTACHMENT_IN_CURRENT_CARD_CREATE: `${PREFIX}/ATTACHMENT_IN_CURRENT_CARD_CREATE`,
ATTACHMENT_CREATE_HANDLE: `${PREFIX}/ATTACHMENT_CREATE_HANDLE`,
@ -152,24 +152,21 @@ export default {
ATTACHMENT_DELETE: `${PREFIX}/ATTACHMENT_DELETE`,
ATTACHMENT_DELETE_HANDLE: `${PREFIX}/ATTACHMENT_DELETE_HANDLE`,
/* Actions */
/* Activities */
ACTIONS_IN_CURRENT_CARD_FETCH: `${PREFIX}/ACTIONS_IN_CURRENT_CARD_FETCH`,
ACTIONS_DETAILS_IN_CURRENT_CARD_TOGGLE: `${PREFIX}/ACTIONS_DETAILS_IN_CURRENT_CARD_TOGGLE`,
ACTIVITIES_IN_CURRENT_CARD_FETCH: `${PREFIX}/ACTIVITIES_IN_CURRENT_CARD_FETCH`,
ACTIVITIES_DETAILS_IN_CURRENT_CARD_TOGGLE: `${PREFIX}/ACTIVITIES_DETAILS_IN_CURRENT_CARD_TOGGLE`,
ACTIVITY_CREATE_HANDLE: `${PREFIX}/ACTIVITY_CREATE_HANDLE`,
ACTIVITY_UPDATE_HANDLE: `${PREFIX}/ACTIVITY_UPDATE_HANDLE`,
ACTIVITY_DELETE_HANDLE: `${PREFIX}/ACTIVITY_DELETE_HANDLE`,
/* Action */
/* Comment activities */
ACTION_CREATE_HANDLE: `${PREFIX}/ACTION_CREATE_HANDLE`,
ACTION_UPDATE_HANDLE: `${PREFIX}/ACTION_UPDATE_HANDLE`,
ACTION_DELETE_HANDLE: `${PREFIX}/ACTION_DELETE_HANDLE`,
COMMENT_ACTIVITY_IN_CURRENT_CARD_CREATE: `${PREFIX}/COMMENT_ACTIVITY_IN_CURRENT_CARD_CREATE`,
COMMENT_ACTIVITY_UPDATE: `${PREFIX}/COMMENT_ACTIVITY_UPDATE`,
COMMENT_ACTIVITY_DELETE: `${PREFIX}/COMMENT_ACTIVITY_DELETE`,
/* Comment action */
COMMENT_ACTION_IN_CURRENT_CARD_CREATE: `${PREFIX}/COMMENT_ACTION_IN_CURRENT_CARD_CREATE`,
COMMENT_ACTION_UPDATE: `${PREFIX}/COMMENT_ACTION_UPDATE`,
COMMENT_ACTION_DELETE: `${PREFIX}/COMMENT_ACTION_DELETE`,
/* Notification */
/* Notifications */
NOTIFICATION_CREATE_HANDLE: `${PREFIX}/NOTIFICATION_CREATE_HANDLE`,
NOTIFICATION_DELETE: `${PREFIX}/NOTIFICATION_DELETE`,

View file

@ -7,7 +7,7 @@ export const BoardTypes = {
KANBAN: 'kanban',
};
export const ActionTypes = {
export const ActivityTypes = {
CREATE_CARD: 'createCard',
MOVE_CARD: 'moveCard',
COMMENT_CARD: 'commentCard',

View file

@ -1,34 +1,17 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import {
filterLabelsForCurrentBoardSelector,
filterUsersForCurrentBoardSelector,
isCurrentUserManagerForCurrentProjectSelector,
labelsForCurrentBoardSelector,
membershipsForCurrentBoardSelector,
usersSelector,
} from '../selectors';
import {
addLabelToFilterInCurrentBoard,
addUserToFilterInCurrentBoard,
createLabelInCurrentBoard,
createMembershipInCurrentBoard,
deleteBoardMembership,
deleteLabel,
removeLabelFromFilterInCurrentBoard,
removeUserFromFilterInCurrentBoard,
updateLabel,
} from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import BoardActions from '../components/BoardActions';
const mapStateToProps = (state) => {
const allUsers = usersSelector(state);
const isCurrentUserManager = isCurrentUserManagerForCurrentProjectSelector(state);
const memberships = membershipsForCurrentBoardSelector(state);
const labels = labelsForCurrentBoardSelector(state);
const filterUsers = filterUsersForCurrentBoardSelector(state);
const filterLabels = filterLabelsForCurrentBoardSelector(state);
const allUsers = selectors.selectUsers(state);
const isCurrentUserManager = selectors.selectIsCurrentUserManagerForCurrentProject(state);
const memberships = selectors.selectMembershipsForCurrentBoard(state);
const labels = selectors.selectLabelsForCurrentBoard(state);
const filterUsers = selectors.selectFilterUsersForCurrentBoard(state);
const filterLabels = selectors.selectFilterLabelsForCurrentBoard(state);
return {
memberships,
@ -43,15 +26,15 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onMembershipCreate: createMembershipInCurrentBoard,
onMembershipDelete: deleteBoardMembership,
onUserToFilterAdd: addUserToFilterInCurrentBoard,
onUserFromFilterRemove: removeUserFromFilterInCurrentBoard,
onLabelToFilterAdd: addLabelToFilterInCurrentBoard,
onLabelFromFilterRemove: removeLabelFromFilterInCurrentBoard,
onLabelCreate: createLabelInCurrentBoard,
onLabelUpdate: updateLabel,
onLabelDelete: deleteLabel,
onMembershipCreate: entryActions.createMembershipInCurrentBoard,
onMembershipDelete: entryActions.deleteBoardMembership,
onUserToFilterAdd: entryActions.addUserToFilterInCurrentBoard,
onUserFromFilterRemove: entryActions.removeUserFromFilterInCurrentBoard,
onLabelToFilterAdd: entryActions.addLabelToFilterInCurrentBoard,
onLabelFromFilterRemove: entryActions.removeLabelFromFilterInCurrentBoard,
onLabelCreate: entryActions.createLabelInCurrentBoard,
onLabelUpdate: entryActions.updateLabel,
onLabelDelete: entryActions.deleteLabel,
},
dispatch,
);

View file

@ -1,18 +1,14 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import {
isCurrentUserMemberForCurrentBoardSelector,
listIdsForCurrentBoardSelector,
pathSelector,
} from '../selectors';
import { createListInCurrentBoard, moveCard, moveList } from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import BoardKanban from '../components/BoardKanban';
const mapStateToProps = (state) => {
const { cardId } = pathSelector(state);
const isCurrentUserMember = isCurrentUserMemberForCurrentBoardSelector(state);
const listIds = listIdsForCurrentBoardSelector(state);
const { cardId } = selectors.selectPath(state);
const isCurrentUserMember = selectors.selectIsCurrentUserMemberForCurrentBoard(state);
const listIds = selectors.selectListIdsForCurrentBoard(state);
return {
listIds,
@ -24,9 +20,9 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onListCreate: createListInCurrentBoard,
onListMove: moveList,
onCardMove: moveCard,
onListCreate: entryActions.createListInCurrentBoard,
onListMove: entryActions.moveList,
onCardMove: entryActions.moveCard,
},
dispatch,
);

View file

@ -1,10 +1,10 @@
import { connect } from 'react-redux';
import { currentBoardSelector } from '../selectors';
import selectors from '../selectors';
import BoardWrapper from '../components/BoardWrapper';
const mapStateToProps = (state) => {
const { type, isFetching } = currentBoardSelector(state);
const { type, isFetching } = selectors.selectCurrentBoard(state);
return {
type,

View file

@ -1,18 +1,14 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import {
boardsForCurrentProjectSelector,
isCurrentUserManagerForCurrentProjectSelector,
pathSelector,
} from '../selectors';
import { createBoardInCurrentProject, deleteBoard, moveBoard, updateBoard } from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import Boards from '../components/Boards';
const mapStateToProps = (state) => {
const { boardId } = pathSelector(state);
const boards = boardsForCurrentProjectSelector(state);
const isCurrentUserManager = isCurrentUserManagerForCurrentProjectSelector(state);
const { boardId } = selectors.selectPath(state);
const boards = selectors.selectBoardsForCurrentProject(state);
const isCurrentUserManager = selectors.selectIsCurrentUserManagerForCurrentProject(state);
return {
items: boards,
@ -24,10 +20,10 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onCreate: createBoardInCurrentProject,
onUpdate: updateBoard,
onMove: moveBoard,
onDelete: deleteBoard,
onCreate: entryActions.createBoardInCurrentProject,
onUpdate: entryActions.updateBoard,
onMove: entryActions.moveBoard,
onDelete: entryActions.deleteBoard,
},
dispatch,
);

View file

@ -1,57 +1,33 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import {
isCurrentUserMemberForCurrentBoardSelector,
labelsForCurrentBoardSelector,
makeCardByIdSelector,
makeLabelsByCardIdSelector,
makeNotificationsTotalByCardIdSelector,
makeTasksByCardIdSelector,
makeUsersByCardIdSelector,
membershipsForCurrentBoardSelector,
pathSelector,
projectsToListsForCurrentUserSelector,
} from '../selectors';
import {
addLabelToCard,
addUserToCard,
createLabelInCurrentBoard,
deleteCard,
deleteLabel,
fetchBoard,
moveCard,
removeLabelFromCard,
removeUserFromCard,
transferCard,
updateLabel,
updateCard,
} from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import Card from '../components/Card';
const makeMapStateToProps = () => {
const cardByIdSelector = makeCardByIdSelector();
const usersByCardIdSelector = makeUsersByCardIdSelector();
const labelsByCardIdSelector = makeLabelsByCardIdSelector();
const tasksByCardIdSelector = makeTasksByCardIdSelector();
const notificationsTotalByCardIdSelector = makeNotificationsTotalByCardIdSelector();
const selectCardById = selectors.makeSelectCardById();
const selectUsersByCardId = selectors.makeSelectUsersByCardId();
const selectLabelsByCardId = selectors.makeSelectLabelsByCardId();
const selectTasksByCardId = selectors.makeSelectTasksByCardId();
const selectNotificationsTotalByCardId = selectors.makeSelectNotificationsTotalByCardId();
return (state, { id, index }) => {
const { projectId } = pathSelector(state);
const allProjectsToLists = projectsToListsForCurrentUserSelector(state);
const allBoardMemberships = membershipsForCurrentBoardSelector(state);
const allLabels = labelsForCurrentBoardSelector(state);
const isCurrentUserMember = isCurrentUserMemberForCurrentBoardSelector(state);
const { projectId } = selectors.selectPath(state);
const allProjectsToLists = selectors.selectProjectsToListsForCurrentUser(state);
const allBoardMemberships = selectors.selectMembershipsForCurrentBoard(state);
const allLabels = selectors.selectLabelsForCurrentBoard(state);
const isCurrentUserMember = selectors.selectIsCurrentUserMemberForCurrentBoard(state);
const { name, dueDate, timer, coverUrl, boardId, listId, isPersisted } = cardByIdSelector(
const { name, dueDate, timer, coverUrl, boardId, listId, isPersisted } = selectCardById(
state,
id,
);
const users = usersByCardIdSelector(state, id);
const labels = labelsByCardIdSelector(state, id);
const tasks = tasksByCardIdSelector(state, id);
const notificationsTotal = notificationsTotalByCardIdSelector(state, id);
const users = selectUsersByCardId(state, id);
const labels = selectLabelsByCardId(state, id);
const tasks = selectTasksByCardId(state, id);
const notificationsTotal = selectNotificationsTotalByCardId(state, id);
return {
id,
@ -79,18 +55,18 @@ const makeMapStateToProps = () => {
const mapDispatchToProps = (dispatch, { id }) =>
bindActionCreators(
{
onUpdate: (data) => updateCard(id, data),
onMove: (listId, index) => moveCard(id, listId, index),
onTransfer: (boardId, listId) => transferCard(id, boardId, listId),
onDelete: () => deleteCard(id),
onUserAdd: (userId) => addUserToCard(userId, id),
onUserRemove: (userId) => removeUserFromCard(userId, id),
onBoardFetch: fetchBoard,
onLabelAdd: (labelId) => addLabelToCard(labelId, id),
onLabelRemove: (labelId) => removeLabelFromCard(labelId, id),
onLabelCreate: (data) => createLabelInCurrentBoard(data),
onLabelUpdate: (labelId, data) => updateLabel(labelId, data),
onLabelDelete: (labelId) => deleteLabel(labelId),
onUpdate: (data) => entryActions.updateCard(id, data),
onMove: (listId, index) => entryActions.moveCard(id, listId, index),
onTransfer: (boardId, listId) => entryActions.transferCard(id, boardId, listId),
onDelete: () => entryActions.deleteCard(id),
onUserAdd: (userId) => entryActions.addUserToCard(userId, id),
onUserRemove: (userId) => entryActions.removeUserFromCard(userId, id),
onBoardFetch: entryActions.fetchBoard,
onLabelAdd: (labelId) => entryActions.addLabelToCard(labelId, id),
onLabelRemove: (labelId) => entryActions.removeLabelFromCard(labelId, id),
onLabelCreate: (data) => entryActions.createLabelInCurrentBoard(data),
onLabelUpdate: (labelId, data) => entryActions.updateLabel(labelId, data),
onLabelDelete: (labelId) => entryActions.deleteLabel(labelId),
},
dispatch,
);

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,

View file

@ -1,11 +1,11 @@
import { connect } from 'react-redux';
import { currentModalSelector, currentProjectSelector } from '../selectors';
import selectors from '../selectors';
import Core from '../components/Core';
const mapStateToProps = (state) => {
const currentModal = currentModalSelector(state);
const currentProject = currentProjectSelector(state);
const currentModal = selectors.selectCurrentModal(state);
const currentProject = selectors.selectCurrentProject(state);
return {
currentModal,

View file

@ -1,10 +1,10 @@
import { connect } from 'react-redux';
import { isCoreInitializingSelector } from '../selectors';
import selectors from '../selectors';
import CoreWrapper from '../components/CoreWrapper';
const mapStateToProps = (state) => {
const isCoreInitializing = isCoreInitializingSelector(state);
const isCoreInitializing = selectors.selectIsCoreInitializing(state);
return {
isInitializing: isCoreInitializing,

View file

@ -1,11 +1,11 @@
import { connect } from 'react-redux';
import { currentBoardSelector, pathSelector } from '../selectors';
import selectors from '../selectors';
import Fixed from '../components/Fixed';
const mapStateToProps = (state) => {
const { projectId } = pathSelector(state);
const currentBoard = currentBoardSelector(state);
const { projectId } = selectors.selectPath(state);
const currentBoard = selectors.selectCurrentBoard(state);
return {
projectId,

View file

@ -1,26 +1,15 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import {
currentProjectSelector,
currentUserSelector,
isCurrentUserManagerForCurrentProjectSelector,
notificationsForCurrentUserSelector,
} from '../selectors';
import {
deleteNotification,
logout,
openProjectSettingsModal,
openUserSettingsModal,
openUsersModal,
} from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import Header from '../components/Header';
const mapStateToProps = (state) => {
const currentUser = currentUserSelector(state);
const currentProject = currentProjectSelector(state);
const notifications = notificationsForCurrentUserSelector(state);
const isCurrentUserManager = isCurrentUserManagerForCurrentProjectSelector(state);
const currentUser = selectors.selectCurrentUser(state);
const currentProject = selectors.selectCurrentProject(state);
const notifications = selectors.selectNotificationsForCurrentUser(state);
const isCurrentUserManager = selectors.selectIsCurrentUserManagerForCurrentProject(state);
return {
notifications,
@ -34,11 +23,11 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onProjectSettingsClick: openProjectSettingsModal,
onUsersClick: openUsersModal,
onNotificationDelete: deleteNotification,
onUserSettingsClick: openUserSettingsModal,
onLogout: logout,
onProjectSettingsClick: entryActions.openProjectSettingsModal,
onUsersClick: entryActions.openUsersModal,
onNotificationDelete: entryActions.deleteNotification,
onUserSettingsClick: entryActions.openUserSettingsModal,
onLogout: entryActions.logout,
},
dispatch,
);

View file

@ -1,22 +1,18 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import {
isCurrentUserMemberForCurrentBoardSelector,
makeCardIdsByListIdSelector,
makeListByIdSelector,
} from '../selectors';
import { createCard, deleteList, updateList } from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import List from '../components/List';
const makeMapStateToProps = () => {
const listByIdSelector = makeListByIdSelector();
const cardIdsByListIdSelector = makeCardIdsByListIdSelector();
const selectListById = selectors.makeSelectListById();
const selectCardIdsByListId = selectors.makeSelectCardIdsByListId();
return (state, { id, index }) => {
const { name, isPersisted } = listByIdSelector(state, id);
const cardIds = cardIdsByListIdSelector(state, id);
const isCurrentUserMember = isCurrentUserMemberForCurrentBoardSelector(state);
const { name, isPersisted } = selectListById(state, id);
const cardIds = selectCardIdsByListId(state, id);
const isCurrentUserMember = selectors.selectIsCurrentUserMemberForCurrentBoard(state);
return {
id,
@ -32,9 +28,9 @@ const makeMapStateToProps = () => {
const mapDispatchToProps = (dispatch, { id }) =>
bindActionCreators(
{
onUpdate: (data) => updateList(id, data),
onDelete: () => deleteList(id),
onCardCreate: (data) => createCard(id, data),
onUpdate: (data) => entryActions.updateList(id, data),
onDelete: () => entryActions.deleteList(id),
onCardCreate: (data) => entryActions.createCard(id, data),
},
dispatch,
);

View file

@ -1,7 +1,7 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { authenticate, clearAuthenticateError } from '../actions/entry';
import entryActions from '../entry-actions';
import Login from '../components/Login';
const mapStateToProps = ({
@ -17,8 +17,8 @@ const mapStateToProps = ({
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onAuthenticate: authenticate,
onMessageDismiss: clearAuthenticateError,
onAuthenticate: entryActions.authenticate,
onMessageDismiss: entryActions.clearAuthenticateError,
},
dispatch,
);

View file

@ -1,7 +1,7 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { closeModal, createProject } from '../actions/entry';
import entryActions from '../entry-actions';
import ProjectAddModal from '../components/ProjectAddModal';
const mapStateToProps = ({
@ -16,8 +16,8 @@ const mapStateToProps = ({
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onCreate: createProject,
onClose: closeModal,
onCreate: entryActions.createProject,
onClose: entryActions.closeModal,
},
dispatch,
);

View file

@ -1,11 +1,11 @@
import { connect } from 'react-redux';
import { currentModalSelector } from '../selectors';
import selectors from '../selectors';
import ModalTypes from '../constants/ModalTypes';
import Project from '../components/Project';
const mapStateToProps = (state) => {
const currentModal = currentModalSelector(state);
const currentModal = selectors.selectCurrentModal(state);
return {
isSettingsModalOpened: currentModal === ModalTypes.PROJECT_SETTINGS,

View file

@ -1,28 +1,17 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import {
currentProjectSelector,
managersForCurrentProjectSelector,
usersSelector,
} from '../selectors';
import {
closeModal,
createManagerInCurrentProject,
deleteCurrentProject,
deleteProjectManager,
updateCurrentProject,
updateCurrentProjectBackgroundImage,
} from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import ProjectSettingsModal from '../components/ProjectSettingsModal';
const mapStateToProps = (state) => {
const users = usersSelector(state);
const users = selectors.selectUsers(state);
const { name, background, backgroundImage, isBackgroundImageUpdating } =
currentProjectSelector(state);
selectors.selectCurrentProject(state);
const managers = managersForCurrentProjectSelector(state);
const managers = selectors.selectManagersForCurrentProject(state);
return {
name,
@ -37,12 +26,12 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onUpdate: updateCurrentProject,
onBackgroundImageUpdate: updateCurrentProjectBackgroundImage,
onDelete: deleteCurrentProject,
onManagerCreate: createManagerInCurrentProject,
onManagerDelete: deleteProjectManager,
onClose: closeModal,
onUpdate: entryActions.updateCurrentProject,
onBackgroundImageUpdate: entryActions.updateCurrentProjectBackgroundImage,
onDelete: entryActions.deleteCurrentProject,
onManagerCreate: entryActions.createManagerInCurrentProject,
onManagerDelete: entryActions.deleteProjectManager,
onClose: entryActions.closeModal,
},
dispatch,
);

View file

@ -1,16 +1,16 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { currentUserSelector, projectsForCurrentUserSelector } from '../selectors';
import { openProjectAddModal } from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import Projects from '../components/Projects';
const mapStateToProps = (state) => {
const { isAdmin } = currentUserSelector(state);
const project = projectsForCurrentUserSelector(state);
const { isAdmin } = selectors.selectCurrentUser(state);
const projects = selectors.selectProjectsForCurrentUser(state);
return {
items: project,
items: projects,
canAdd: isAdmin,
};
};
@ -18,7 +18,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onAdd: openProjectAddModal,
onAdd: entryActions.openProjectAddModal,
},
dispatch,
);

View file

@ -1,10 +1,10 @@
import { connect } from 'react-redux';
import { pathSelector } from '../selectors';
import selectors from '../selectors';
import Static from '../components/Static';
const mapStateToProps = (state) => {
const { cardId, boardId, projectId } = pathSelector(state);
const { cardId, boardId, projectId } = selectors.selectPath(state);
return {
cardId,

View file

@ -1,7 +1,7 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { clearUserCreateError, createUser } from '../actions/entry';
import entryActions from '../entry-actions';
import UserAddPopup from '../components/UserAddPopup';
const mapStateToProps = ({
@ -17,8 +17,8 @@ const mapStateToProps = ({
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onCreate: createUser,
onMessageDismiss: clearUserCreateError,
onCreate: entryActions.createUser,
onMessageDismiss: entryActions.clearUserCreateError,
},
dispatch,
);

View file

@ -1,19 +1,8 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { currentUserSelector } from '../selectors';
import {
clearCurrentUserEmailUpdateError,
clearCurrentUserPasswordUpdateError,
clearCurrentUserUsernameUpdateError,
closeModal,
updateCurrentUser,
updateCurrentUserAvatar,
updateCurrentUserEmail,
updateCurrentUserLanguage,
updateCurrentUserPassword,
updateCurrentUserUsername,
} from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import UserSettingsModal from '../components/UserSettingsModal';
const mapStateToProps = (state) => {
@ -30,7 +19,7 @@ const mapStateToProps = (state) => {
emailUpdateForm,
passwordUpdateForm,
usernameUpdateForm,
} = currentUserSelector(state);
} = selectors.selectCurrentUser(state);
return {
email,
@ -51,16 +40,16 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onUpdate: updateCurrentUser,
onAvatarUpdate: updateCurrentUserAvatar,
onLanguageUpdate: updateCurrentUserLanguage,
onUsernameUpdate: updateCurrentUserUsername,
onUsernameUpdateMessageDismiss: clearCurrentUserUsernameUpdateError,
onEmailUpdate: updateCurrentUserEmail,
onEmailUpdateMessageDismiss: clearCurrentUserEmailUpdateError,
onPasswordUpdate: updateCurrentUserPassword,
onPasswordUpdateMessageDismiss: clearCurrentUserPasswordUpdateError,
onClose: closeModal,
onUpdate: entryActions.updateCurrentUser,
onAvatarUpdate: entryActions.updateCurrentUserAvatar,
onLanguageUpdate: entryActions.updateCurrentUserLanguage,
onUsernameUpdate: entryActions.updateCurrentUserUsername,
onUsernameUpdateMessageDismiss: entryActions.clearCurrentUserUsernameUpdateError,
onEmailUpdate: entryActions.updateCurrentUserEmail,
onEmailUpdateMessageDismiss: entryActions.clearCurrentUserEmailUpdateError,
onPasswordUpdate: entryActions.updateCurrentUserPassword,
onPasswordUpdateMessageDismiss: entryActions.clearCurrentUserPasswordUpdateError,
onClose: entryActions.closeModal,
},
dispatch,
);

View file

@ -1,22 +1,12 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { usersExceptCurrentSelector } from '../selectors';
import {
clearUserEmailUpdateError,
clearUserPasswordUpdateError,
clearUserUsernameUpdateError,
closeModal,
deleteUser,
updateUser,
updateUserEmail,
updateUserPassword,
updateUserUsername,
} from '../actions/entry';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import UsersModal from '../components/UsersModal';
const mapStateToProps = (state) => {
const users = usersExceptCurrentSelector(state);
const users = selectors.selectUsersExceptCurrent(state);
return {
items: users,
@ -26,15 +16,15 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
onUpdate: updateUser,
onUsernameUpdate: updateUserUsername,
onUsernameUpdateMessageDismiss: clearUserUsernameUpdateError,
onEmailUpdate: updateUserEmail,
onEmailUpdateMessageDismiss: clearUserEmailUpdateError,
onPasswordUpdate: updateUserPassword,
onPasswordUpdateMessageDismiss: clearUserPasswordUpdateError,
onDelete: deleteUser,
onClose: closeModal,
onUpdate: entryActions.updateUser,
onUsernameUpdate: entryActions.updateUserUsername,
onUsernameUpdateMessageDismiss: entryActions.clearUserUsernameUpdateError,
onEmailUpdate: entryActions.updateUserEmail,
onEmailUpdateMessageDismiss: entryActions.clearUserEmailUpdateError,
onPasswordUpdate: entryActions.updateUserPassword,
onPasswordUpdateMessageDismiss: entryActions.clearUserPasswordUpdateError,
onDelete: entryActions.deleteUser,
onClose: entryActions.closeModal,
},
dispatch,
);

View file

@ -0,0 +1,42 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const fetchActivitiesInCurrentCard = () => ({
type: EntryActionTypes.ACTIVITIES_IN_CURRENT_CARD_FETCH,
payload: {},
});
const toggleActivitiesDetailsInCurrentCard = (isVisible) => ({
type: EntryActionTypes.ACTIVITIES_DETAILS_IN_CURRENT_CARD_TOGGLE,
payload: {
isVisible,
},
});
const handleActivityCreate = (activity) => ({
type: EntryActionTypes.ACTIVITY_CREATE_HANDLE,
payload: {
activity,
},
});
const handleActivityUpdate = (activity) => ({
type: EntryActionTypes.ACTIVITY_UPDATE_HANDLE,
payload: {
activity,
},
});
const handleActivityDelete = (activity) => ({
type: EntryActionTypes.ACTIVITY_DELETE_HANDLE,
payload: {
activity,
},
});
export default {
fetchActivitiesInCurrentCard,
toggleActivitiesDetailsInCurrentCard,
handleActivityCreate,
handleActivityUpdate,
handleActivityDelete,
};

View file

@ -1,13 +1,13 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
import EntryActionTypes from '../constants/EntryActionTypes';
export const createAttachmentInCurrentCard = (data) => ({
const createAttachmentInCurrentCard = (data) => ({
type: EntryActionTypes.ATTACHMENT_IN_CURRENT_CARD_CREATE,
payload: {
data,
},
});
export const handleAttachmentCreate = (attachment, requestId) => ({
const handleAttachmentCreate = (attachment, requestId) => ({
type: EntryActionTypes.ATTACHMENT_CREATE_HANDLE,
payload: {
attachment,
@ -15,7 +15,7 @@ export const handleAttachmentCreate = (attachment, requestId) => ({
},
});
export const updateAttachment = (id, data) => ({
const updateAttachment = (id, data) => ({
type: EntryActionTypes.ATTACHMENT_UPDATE,
payload: {
id,
@ -23,23 +23,32 @@ export const updateAttachment = (id, data) => ({
},
});
export const handleAttachmentUpdate = (attachment) => ({
const handleAttachmentUpdate = (attachment) => ({
type: EntryActionTypes.ATTACHMENT_UPDATE_HANDLE,
payload: {
attachment,
},
});
export const deleteAttachment = (id) => ({
const deleteAttachment = (id) => ({
type: EntryActionTypes.ATTACHMENT_DELETE,
payload: {
id,
},
});
export const handleAttachmentDelete = (attachment) => ({
const handleAttachmentDelete = (attachment) => ({
type: EntryActionTypes.ATTACHMENT_DELETE_HANDLE,
payload: {
attachment,
},
});
export default {
createAttachmentInCurrentCard,
handleAttachmentCreate,
updateAttachment,
handleAttachmentUpdate,
deleteAttachment,
handleAttachmentDelete,
};

View file

@ -0,0 +1,36 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createMembershipInCurrentBoard = (data) => ({
type: EntryActionTypes.MEMBERSHIP_IN_CURRENT_BOARD_CREATE,
payload: {
data,
},
});
const handleBoardMembershipCreate = (boardMembership) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE,
payload: {
boardMembership,
},
});
const deleteBoardMembership = (id) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_DELETE,
payload: {
id,
},
});
const handleBoardMembershipDelete = (boardMembership) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_DELETE_HANDLE,
payload: {
boardMembership,
},
});
export default {
createMembershipInCurrentBoard,
handleBoardMembershipCreate,
deleteBoardMembership,
handleBoardMembershipDelete,
};

View file

@ -1,27 +1,27 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
import EntryActionTypes from '../constants/EntryActionTypes';
export const createBoardInCurrentProject = (data) => ({
const createBoardInCurrentProject = (data) => ({
type: EntryActionTypes.BOARD_IN_CURRENT_PROJECT_CREATE,
payload: {
data,
},
});
export const handleBoardCreate = (board) => ({
const handleBoardCreate = (board) => ({
type: EntryActionTypes.BOARD_CREATE_HANDLE,
payload: {
board,
},
});
export const fetchBoard = (id) => ({
const fetchBoard = (id) => ({
type: EntryActionTypes.BOARD_FETCH,
payload: {
id,
},
});
export const updateBoard = (id, data) => ({
const updateBoard = (id, data) => ({
type: EntryActionTypes.BOARD_UPDATE,
payload: {
id,
@ -29,14 +29,14 @@ export const updateBoard = (id, data) => ({
},
});
export const handleBoardUpdate = (board) => ({
const handleBoardUpdate = (board) => ({
type: EntryActionTypes.BOARD_UPDATE_HANDLE,
payload: {
board,
},
});
export const moveBoard = (id, index) => ({
const moveBoard = (id, index) => ({
type: EntryActionTypes.BOARD_MOVE,
payload: {
id,
@ -44,16 +44,27 @@ export const moveBoard = (id, index) => ({
},
});
export const deleteBoard = (id) => ({
const deleteBoard = (id) => ({
type: EntryActionTypes.BOARD_DELETE,
payload: {
id,
},
});
export const handleBoardDelete = (board) => ({
const handleBoardDelete = (board) => ({
type: EntryActionTypes.BOARD_DELETE_HANDLE,
payload: {
board,
},
});
export default {
createBoardInCurrentProject,
handleBoardCreate,
fetchBoard,
updateBoard,
handleBoardUpdate,
moveBoard,
deleteBoard,
handleBoardDelete,
};

View file

@ -1,6 +1,6 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
import EntryActionTypes from '../constants/EntryActionTypes';
export const createCard = (listId, data) => ({
const createCard = (listId, data) => ({
type: EntryActionTypes.CARD_CREATE,
payload: {
listId,
@ -8,14 +8,14 @@ export const createCard = (listId, data) => ({
},
});
export const handleCardCreate = (card) => ({
const handleCardCreate = (card) => ({
type: EntryActionTypes.CARD_CREATE_HANDLE,
payload: {
card,
},
});
export const updateCard = (id, data) => ({
const updateCard = (id, data) => ({
type: EntryActionTypes.CARD_UPDATE,
payload: {
id,
@ -23,21 +23,21 @@ export const updateCard = (id, data) => ({
},
});
export const updateCurrentCard = (data) => ({
const updateCurrentCard = (data) => ({
type: EntryActionTypes.CURRENT_CARD_UPDATE,
payload: {
data,
},
});
export const handleCardUpdate = (card) => ({
const handleCardUpdate = (card) => ({
type: EntryActionTypes.CARD_UPDATE_HANDLE,
payload: {
card,
},
});
export const moveCard = (id, listId, index = 0) => ({
const moveCard = (id, listId, index = 0) => ({
type: EntryActionTypes.CARD_MOVE,
payload: {
id,
@ -46,7 +46,7 @@ export const moveCard = (id, listId, index = 0) => ({
},
});
export const moveCurrentCard = (listId, index = 0) => ({
const moveCurrentCard = (listId, index = 0) => ({
type: EntryActionTypes.CURRENT_CARD_MOVE,
payload: {
listId,
@ -54,7 +54,7 @@ export const moveCurrentCard = (listId, index = 0) => ({
},
});
export const transferCard = (id, boardId, listId, index = 0) => ({
const transferCard = (id, boardId, listId, index = 0) => ({
type: EntryActionTypes.CARD_TRANSFER,
payload: {
id,
@ -64,7 +64,7 @@ export const transferCard = (id, boardId, listId, index = 0) => ({
},
});
export const transferCurrentCard = (boardId, listId, index = 0) => ({
const transferCurrentCard = (boardId, listId, index = 0) => ({
type: EntryActionTypes.CURRENT_CARD_TRANSFER,
payload: {
boardId,
@ -73,21 +73,36 @@ export const transferCurrentCard = (boardId, listId, index = 0) => ({
},
});
export const deleteCard = (id) => ({
const deleteCard = (id) => ({
type: EntryActionTypes.CARD_DELETE,
payload: {
id,
},
});
export const deleteCurrentCard = () => ({
const deleteCurrentCard = () => ({
type: EntryActionTypes.CURRENT_CARD_DELETE,
payload: {},
});
export const handleCardDelete = (card) => ({
const handleCardDelete = (card) => ({
type: EntryActionTypes.CARD_DELETE_HANDLE,
payload: {
card,
},
});
export default {
createCard,
handleCardCreate,
updateCard,
updateCurrentCard,
handleCardUpdate,
moveCard,
moveCurrentCard,
transferCard,
transferCurrentCard,
deleteCard,
deleteCurrentCard,
handleCardDelete,
};

View file

@ -0,0 +1,29 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createCommentActivityInCurrentCard = (data) => ({
type: EntryActionTypes.COMMENT_ACTIVITY_IN_CURRENT_CARD_CREATE,
payload: {
data,
},
});
const updateCommentActivity = (id, data) => ({
type: EntryActionTypes.COMMENT_ACTIVITY_UPDATE,
payload: {
id,
data,
},
});
const deleteCommentActivity = (id) => ({
type: EntryActionTypes.COMMENT_ACTIVITY_DELETE,
payload: {
id,
},
});
export default {
createCommentActivityInCurrentCard,
updateCommentActivity,
deleteCommentActivity,
};

View file

@ -0,0 +1,16 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const initializeCore = () => ({
type: EntryActionTypes.CORE_INITIALIZE,
payload: {},
});
const logout = () => ({
type: EntryActionTypes.LOGOUT,
payload: {},
});
export default {
initializeCore,
logout,
};

View file

@ -0,0 +1,37 @@
import socket from './socket';
import login from './login';
import core from './core';
import modals from './modals';
import users from './users';
import projects from './projects';
import projectManagers from './project-managers';
import boards from './boards';
import boardMemberships from './board-memberships';
import labels from './labels';
import lists from './lists';
import cards from './cards';
import tasks from './tasks';
import attachments from './attachments';
import activities from './activities';
import commentActivities from './comment-activities';
import notifications from './notifications';
export default {
...socket,
...login,
...core,
...modals,
...users,
...projects,
...projectManagers,
...boards,
...boardMemberships,
...labels,
...lists,
...cards,
...tasks,
...attachments,
...activities,
...commentActivities,
...notifications,
};

View file

@ -1,20 +1,20 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
import EntryActionTypes from '../constants/EntryActionTypes';
export const createLabelInCurrentBoard = (data) => ({
const createLabelInCurrentBoard = (data) => ({
type: EntryActionTypes.LABEL_IN_CURRENT_BOARD_CREATE,
payload: {
data,
},
});
export const handleLabelCreate = (label) => ({
const handleLabelCreate = (label) => ({
type: EntryActionTypes.LABEL_CREATE_HANDLE,
payload: {
label,
},
});
export const updateLabel = (id, data) => ({
const updateLabel = (id, data) => ({
type: EntryActionTypes.LABEL_UPDATE,
payload: {
id,
@ -22,28 +22,28 @@ export const updateLabel = (id, data) => ({
},
});
export const handleLabelUpdate = (label) => ({
const handleLabelUpdate = (label) => ({
type: EntryActionTypes.LABEL_UPDATE_HANDLE,
payload: {
label,
},
});
export const deleteLabel = (id) => ({
const deleteLabel = (id) => ({
type: EntryActionTypes.LABEL_DELETE,
payload: {
id,
},
});
export const handleLabelDelete = (label) => ({
const handleLabelDelete = (label) => ({
type: EntryActionTypes.LABEL_DELETE_HANDLE,
payload: {
label,
},
});
export const addLabelToCard = (id, cardId) => ({
const addLabelToCard = (id, cardId) => ({
type: EntryActionTypes.LABEL_TO_CARD_ADD,
payload: {
id,
@ -51,21 +51,21 @@ export const addLabelToCard = (id, cardId) => ({
},
});
export const addLabelToCurrentCard = (id) => ({
const addLabelToCurrentCard = (id) => ({
type: EntryActionTypes.LABEL_TO_CURRENT_CARD_ADD,
payload: {
id,
},
});
export const handleLabelToCardAdd = (cardLabel) => ({
const handleLabelToCardAdd = (cardLabel) => ({
type: EntryActionTypes.LABEL_TO_CARD_ADD_HANDLE,
payload: {
cardLabel,
},
});
export const removeLabelFromCard = (id, cardId) => ({
const removeLabelFromCard = (id, cardId) => ({
type: EntryActionTypes.LABEL_FROM_CARD_REMOVE,
payload: {
id,
@ -73,30 +73,47 @@ export const removeLabelFromCard = (id, cardId) => ({
},
});
export const removeLabelFromCurrentCard = (id) => ({
const removeLabelFromCurrentCard = (id) => ({
type: EntryActionTypes.LABEL_FROM_CURRENT_CARD_REMOVE,
payload: {
id,
},
});
export const handleLabelFromCardRemove = (cardLabel) => ({
const handleLabelFromCardRemove = (cardLabel) => ({
type: EntryActionTypes.LABEL_FROM_CARD_REMOVE_HANDLE,
payload: {
cardLabel,
},
});
export const addLabelToFilterInCurrentBoard = (id) => ({
const addLabelToFilterInCurrentBoard = (id) => ({
type: EntryActionTypes.LABEL_TO_FILTER_IN_CURRENT_BOARD_ADD,
payload: {
id,
},
});
export const removeLabelFromFilterInCurrentBoard = (id) => ({
const removeLabelFromFilterInCurrentBoard = (id) => ({
type: EntryActionTypes.LABEL_FROM_FILTER_IN_CURRENT_BOARD_REMOVE,
payload: {
id,
},
});
export default {
createLabelInCurrentBoard,
handleLabelCreate,
updateLabel,
handleLabelUpdate,
deleteLabel,
handleLabelDelete,
addLabelToCard,
addLabelToCurrentCard,
handleLabelToCardAdd,
removeLabelFromCard,
removeLabelFromCurrentCard,
handleLabelFromCardRemove,
addLabelToFilterInCurrentBoard,
removeLabelFromFilterInCurrentBoard,
};

View file

@ -1,20 +1,20 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
import EntryActionTypes from '../constants/EntryActionTypes';
export const createListInCurrentBoard = (data) => ({
const createListInCurrentBoard = (data) => ({
type: EntryActionTypes.LIST_IN_CURRENT_BOARD_CREATE,
payload: {
data,
},
});
export const handleListCreate = (list) => ({
const handleListCreate = (list) => ({
type: EntryActionTypes.LIST_CREATE_HANDLE,
payload: {
list,
},
});
export const updateList = (id, data) => ({
const updateList = (id, data) => ({
type: EntryActionTypes.LIST_UPDATE,
payload: {
id,
@ -22,14 +22,14 @@ export const updateList = (id, data) => ({
},
});
export const handleListUpdate = (list) => ({
const handleListUpdate = (list) => ({
type: EntryActionTypes.LIST_UPDATE_HANDLE,
payload: {
list,
},
});
export const moveList = (id, index) => ({
const moveList = (id, index) => ({
type: EntryActionTypes.LIST_MOVE,
payload: {
id,
@ -37,16 +37,26 @@ export const moveList = (id, index) => ({
},
});
export const deleteList = (id) => ({
const deleteList = (id) => ({
type: EntryActionTypes.LIST_DELETE,
payload: {
id,
},
});
export const handleListDelete = (list) => ({
const handleListDelete = (list) => ({
type: EntryActionTypes.LIST_DELETE_HANDLE,
payload: {
list,
},
});
export default {
createListInCurrentBoard,
handleListCreate,
updateList,
handleListUpdate,
moveList,
deleteList,
handleListDelete,
};

View file

@ -0,0 +1,18 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const authenticate = (data) => ({
type: EntryActionTypes.AUTHENTICATE,
payload: {
data,
},
});
const clearAuthenticateError = () => ({
type: EntryActionTypes.AUTHENTICATE_ERROR_CLEAR,
payload: {},
});
export default {
authenticate,
clearAuthenticateError,
};

View file

@ -1,35 +1,43 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
import ModalTypes from '../../constants/ModalTypes';
import EntryActionTypes from '../constants/EntryActionTypes';
import ModalTypes from '../constants/ModalTypes';
export const openUsersModal = () => ({
const openUsersModal = () => ({
type: EntryActionTypes.MODAL_OPEN,
payload: {
type: ModalTypes.USERS,
},
});
export const openUserSettingsModal = () => ({
const openUserSettingsModal = () => ({
type: EntryActionTypes.MODAL_OPEN,
payload: {
type: ModalTypes.USER_SETTINGS,
},
});
export const openProjectAddModal = () => ({
const openProjectAddModal = () => ({
type: EntryActionTypes.MODAL_OPEN,
payload: {
type: ModalTypes.PROJECT_ADD,
},
});
export const openProjectSettingsModal = () => ({
const openProjectSettingsModal = () => ({
type: EntryActionTypes.MODAL_OPEN,
payload: {
type: ModalTypes.PROJECT_SETTINGS,
},
});
export const closeModal = () => ({
const closeModal = () => ({
type: EntryActionTypes.MODAL_CLOSE,
payload: {},
});
export default {
openUsersModal,
openUserSettingsModal,
openProjectAddModal,
openProjectSettingsModal,
closeModal,
};

View file

@ -0,0 +1,28 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const handleNotificationCreate = (notification) => ({
type: EntryActionTypes.NOTIFICATION_CREATE_HANDLE,
payload: {
notification,
},
});
const deleteNotification = (id) => ({
type: EntryActionTypes.NOTIFICATION_DELETE,
payload: {
id,
},
});
const handleNotificationDelete = (notification) => ({
type: EntryActionTypes.NOTIFICATION_DELETE_HANDLE,
payload: {
notification,
},
});
export default {
handleNotificationCreate,
deleteNotification,
handleNotificationDelete,
};

View file

@ -0,0 +1,36 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const createManagerInCurrentProject = (data) => ({
type: EntryActionTypes.MANAGER_IN_CURRENT_PROJECT_CREATE,
payload: {
data,
},
});
const handleProjectManagerCreate = (projectManager) => ({
type: EntryActionTypes.PROJECT_MANAGER_CREATE_HANDLE,
payload: {
projectManager,
},
});
const deleteProjectManager = (id) => ({
type: EntryActionTypes.PROJECT_MANAGER_DELETE,
payload: {
id,
},
});
const handleProjectManagerDelete = (projectManager) => ({
type: EntryActionTypes.PROJECT_MANAGER_DELETE_HANDLE,
payload: {
projectManager,
},
});
export default {
createManagerInCurrentProject,
handleProjectManagerCreate,
deleteProjectManager,
handleProjectManagerDelete,
};

View file

@ -1,48 +1,58 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
import EntryActionTypes from '../constants/EntryActionTypes';
export const createProject = (data) => ({
const createProject = (data) => ({
type: EntryActionTypes.PROJECT_CREATE,
payload: {
data,
},
});
export const handleProjectCreate = (project) => ({
const handleProjectCreate = (project) => ({
type: EntryActionTypes.PROJECT_CREATE_HANDLE,
payload: {
project,
},
});
export const updateCurrentProject = (data) => ({
const updateCurrentProject = (data) => ({
type: EntryActionTypes.CURRENT_PROJECT_UPDATE,
payload: {
data,
},
});
export const handleProjectUpdate = (project) => ({
const handleProjectUpdate = (project) => ({
type: EntryActionTypes.PROJECT_UPDATE_HANDLE,
payload: {
project,
},
});
export const updateCurrentProjectBackgroundImage = (data) => ({
const updateCurrentProjectBackgroundImage = (data) => ({
type: EntryActionTypes.CURRENT_PROJECT_BACKGROUND_IMAGE_UPDATE,
payload: {
data,
},
});
export const deleteCurrentProject = () => ({
const deleteCurrentProject = () => ({
type: EntryActionTypes.CURRENT_PROJECT_DELETE,
payload: {},
});
export const handleProjectDelete = (project) => ({
const handleProjectDelete = (project) => ({
type: EntryActionTypes.PROJECT_DELETE_HANDLE,
payload: {
project,
},
});
export default {
createProject,
handleProjectCreate,
updateCurrentProject,
handleProjectUpdate,
updateCurrentProjectBackgroundImage,
deleteCurrentProject,
handleProjectDelete,
};

View file

@ -0,0 +1,16 @@
import EntryActionTypes from '../constants/EntryActionTypes';
const handleSocketDisconnect = () => ({
type: EntryActionTypes.SOCKET_DISCONNECT_HANDLE,
payload: {},
});
const handleSocketReconnect = () => ({
type: EntryActionTypes.SOCKET_RECONNECT_HANDLE,
payload: {},
});
export default {
handleSocketDisconnect,
handleSocketReconnect,
};

View file

@ -1,20 +1,20 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
import EntryActionTypes from '../constants/EntryActionTypes';
export const createTaskInCurrentCard = (data) => ({
const createTaskInCurrentCard = (data) => ({
type: EntryActionTypes.TASK_IN_CURRENT_CARD_CREATE,
payload: {
data,
},
});
export const handleTaskCreate = (task) => ({
const handleTaskCreate = (task) => ({
type: EntryActionTypes.TASK_CREATE_HANDLE,
payload: {
task,
},
});
export const updateTask = (id, data) => ({
const updateTask = (id, data) => ({
type: EntryActionTypes.TASK_UPDATE,
payload: {
id,
@ -22,14 +22,14 @@ export const updateTask = (id, data) => ({
},
});
export const handleTaskUpdate = (task) => ({
const handleTaskUpdate = (task) => ({
type: EntryActionTypes.TASK_UPDATE_HANDLE,
payload: {
task,
},
});
export const moveTask = (id, index) => ({
const moveTask = (id, index) => ({
type: EntryActionTypes.TASK_MOVE,
payload: {
id,
@ -37,16 +37,26 @@ export const moveTask = (id, index) => ({
},
});
export const deleteTask = (id) => ({
const deleteTask = (id) => ({
type: EntryActionTypes.TASK_DELETE,
payload: {
id,
},
});
export const handleTaskDelete = (task) => ({
const handleTaskDelete = (task) => ({
type: EntryActionTypes.TASK_DELETE_HANDLE,
payload: {
task,
},
});
export default {
createTaskInCurrentCard,
handleTaskCreate,
updateTask,
handleTaskUpdate,
moveTask,
deleteTask,
handleTaskDelete,
};

View file

@ -1,25 +1,25 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
import EntryActionTypes from '../constants/EntryActionTypes';
export const createUser = (data) => ({
const createUser = (data) => ({
type: EntryActionTypes.USER_CREATE,
payload: {
data,
},
});
export const handleUserCreate = (user) => ({
const handleUserCreate = (user) => ({
type: EntryActionTypes.USER_CREATE_HANDLE,
payload: {
user,
},
});
export const clearUserCreateError = () => ({
const clearUserCreateError = () => ({
type: EntryActionTypes.USER_CREATE_ERROR_CLEAR,
payload: {},
});
export const updateUser = (id, data) => ({
const updateUser = (id, data) => ({
type: EntryActionTypes.USER_UPDATE,
payload: {
id,
@ -27,28 +27,28 @@ export const updateUser = (id, data) => ({
},
});
export const updateCurrentUser = (data) => ({
const updateCurrentUser = (data) => ({
type: EntryActionTypes.CURRENT_USER_UPDATE,
payload: {
data,
},
});
export const handleUserUpdate = (user) => ({
const handleUserUpdate = (user) => ({
type: EntryActionTypes.USER_UPDATE_HANDLE,
payload: {
user,
},
});
export const updateCurrentUserLanguage = (language) => ({
const updateCurrentUserLanguage = (language) => ({
type: EntryActionTypes.CURRENT_USER_LANGUAGE_UPDATE,
payload: {
language,
},
});
export const updateUserEmail = (id, data) => ({
const updateUserEmail = (id, data) => ({
type: EntryActionTypes.USER_EMAIL_UPDATE,
payload: {
id,
@ -56,26 +56,26 @@ export const updateUserEmail = (id, data) => ({
},
});
export const updateCurrentUserEmail = (data) => ({
const updateCurrentUserEmail = (data) => ({
type: EntryActionTypes.CURRENT_USER_EMAIL_UPDATE,
payload: {
data,
},
});
export const clearUserEmailUpdateError = (id) => ({
const clearUserEmailUpdateError = (id) => ({
type: EntryActionTypes.USER_EMAIL_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
export const clearCurrentUserEmailUpdateError = () => ({
const clearCurrentUserEmailUpdateError = () => ({
type: EntryActionTypes.CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR,
payload: {},
});
export const updateUserPassword = (id, data) => ({
const updateUserPassword = (id, data) => ({
type: EntryActionTypes.USER_PASSWORD_UPDATE,
payload: {
id,
@ -83,26 +83,26 @@ export const updateUserPassword = (id, data) => ({
},
});
export const updateCurrentUserPassword = (data) => ({
const updateCurrentUserPassword = (data) => ({
type: EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE,
payload: {
data,
},
});
export const clearUserPasswordUpdateError = (id) => ({
const clearUserPasswordUpdateError = (id) => ({
type: EntryActionTypes.USER_PASSWORD_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
export const clearCurrentUserPasswordUpdateError = () => ({
const clearCurrentUserPasswordUpdateError = () => ({
type: EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR,
payload: {},
});
export const updateUserUsername = (id, data) => ({
const updateUserUsername = (id, data) => ({
type: EntryActionTypes.USER_USERNAME_UPDATE,
payload: {
id,
@ -110,47 +110,47 @@ export const updateUserUsername = (id, data) => ({
},
});
export const updateCurrentUserUsername = (data) => ({
const updateCurrentUserUsername = (data) => ({
type: EntryActionTypes.CURRENT_USER_USERNAME_UPDATE,
payload: {
data,
},
});
export const clearUserUsernameUpdateError = (id) => ({
const clearUserUsernameUpdateError = (id) => ({
type: EntryActionTypes.USER_USERNAME_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
export const clearCurrentUserUsernameUpdateError = () => ({
const clearCurrentUserUsernameUpdateError = () => ({
type: EntryActionTypes.CURRENT_USER_USERNAME_UPDATE_ERROR_CLEAR,
payload: {},
});
export const updateCurrentUserAvatar = (data) => ({
const updateCurrentUserAvatar = (data) => ({
type: EntryActionTypes.CURRENT_USER_AVATAR_UPDATE,
payload: {
data,
},
});
export const deleteUser = (id) => ({
const deleteUser = (id) => ({
type: EntryActionTypes.USER_DELETE,
payload: {
id,
},
});
export const handleUserDelete = (user) => ({
const handleUserDelete = (user) => ({
type: EntryActionTypes.USER_DELETE_HANDLE,
payload: {
user,
},
});
export const addUserToCard = (id, cardId) => ({
const addUserToCard = (id, cardId) => ({
type: EntryActionTypes.USER_TO_CARD_ADD,
payload: {
id,
@ -158,21 +158,21 @@ export const addUserToCard = (id, cardId) => ({
},
});
export const addUserToCurrentCard = (id) => ({
const addUserToCurrentCard = (id) => ({
type: EntryActionTypes.USER_TO_CURRENT_CARD_ADD,
payload: {
id,
},
});
export const handleUserToCardAdd = (cardMembership) => ({
const handleUserToCardAdd = (cardMembership) => ({
type: EntryActionTypes.USER_TO_CARD_ADD_HANDLE,
payload: {
cardMembership,
},
});
export const removeUserFromCard = (id, cardId) => ({
const removeUserFromCard = (id, cardId) => ({
type: EntryActionTypes.USER_FROM_CARD_REMOVE,
payload: {
id,
@ -180,30 +180,63 @@ export const removeUserFromCard = (id, cardId) => ({
},
});
export const removeUserFromCurrentCard = (id) => ({
const removeUserFromCurrentCard = (id) => ({
type: EntryActionTypes.USER_FROM_CURRENT_CARD_REMOVE,
payload: {
id,
},
});
export const handleUserFromCardRemove = (cardMembership) => ({
const handleUserFromCardRemove = (cardMembership) => ({
type: EntryActionTypes.USER_FROM_CARD_REMOVE_HANDLE,
payload: {
cardMembership,
},
});
export const addUserToFilterInCurrentBoard = (id) => ({
const addUserToFilterInCurrentBoard = (id) => ({
type: EntryActionTypes.USER_TO_FILTER_IN_CURRENT_BOARD_ADD,
payload: {
id,
},
});
export const removeUserFromFilterInCurrentBoard = (id) => ({
const removeUserFromFilterInCurrentBoard = (id) => ({
type: EntryActionTypes.USER_FROM_FILTER_IN_CURRENT_BOARD_REMOVE,
payload: {
id,
},
});
export default {
createUser,
handleUserCreate,
clearUserCreateError,
updateUser,
updateCurrentUser,
handleUserUpdate,
updateCurrentUserLanguage,
updateUserEmail,
updateCurrentUserEmail,
clearUserEmailUpdateError,
clearCurrentUserEmailUpdateError,
updateUserPassword,
updateCurrentUserPassword,
clearUserPasswordUpdateError,
clearCurrentUserPasswordUpdateError,
updateUserUsername,
updateCurrentUserUsername,
clearUserUsernameUpdateError,
clearCurrentUserUsernameUpdateError,
updateCurrentUserAvatar,
deleteUser,
handleUserDelete,
addUserToCard,
addUserToCurrentCard,
handleUserToCardAdd,
removeUserFromCard,
removeUserFromCurrentCard,
handleUserFromCardRemove,
addUserToFilterInCurrentBoard,
removeUserFromFilterInCurrentBoard,
};

View file

@ -1,95 +0,0 @@
import { Model, attr, fk } from 'redux-orm';
import ActionTypes from '../constants/ActionTypes';
export default class extends Model {
static modelName = 'Action';
static fields = {
id: attr(),
type: attr(),
data: attr(),
createdAt: attr({
getDefault: () => new Date(),
}),
isInCard: attr({
getDefault: () => true,
}),
cardId: fk({
to: 'Card',
as: 'card',
relatedName: 'actions',
}),
userId: fk({
to: 'User',
as: 'user',
relatedName: 'actions',
}),
};
static reducer({ type, payload }, Action) {
switch (type) {
case ActionTypes.SOCKET_RECONNECT_HANDLE:
Action.all().delete();
payload.actions.forEach((action) => {
Action.upsert({
...action,
isInCard: false,
});
});
break;
case ActionTypes.CORE_INITIALIZE:
payload.actions.forEach((action) => {
Action.upsert({
...action,
isInCard: false,
});
});
break;
case ActionTypes.ACTIONS_FETCH__SUCCESS:
case ActionTypes.ACTIONS_DETAILS_TOGGLE__SUCCESS:
case ActionTypes.NOTIFICATION_CREATE_HANDLE:
payload.actions.forEach((action) => {
Action.upsert(action);
});
break;
case ActionTypes.ACTION_CREATE_HANDLE:
case ActionTypes.ACTION_UPDATE_HANDLE:
case ActionTypes.COMMENT_ACTION_CREATE:
case ActionTypes.COMMENT_ACTION_UPDATE__SUCCESS:
Action.upsert(payload.action);
break;
case ActionTypes.ACTION_DELETE_HANDLE:
case ActionTypes.COMMENT_ACTION_DELETE__SUCCESS: {
const actionModel = Action.withId(payload.action.id);
if (actionModel) {
actionModel.delete();
}
break;
}
case ActionTypes.COMMENT_ACTION_CREATE__SUCCESS:
Action.withId(payload.localId).delete();
Action.upsert(payload.action);
break;
case ActionTypes.COMMENT_ACTION_UPDATE:
Action.withId(payload.id).update({
data: payload.data,
});
break;
case ActionTypes.COMMENT_ACTION_DELETE:
Action.withId(payload.id).delete();
break;
default:
}
}
}

95
client/src/models/Activity.js Executable file
View file

@ -0,0 +1,95 @@
import { Model, attr, fk } from 'redux-orm';
import ActionTypes from '../constants/ActionTypes';
export default class extends Model {
static modelName = 'Activity';
static fields = {
id: attr(),
type: attr(),
data: attr(),
createdAt: attr({
getDefault: () => new Date(),
}),
isInCard: attr({
getDefault: () => true,
}),
cardId: fk({
to: 'Card',
as: 'card',
relatedName: 'activities',
}),
userId: fk({
to: 'User',
as: 'user',
relatedName: 'activities',
}),
};
static reducer({ type, payload }, Activity) {
switch (type) {
case ActionTypes.SOCKET_RECONNECT_HANDLE:
Activity.all().delete();
payload.activities.forEach((activity) => {
Activity.upsert({
...activity,
isInCard: false,
});
});
break;
case ActionTypes.CORE_INITIALIZE:
payload.activities.forEach((activity) => {
Activity.upsert({
...activity,
isInCard: false,
});
});
break;
case ActionTypes.ACTIVITIES_FETCH__SUCCESS:
case ActionTypes.ACTIVITIES_DETAILS_TOGGLE__SUCCESS:
case ActionTypes.NOTIFICATION_CREATE_HANDLE:
payload.activities.forEach((activity) => {
Activity.upsert(activity);
});
break;
case ActionTypes.ACTIVITY_CREATE_HANDLE:
case ActionTypes.ACTIVITY_UPDATE_HANDLE:
case ActionTypes.COMMENT_ACTIVITY_CREATE:
case ActionTypes.COMMENT_ACTIVITY_UPDATE__SUCCESS:
Activity.upsert(payload.activity);
break;
case ActionTypes.ACTIVITY_DELETE_HANDLE:
case ActionTypes.COMMENT_ACTIVITY_DELETE__SUCCESS: {
const activityModel = Activity.withId(payload.activity.id);
if (activityModel) {
activityModel.delete();
}
break;
}
case ActionTypes.COMMENT_ACTIVITY_CREATE__SUCCESS:
Activity.withId(payload.localId).delete();
Activity.upsert(payload.activity);
break;
case ActionTypes.COMMENT_ACTIVITY_UPDATE:
Activity.withId(payload.id).update({
data: payload.data,
});
break;
case ActionTypes.COMMENT_ACTIVITY_DELETE:
Activity.withId(payload.id).delete();
break;
default:
}
}
}

View file

@ -2,7 +2,7 @@ import { Model, attr, fk, many, oneToOne } from 'redux-orm';
import ActionTypes from '../constants/ActionTypes';
import Config from '../constants/Config';
import { ActionTypes as ActionTypesEnum } from '../constants/Enums';
import { ActivityTypes } from '../constants/Enums';
export default class extends Model {
static modelName = 'Card';
@ -17,16 +17,16 @@ export default class extends Model {
isSubscribed: attr({
getDefault: () => false,
}),
isActionsFetching: attr({
isActivitiesFetching: attr({
getDefault: () => false,
}),
isAllActionsFetched: attr({
isAllActivitiesFetched: attr({
getDefault: () => false,
}),
isActionsDetailsVisible: attr({
isActivitiesDetailsVisible: attr({
getDefault: () => false,
}),
isActionsDetailsFetching: attr({
isActivitiesDetailsFetching: attr({
getDefault: () => false,
}),
boardId: fk({
@ -189,44 +189,44 @@ export default class extends Model {
break;
}
case ActionTypes.ACTIONS_FETCH:
case ActionTypes.ACTIVITIES_FETCH:
Card.withId(payload.cardId).update({
isActionsFetching: true,
isActivitiesFetching: true,
});
break;
case ActionTypes.ACTIONS_FETCH__SUCCESS:
case ActionTypes.ACTIVITIES_FETCH__SUCCESS:
Card.withId(payload.cardId).update({
isActionsFetching: false,
isAllActionsFetched: payload.actions.length < Config.ACTIONS_LIMIT,
isActivitiesFetching: false,
isAllActivitiesFetched: payload.activities.length < Config.ACTIVITIES_LIMIT,
});
break;
case ActionTypes.ACTIONS_DETAILS_TOGGLE: {
case ActionTypes.ACTIVITIES_DETAILS_TOGGLE: {
const cardModel = Card.withId(payload.cardId);
cardModel.isActionsDetailsVisible = payload.isVisible;
cardModel.isActivitiesDetailsVisible = payload.isVisible;
if (payload.isVisible) {
cardModel.isActionsDetailsFetching = true;
cardModel.isActivitiesDetailsFetching = true;
}
break;
}
case ActionTypes.ACTIONS_DETAILS_TOGGLE__SUCCESS: {
case ActionTypes.ACTIVITIES_DETAILS_TOGGLE__SUCCESS: {
const cardModel = Card.withId(payload.cardId);
cardModel.update({
isAllActionsFetched: payload.actions.length < Config.ACTIONS_LIMIT,
isActionsDetailsFetching: false,
isAllActivitiesFetched: payload.activities.length < Config.ACTIVITIES_LIMIT,
isActivitiesDetailsFetching: false,
});
cardModel.actions.toModelArray().forEach((actionModel) => {
if (actionModel.notification) {
actionModel.update({
cardModel.activities.toModelArray().forEach((activityModel) => {
if (activityModel.notification) {
activityModel.update({
isInCard: false,
});
} else {
actionModel.delete();
activityModel.delete();
}
});
@ -250,16 +250,16 @@ export default class extends Model {
return this.attachments.orderBy('id', false);
}
getFilteredOrderedInCardActionsQuerySet() {
getFilteredOrderedInCardActivitiesQuerySet() {
const filter = {
isInCard: true,
};
if (!this.isActionsDetailsVisible) {
filter.type = ActionTypesEnum.COMMENT_CARD;
if (!this.isActivitiesDetailsVisible) {
filter.type = ActivityTypes.COMMENT_CARD;
}
return this.actions.filter(filter).orderBy('id', false);
return this.activities.filter(filter).orderBy('id', false);
}
getUnreadNotificationsQuerySet() {
@ -271,7 +271,7 @@ export default class extends Model {
deleteRelated() {
this.tasks.delete();
this.attachments.delete();
this.actions.delete();
this.activities.delete();
}
deleteWithRelated() {

View file

@ -20,9 +20,9 @@ export default class extends Model {
as: 'card',
relatedName: 'notifications',
}),
actionId: oneToOne({
to: 'Action',
as: 'action',
activityId: oneToOne({
to: 'Activity',
as: 'activity',
}),
};
@ -31,8 +31,8 @@ export default class extends Model {
case ActionTypes.LOCATION_CHANGE_HANDLE:
case ActionTypes.PROJECT_MANAGER_CREATE_HANDLE:
case ActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE:
if (payload.notifications) {
payload.notifications.forEach((notification) => {
if (payload.deletedNotifications) {
payload.deletedNotifications.forEach((notification) => {
Notification.withId(notification.id).deleteWithRelated();
});
}

Some files were not shown because too many files have changed in this diff Show more