Project managers, board members, auto-update after reconnection, refactoring
parent
d6cb1f6683
commit
b39119ace4
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,97 @@
|
|||||||
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
|
|
||||||
|
export const createBoardMembership = (boardMembership) => ({
|
||||||
|
type: ActionTypes.BOARD_MEMBERSHIP_CREATE,
|
||||||
|
payload: {
|
||||||
|
boardMembership,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
createBoardMembership.success = (localId, boardMembership) => ({
|
||||||
|
type: ActionTypes.BOARD_MEMBERSHIP_CREATE__SUCCESS,
|
||||||
|
payload: {
|
||||||
|
localId,
|
||||||
|
boardMembership,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
createBoardMembership.failure = (localId, error) => ({
|
||||||
|
type: ActionTypes.BOARD_MEMBERSHIP_CREATE__FAILURE,
|
||||||
|
payload: {
|
||||||
|
localId,
|
||||||
|
error,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const handleBoardMembershipCreate = (
|
||||||
|
boardMembership,
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
users,
|
||||||
|
projectManagers,
|
||||||
|
boards,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
) => ({
|
||||||
|
type: ActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE,
|
||||||
|
payload: {
|
||||||
|
boardMembership,
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
users,
|
||||||
|
projectManagers,
|
||||||
|
boards,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
handleBoardMembershipCreate.fetchProject = (id, currentUserId, currentBoardId) => ({
|
||||||
|
type: ActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE__PROJECT_FETCH,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
currentUserId,
|
||||||
|
currentBoardId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const deleteBoardMembership = (id) => ({
|
||||||
|
type: ActionTypes.BOARD_MEMBERSHIP_DELETE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteBoardMembership.success = (boardMembership) => ({
|
||||||
|
type: ActionTypes.BOARD_MEMBERSHIP_DELETE__SUCCESS,
|
||||||
|
payload: {
|
||||||
|
boardMembership,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteBoardMembership.failure = (id, error) => ({
|
||||||
|
type: ActionTypes.BOARD_MEMBERSHIP_DELETE__FAILURE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
error,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const handleBoardMembershipDelete = (boardMembership) => ({
|
||||||
|
type: ActionTypes.BOARD_MEMBERSHIP_DELETE_HANDLE,
|
||||||
|
payload: {
|
||||||
|
boardMembership,
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -1,62 +0,0 @@
|
|||||||
import ActionTypes from '../constants/ActionTypes';
|
|
||||||
|
|
||||||
/* Events */
|
|
||||||
|
|
||||||
export const createCardLabelRequested = (data) => ({
|
|
||||||
type: ActionTypes.CARD_LABEL_CREATE_REQUESTED,
|
|
||||||
payload: {
|
|
||||||
data,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const createCardLabelSucceeded = (cardLabel) => ({
|
|
||||||
type: ActionTypes.CARD_LABEL_CREATE_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
cardLabel,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const createCardLabelFailed = (error) => ({
|
|
||||||
type: ActionTypes.CARD_LABEL_CREATE_FAILED,
|
|
||||||
payload: {
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const createCardLabelReceived = (cardLabel) => ({
|
|
||||||
type: ActionTypes.CARD_LABEL_CREATE_RECEIVED,
|
|
||||||
payload: {
|
|
||||||
cardLabel,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteCardLabelRequested = (cardId, labelId) => ({
|
|
||||||
type: ActionTypes.CARD_LABEL_DELETE_REQUESTED,
|
|
||||||
payload: {
|
|
||||||
cardId,
|
|
||||||
labelId,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteCardLabelSucceeded = (cardLabel) => ({
|
|
||||||
type: ActionTypes.CARD_LABEL_DELETE_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
cardLabel,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteCardLabelFailed = (cardId, labelId, error) => ({
|
|
||||||
type: ActionTypes.CARD_LABEL_DELETE_FAILED,
|
|
||||||
payload: {
|
|
||||||
cardId,
|
|
||||||
labelId,
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteCardLabelReceived = (cardLabel) => ({
|
|
||||||
type: ActionTypes.CARD_LABEL_DELETE_RECEIVED,
|
|
||||||
payload: {
|
|
||||||
cardLabel,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
import ActionTypes from '../constants/ActionTypes';
|
|
||||||
|
|
||||||
/* Events */
|
|
||||||
|
|
||||||
export const createCardMembershipRequested = (data) => ({
|
|
||||||
type: ActionTypes.CARD_MEMBERSHIP_CREATE_REQUESTED,
|
|
||||||
payload: {
|
|
||||||
data,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const createCardMembershipSucceeded = (cardMembership) => ({
|
|
||||||
type: ActionTypes.CARD_MEMBERSHIP_CREATE_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
cardMembership,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const createCardMembershipFailed = (error) => ({
|
|
||||||
type: ActionTypes.CARD_MEMBERSHIP_CREATE_FAILED,
|
|
||||||
payload: {
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const createCardMembershipReceived = (cardMembership) => ({
|
|
||||||
type: ActionTypes.CARD_MEMBERSHIP_CREATE_RECEIVED,
|
|
||||||
payload: {
|
|
||||||
cardMembership,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteCardMembershipRequested = (cardId, userId) => ({
|
|
||||||
type: ActionTypes.CARD_MEMBERSHIP_DELETE_REQUESTED,
|
|
||||||
payload: {
|
|
||||||
cardId,
|
|
||||||
userId,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteCardMembershipSucceeded = (cardMembership) => ({
|
|
||||||
type: ActionTypes.CARD_MEMBERSHIP_DELETE_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
cardMembership,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteCardMembershipFailed = (cardId, userId, error) => ({
|
|
||||||
type: ActionTypes.CARD_MEMBERSHIP_DELETE_FAILED,
|
|
||||||
payload: {
|
|
||||||
cardId,
|
|
||||||
userId,
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteCardMembershipReceived = (cardMembership) => ({
|
|
||||||
type: ActionTypes.CARD_MEMBERSHIP_DELETE_RECEIVED,
|
|
||||||
payload: {
|
|
||||||
cardMembership,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -1,9 +1,41 @@
|
|||||||
import ActionTypes from '../constants/ActionTypes';
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
|
|
||||||
/* Events */
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
// eslint-disable-next-line import/prefer-default-export
|
||||||
export const coreInitialized = () => ({
|
export const initializeCore = (
|
||||||
type: ActionTypes.CORE_INITIALIZED,
|
user,
|
||||||
payload: {},
|
board,
|
||||||
|
users,
|
||||||
|
projects,
|
||||||
|
projectManagers,
|
||||||
|
boards,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
actions,
|
||||||
|
notifications,
|
||||||
|
) => ({
|
||||||
|
type: ActionTypes.CORE_INITIALIZE,
|
||||||
|
payload: {
|
||||||
|
user,
|
||||||
|
board,
|
||||||
|
users,
|
||||||
|
projects,
|
||||||
|
projectManagers,
|
||||||
|
boards,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
actions,
|
||||||
|
notifications,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
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,
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
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,
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import EntryActionTypes from '../../constants/EntryActionTypes';
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/prefer-default-export
|
||||||
|
export const initializeCore = () => ({
|
||||||
|
type: EntryActionTypes.CORE_INITIALIZE,
|
||||||
|
payload: {},
|
||||||
|
});
|
||||||
@ -1,14 +1,18 @@
|
|||||||
|
export * from './socket';
|
||||||
export * from './login';
|
export * from './login';
|
||||||
|
export * from './core';
|
||||||
export * from './modal';
|
export * from './modal';
|
||||||
export * from './user';
|
export * from './user';
|
||||||
export * from './project';
|
export * from './project';
|
||||||
export * from './project-membership';
|
export * from './project-manager';
|
||||||
export * from './board';
|
export * from './board';
|
||||||
|
export * from './board-membership';
|
||||||
export * from './label';
|
export * from './label';
|
||||||
export * from './list';
|
export * from './list';
|
||||||
export * from './card';
|
export * from './card';
|
||||||
export * from './task';
|
export * from './task';
|
||||||
export * from './attachment';
|
export * from './attachment';
|
||||||
export * from './actions';
|
export * from './actions';
|
||||||
|
export * from './action';
|
||||||
export * from './comment-action';
|
export * from './comment-action';
|
||||||
export * from './notification';
|
export * from './notification';
|
||||||
|
|||||||
@ -1,9 +1,22 @@
|
|||||||
import EntryActionTypes from '../../constants/EntryActionTypes';
|
import EntryActionTypes from '../../constants/EntryActionTypes';
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
export const handleNotificationCreate = (notification) => ({
|
||||||
|
type: EntryActionTypes.NOTIFICATION_CREATE_HANDLE,
|
||||||
|
payload: {
|
||||||
|
notification,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const deleteNotification = (id) => ({
|
export const deleteNotification = (id) => ({
|
||||||
type: EntryActionTypes.NOTIFICATION_DELETE,
|
type: EntryActionTypes.NOTIFICATION_DELETE,
|
||||||
payload: {
|
payload: {
|
||||||
id,
|
id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const handleNotificationDelete = (notification) => ({
|
||||||
|
type: EntryActionTypes.NOTIFICATION_DELETE_HANDLE,
|
||||||
|
payload: {
|
||||||
|
notification,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
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,
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -1,15 +0,0 @@
|
|||||||
import EntryActionTypes from '../../constants/EntryActionTypes';
|
|
||||||
|
|
||||||
export const createMembershipInCurrentProject = (data) => ({
|
|
||||||
type: EntryActionTypes.MEMBERSHIP_IN_CURRENT_PROJECT_CREATE,
|
|
||||||
payload: {
|
|
||||||
data,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteProjectMembership = (id) => ({
|
|
||||||
type: EntryActionTypes.PROJECT_MEMBERSHIP_DELETE,
|
|
||||||
payload: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
import EntryActionTypes from '../../constants/EntryActionTypes';
|
||||||
|
|
||||||
|
export const handleSocketDisconnect = () => ({
|
||||||
|
type: EntryActionTypes.SOCKET_DISCONNECT_HANDLE,
|
||||||
|
payload: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const handleSocketReconnect = () => ({
|
||||||
|
type: EntryActionTypes.SOCKET_RECONNECT_HANDLE,
|
||||||
|
payload: {},
|
||||||
|
});
|
||||||
@ -1,22 +1,19 @@
|
|||||||
|
export * from './router';
|
||||||
export * from './socket';
|
export * from './socket';
|
||||||
export * from './login';
|
export * from './login';
|
||||||
export * from './core';
|
export * from './core';
|
||||||
export * from './modal';
|
export * from './modal';
|
||||||
export * from './users';
|
|
||||||
export * from './user';
|
export * from './user';
|
||||||
export * from './projects';
|
|
||||||
export * from './project';
|
export * from './project';
|
||||||
export * from './project-membership';
|
export * from './project-manager';
|
||||||
export * from './board';
|
export * from './board';
|
||||||
|
export * from './board-membership';
|
||||||
export * from './label';
|
export * from './label';
|
||||||
export * from './list';
|
export * from './list';
|
||||||
export * from './card';
|
export * from './card';
|
||||||
export * from './card-membership';
|
|
||||||
export * from './card-label';
|
|
||||||
export * from './task';
|
export * from './task';
|
||||||
export * from './attachment';
|
export * from './attachment';
|
||||||
export * from './actions';
|
export * from './actions';
|
||||||
export * from './action';
|
export * from './action';
|
||||||
export * from './comment-action';
|
export * from './comment-action';
|
||||||
export * from './notifications';
|
|
||||||
export * from './notification';
|
export * from './notification';
|
||||||
|
|||||||
@ -1,56 +0,0 @@
|
|||||||
import ActionTypes from '../constants/ActionTypes';
|
|
||||||
|
|
||||||
/* Actions */
|
|
||||||
|
|
||||||
export const deleteNotifications = (ids) => ({
|
|
||||||
type: ActionTypes.NOTIFICATIONS_DELETE,
|
|
||||||
payload: {
|
|
||||||
ids,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Events */
|
|
||||||
|
|
||||||
export const fetchNotificationsRequested = () => ({
|
|
||||||
type: ActionTypes.NOTIFICATIONS_FETCH_REQUESTED,
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const fetchNotificationsSucceeded = (notifications, users, cards, actions) => ({
|
|
||||||
type: ActionTypes.NOTIFICATIONS_FETCH_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
notifications,
|
|
||||||
users,
|
|
||||||
cards,
|
|
||||||
actions,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const fetchNotificationsFailed = (error) => ({
|
|
||||||
type: ActionTypes.NOTIFICATIONS_FETCH_FAILED,
|
|
||||||
payload: {
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteNotificationsRequested = (ids) => ({
|
|
||||||
type: ActionTypes.NOTIFICATIONS_DELETE_REQUESTED,
|
|
||||||
payload: {
|
|
||||||
ids,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteNotificationsSucceeded = (notifications) => ({
|
|
||||||
type: ActionTypes.NOTIFICATIONS_DELETE_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
notifications,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteNotificationsFailed = (ids, error) => ({
|
|
||||||
type: ActionTypes.NOTIFICATIONS_DELETE_FAILED,
|
|
||||||
payload: {
|
|
||||||
ids,
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
|
|
||||||
|
export const createProjectManager = (projectManager) => ({
|
||||||
|
type: ActionTypes.PROJECT_MANAGER_CREATE,
|
||||||
|
payload: {
|
||||||
|
projectManager,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
createProjectManager.success = (localId, projectManager) => ({
|
||||||
|
type: ActionTypes.PROJECT_MANAGER_CREATE__SUCCESS,
|
||||||
|
payload: {
|
||||||
|
localId,
|
||||||
|
projectManager,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
createProjectManager.failure = (localId, error) => ({
|
||||||
|
type: ActionTypes.PROJECT_MANAGER_CREATE__FAILURE,
|
||||||
|
payload: {
|
||||||
|
localId,
|
||||||
|
error,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const handleProjectManagerCreate = (
|
||||||
|
projectManager,
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
users,
|
||||||
|
projectManagers,
|
||||||
|
boards,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
) => ({
|
||||||
|
type: ActionTypes.PROJECT_MANAGER_CREATE_HANDLE,
|
||||||
|
payload: {
|
||||||
|
projectManager,
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
users,
|
||||||
|
projectManagers,
|
||||||
|
boards,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
handleProjectManagerCreate.fetchProject = (id, currentUserId, currentBoardId) => ({
|
||||||
|
type: ActionTypes.PROJECT_MANAGER_CREATE_HANDLE__PROJECT_FETCH,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
currentUserId,
|
||||||
|
currentBoardId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const deleteProjectManager = (id, isCurrentUser, isCurrentProject) => ({
|
||||||
|
type: ActionTypes.PROJECT_MANAGER_DELETE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
isCurrentUser,
|
||||||
|
isCurrentProject,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteProjectManager.success = (projectManager) => ({
|
||||||
|
type: ActionTypes.PROJECT_MANAGER_DELETE__SUCCESS,
|
||||||
|
payload: {
|
||||||
|
projectManager,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteProjectManager.failure = (id, error) => ({
|
||||||
|
type: ActionTypes.PROJECT_MANAGER_DELETE__FAILURE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
error,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const handleProjectManagerDelete = (projectManager, isCurrentUser, isCurrentProject) => ({
|
||||||
|
type: ActionTypes.PROJECT_MANAGER_DELETE_HANDLE,
|
||||||
|
payload: {
|
||||||
|
projectManager,
|
||||||
|
isCurrentUser,
|
||||||
|
isCurrentProject,
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -1,80 +0,0 @@
|
|||||||
import ActionTypes from '../constants/ActionTypes';
|
|
||||||
|
|
||||||
/* Actions */
|
|
||||||
|
|
||||||
export const createProjectMembership = (projectMembership) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_CREATE,
|
|
||||||
payload: {
|
|
||||||
projectMembership,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteProjectMembership = (id) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_DELETE,
|
|
||||||
payload: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Events */
|
|
||||||
|
|
||||||
export const createProjectMembershipRequested = (localId, data) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_CREATE_REQUESTED,
|
|
||||||
payload: {
|
|
||||||
localId,
|
|
||||||
data,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const createProjectMembershipSucceeded = (localId, projectMembership) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_CREATE_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
localId,
|
|
||||||
projectMembership,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const createProjectMembershipFailed = (localId, error) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_CREATE_FAILED,
|
|
||||||
payload: {
|
|
||||||
localId,
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const createProjectMembershipReceived = (projectMembership, user) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_CREATE_RECEIVED,
|
|
||||||
payload: {
|
|
||||||
projectMembership,
|
|
||||||
user,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteProjectMembershipRequested = (id) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_DELETE_REQUESTED,
|
|
||||||
payload: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteProjectMembershipSucceeded = (projectMembership) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_DELETE_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
projectMembership,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteProjectMembershipFailed = (id, error) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_DELETE_FAILED,
|
|
||||||
payload: {
|
|
||||||
id,
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const deleteProjectMembershipReceived = (projectMembership) => ({
|
|
||||||
type: ActionTypes.PROJECT_MEMBERSHIP_DELETE_RECEIVED,
|
|
||||||
payload: {
|
|
||||||
projectMembership,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
import ActionTypes from '../constants/ActionTypes';
|
|
||||||
|
|
||||||
/* Events */
|
|
||||||
|
|
||||||
export const fetchProjectsRequested = () => ({
|
|
||||||
type: ActionTypes.PROJECTS_FETCH_REQUESTED,
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const fetchProjectsSucceeded = (projects, users, projectMemberships, boards) => ({
|
|
||||||
type: ActionTypes.PROJECTS_FETCH_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
projects,
|
|
||||||
users,
|
|
||||||
projectMemberships,
|
|
||||||
boards,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const fetchProjectsFailed = (error) => ({
|
|
||||||
type: ActionTypes.PROJECTS_FETCH_FAILED,
|
|
||||||
payload: {
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/prefer-default-export
|
||||||
|
export const handleLocationChange = (
|
||||||
|
board,
|
||||||
|
users,
|
||||||
|
projects,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
notifications,
|
||||||
|
) => ({
|
||||||
|
type: ActionTypes.LOCATION_CHANGE_HANDLE,
|
||||||
|
payload: {
|
||||||
|
board,
|
||||||
|
users,
|
||||||
|
projects,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
notifications,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
handleLocationChange.fetchBoard = (id) => ({
|
||||||
|
type: ActionTypes.LOCATION_CHANGE_HANDLE__BOARD_FETCH,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -1,18 +1,53 @@
|
|||||||
import ActionTypes from '../constants/ActionTypes';
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
import SocketStatuses from '../constants/SocketStatuses';
|
|
||||||
|
|
||||||
/* Events */
|
export const handleSocketDisconnect = () => ({
|
||||||
|
type: ActionTypes.SOCKET_DISCONNECT_HANDLE,
|
||||||
|
payload: {},
|
||||||
|
});
|
||||||
|
|
||||||
export const socketDisconnected = () => ({
|
export const handleSocketReconnect = (
|
||||||
type: ActionTypes.SOCKET_STATUS_CHANGED,
|
user,
|
||||||
|
board,
|
||||||
|
users,
|
||||||
|
projects,
|
||||||
|
projectManagers,
|
||||||
|
boards,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
actions,
|
||||||
|
notifications,
|
||||||
|
) => ({
|
||||||
|
type: ActionTypes.SOCKET_RECONNECT_HANDLE,
|
||||||
payload: {
|
payload: {
|
||||||
status: SocketStatuses.DISCONNECTED,
|
user,
|
||||||
|
board,
|
||||||
|
users,
|
||||||
|
projects,
|
||||||
|
projectManagers,
|
||||||
|
boards,
|
||||||
|
boardMemberships,
|
||||||
|
labels,
|
||||||
|
lists,
|
||||||
|
cards,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
|
actions,
|
||||||
|
notifications,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const socketReconnected = () => ({
|
handleSocketReconnect.fetchCore = (currentUserId, currentBoardId) => ({
|
||||||
type: ActionTypes.SOCKET_STATUS_CHANGED,
|
type: ActionTypes.SOCKET_RECONNECT_HANDLE__CORE_FETCH,
|
||||||
payload: {
|
payload: {
|
||||||
status: SocketStatuses.RECONNECTED,
|
currentUserId,
|
||||||
|
currentBoardId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
import ActionTypes from '../constants/ActionTypes';
|
|
||||||
|
|
||||||
/* Events */
|
|
||||||
|
|
||||||
export const fetchUsersRequested = () => ({
|
|
||||||
type: ActionTypes.USERS_FETCH_REQUESTED,
|
|
||||||
payload: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const fetchUsersSucceeded = (users) => ({
|
|
||||||
type: ActionTypes.USERS_FETCH_SUCCEEDED,
|
|
||||||
payload: {
|
|
||||||
users,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const fetchUsersFailed = (error) => ({
|
|
||||||
type: ActionTypes.USERS_FETCH_FAILED,
|
|
||||||
payload: {
|
|
||||||
error,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
import socket from './socket';
|
||||||
|
|
||||||
|
/* Actions */
|
||||||
|
|
||||||
|
const createBoardMembership = (boardId, data, headers) =>
|
||||||
|
socket.post(`/boards/${boardId}/memberships`, data, headers);
|
||||||
|
|
||||||
|
const deleteBoardMembership = (id, headers) =>
|
||||||
|
socket.delete(`/board-memberships/${id}`, undefined, headers);
|
||||||
|
|
||||||
|
export default {
|
||||||
|
createBoardMembership,
|
||||||
|
deleteBoardMembership,
|
||||||
|
};
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
import socket from './socket';
|
||||||
|
|
||||||
|
/* Actions */
|
||||||
|
|
||||||
|
const createProjectManager = (projectId, data, headers) =>
|
||||||
|
socket.post(`/projects/${projectId}/managers`, data, headers);
|
||||||
|
|
||||||
|
const deleteProjectManager = (id, headers) =>
|
||||||
|
socket.delete(`/project-managers/${id}`, undefined, headers);
|
||||||
|
|
||||||
|
export default {
|
||||||
|
createProjectManager,
|
||||||
|
deleteProjectManager,
|
||||||
|
};
|
||||||
@ -1,14 +0,0 @@
|
|||||||
import socket from './socket';
|
|
||||||
|
|
||||||
/* Actions */
|
|
||||||
|
|
||||||
const createProjectMembership = (projectId, data, headers) =>
|
|
||||||
socket.post(`/projects/${projectId}/memberships`, data, headers);
|
|
||||||
|
|
||||||
const deleteProjectMembership = (id, headers) =>
|
|
||||||
socket.delete(`/project-memberships/${id}`, undefined, headers);
|
|
||||||
|
|
||||||
export default {
|
|
||||||
createProjectMembership,
|
|
||||||
deleteProjectMembership,
|
|
||||||
};
|
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
import Filters from './Filters';
|
||||||
|
import Memberships from '../Memberships';
|
||||||
|
|
||||||
|
import styles from './BoardActions.module.scss';
|
||||||
|
|
||||||
|
const BoardActions = React.memo(
|
||||||
|
({
|
||||||
|
memberships,
|
||||||
|
labels,
|
||||||
|
filterUsers,
|
||||||
|
filterLabels,
|
||||||
|
allUsers,
|
||||||
|
canEditMemberships,
|
||||||
|
onMembershipCreate,
|
||||||
|
onMembershipDelete,
|
||||||
|
onUserToFilterAdd,
|
||||||
|
onUserFromFilterRemove,
|
||||||
|
onLabelToFilterAdd,
|
||||||
|
onLabelFromFilterRemove,
|
||||||
|
onLabelCreate,
|
||||||
|
onLabelUpdate,
|
||||||
|
onLabelDelete,
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<div className={styles.actions}>
|
||||||
|
<div className={styles.action}>
|
||||||
|
<Memberships
|
||||||
|
items={memberships}
|
||||||
|
allUsers={allUsers}
|
||||||
|
canEdit={canEditMemberships}
|
||||||
|
onCreate={onMembershipCreate}
|
||||||
|
onDelete={onMembershipDelete}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className={styles.action}>
|
||||||
|
<Filters
|
||||||
|
users={filterUsers}
|
||||||
|
labels={filterLabels}
|
||||||
|
allBoardMemberships={memberships}
|
||||||
|
allLabels={labels}
|
||||||
|
onUserAdd={onUserToFilterAdd}
|
||||||
|
onUserRemove={onUserFromFilterRemove}
|
||||||
|
onLabelAdd={onLabelToFilterAdd}
|
||||||
|
onLabelRemove={onLabelFromFilterRemove}
|
||||||
|
onLabelCreate={onLabelCreate}
|
||||||
|
onLabelUpdate={onLabelUpdate}
|
||||||
|
onLabelDelete={onLabelDelete}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
BoardActions.propTypes = {
|
||||||
|
/* eslint-disable react/forbid-prop-types */
|
||||||
|
memberships: PropTypes.array.isRequired,
|
||||||
|
labels: PropTypes.array.isRequired,
|
||||||
|
filterUsers: PropTypes.array.isRequired,
|
||||||
|
filterLabels: PropTypes.array.isRequired,
|
||||||
|
allUsers: PropTypes.array.isRequired,
|
||||||
|
/* eslint-enable react/forbid-prop-types */
|
||||||
|
canEditMemberships: PropTypes.bool.isRequired,
|
||||||
|
onMembershipCreate: PropTypes.func.isRequired,
|
||||||
|
onMembershipDelete: PropTypes.func.isRequired,
|
||||||
|
onUserToFilterAdd: PropTypes.func.isRequired,
|
||||||
|
onUserFromFilterRemove: PropTypes.func.isRequired,
|
||||||
|
onLabelToFilterAdd: PropTypes.func.isRequired,
|
||||||
|
onLabelFromFilterRemove: PropTypes.func.isRequired,
|
||||||
|
onLabelCreate: PropTypes.func.isRequired,
|
||||||
|
onLabelUpdate: PropTypes.func.isRequired,
|
||||||
|
onLabelDelete: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BoardActions;
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
:global(#app) {
|
||||||
|
.action {
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
margin: 20px 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
import BoardActions from './BoardActions';
|
||||||
|
|
||||||
|
export default BoardActions;
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
import { withPopup } from '../lib/popup';
|
||||||
|
|
||||||
|
import BoardMembershipsStep from './BoardMembershipsStep';
|
||||||
|
|
||||||
|
export default withPopup(BoardMembershipsStep);
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
import BoardMembershipsStep from './BoardMembershipsStep';
|
||||||
|
|
||||||
|
export default BoardMembershipsStep;
|
||||||
@ -1,19 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { Loader } from 'semantic-ui-react';
|
|
||||||
|
|
||||||
import CoreContainer from '../containers/CoreContainer';
|
|
||||||
import SocketStatusContainer from '../containers/SocketStatusContainer';
|
|
||||||
|
|
||||||
const CoreWrapper = React.memo(({ isInitializing }) => (
|
|
||||||
<>
|
|
||||||
{isInitializing ? <Loader active size="massive" /> : <CoreContainer />}
|
|
||||||
<SocketStatusContainer />
|
|
||||||
</>
|
|
||||||
));
|
|
||||||
|
|
||||||
CoreWrapper.propTypes = {
|
|
||||||
isInitializing: PropTypes.bool.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CoreWrapper;
|
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { useTranslation, Trans } from 'react-i18next';
|
||||||
|
import { Loader } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
import CoreContainer from '../../containers/CoreContainer';
|
||||||
|
|
||||||
|
import styles from './CoreWrapper.module.scss';
|
||||||
|
|
||||||
|
const CoreWrapper = React.memo(({ isInitializing, isSocketDisconnected }) => {
|
||||||
|
const [t] = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{isInitializing ? <Loader active size="massive" /> : <CoreContainer />}
|
||||||
|
{isSocketDisconnected && (
|
||||||
|
<div className={styles.message}>
|
||||||
|
<div className={styles.messageHeader}>{t('common.noConnectionToServer')}</div>
|
||||||
|
<div className={styles.messageContent}>
|
||||||
|
<Trans i18nKey="common.allChangesWillBeAutomaticallySavedAfterConnectionRestored">
|
||||||
|
All changes will be automatically saved
|
||||||
|
<br />
|
||||||
|
after connection restored
|
||||||
|
</Trans>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
CoreWrapper.propTypes = {
|
||||||
|
isInitializing: PropTypes.bool.isRequired,
|
||||||
|
isSocketDisconnected: PropTypes.bool.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CoreWrapper;
|
||||||
@ -1,37 +1,27 @@
|
|||||||
:global(#app) {
|
:global(#app) {
|
||||||
.button {
|
.message {
|
||||||
background: none;
|
background: #eb5a46;
|
||||||
border: none;
|
border-radius: 4px;
|
||||||
color: #fff;
|
bottom: 20px;
|
||||||
cursor: pointer;
|
box-shadow: #b04632 0 1px 0;
|
||||||
outline: none;
|
padding: 12px 18px;
|
||||||
padding: 0;
|
position: fixed;
|
||||||
text-decoration: underline;
|
right: 20px;
|
||||||
|
width: 390px;
|
||||||
|
z-index: 10001;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.messageContent {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.messageHeader {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
background: #eb5a46;
|
|
||||||
border-radius: 4px;
|
|
||||||
bottom: 20px;
|
|
||||||
box-shadow: #b04632 0 1px 0;
|
|
||||||
padding: 12px 18px;
|
|
||||||
position: fixed;
|
|
||||||
right: 20px;
|
|
||||||
width: 390px;
|
|
||||||
z-index: 10001;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
import CoreWrapper from './CoreWrapper';
|
||||||
|
|
||||||
|
export default CoreWrapper;
|
||||||
@ -0,0 +1,110 @@
|
|||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { Button } from 'semantic-ui-react';
|
||||||
|
import { withPopup } from '../../lib/popup';
|
||||||
|
|
||||||
|
import { useSteps } from '../../hooks';
|
||||||
|
import User from '../User';
|
||||||
|
import DeleteStep from '../DeleteStep';
|
||||||
|
|
||||||
|
import styles from './ActionsPopup.module.scss';
|
||||||
|
|
||||||
|
const StepTypes = {
|
||||||
|
DELETE: 'DELETE',
|
||||||
|
};
|
||||||
|
|
||||||
|
const ActionsStep = React.memo(
|
||||||
|
({
|
||||||
|
user,
|
||||||
|
leaveButtonContent,
|
||||||
|
leaveConfirmationTitle,
|
||||||
|
leaveConfirmationContent,
|
||||||
|
leaveConfirmationButtonContent,
|
||||||
|
deleteButtonContent,
|
||||||
|
deleteConfirmationTitle,
|
||||||
|
deleteConfirmationContent,
|
||||||
|
deleteConfirmationButtonContent,
|
||||||
|
canLeave,
|
||||||
|
canDelete,
|
||||||
|
onDelete,
|
||||||
|
}) => {
|
||||||
|
const [t] = useTranslation();
|
||||||
|
const [step, openStep, handleBack] = useSteps();
|
||||||
|
|
||||||
|
const handleDeleteClick = useCallback(() => {
|
||||||
|
openStep(StepTypes.DELETE);
|
||||||
|
}, [openStep]);
|
||||||
|
|
||||||
|
if (step && step.type === StepTypes.DELETE) {
|
||||||
|
return (
|
||||||
|
<DeleteStep
|
||||||
|
title={t(user.isCurrent ? leaveConfirmationTitle : deleteConfirmationTitle, {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
content={t(user.isCurrent ? leaveConfirmationContent : deleteConfirmationContent)}
|
||||||
|
buttonContent={t(
|
||||||
|
user.isCurrent ? leaveConfirmationButtonContent : deleteConfirmationButtonContent,
|
||||||
|
)}
|
||||||
|
onConfirm={onDelete}
|
||||||
|
onBack={handleBack}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<span className={styles.user}>
|
||||||
|
<User name={user.name} avatarUrl={user.avatarUrl} size="large" />
|
||||||
|
</span>
|
||||||
|
<span className={styles.content}>
|
||||||
|
<div className={styles.name}>{user.name}</div>
|
||||||
|
<div className={styles.email}>{user.email}</div>
|
||||||
|
{user.isCurrent
|
||||||
|
? canLeave && (
|
||||||
|
<Button
|
||||||
|
content={t(leaveButtonContent)}
|
||||||
|
className={styles.deleteButton}
|
||||||
|
onClick={handleDeleteClick}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
: canDelete && (
|
||||||
|
<Button
|
||||||
|
content={t(deleteButtonContent)}
|
||||||
|
className={styles.deleteButton}
|
||||||
|
onClick={handleDeleteClick}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
ActionsStep.propTypes = {
|
||||||
|
user: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
|
leaveButtonContent: PropTypes.string,
|
||||||
|
leaveConfirmationTitle: PropTypes.string,
|
||||||
|
leaveConfirmationContent: PropTypes.string,
|
||||||
|
leaveConfirmationButtonContent: PropTypes.string,
|
||||||
|
deleteButtonContent: PropTypes.string,
|
||||||
|
deleteConfirmationTitle: PropTypes.string,
|
||||||
|
deleteConfirmationContent: PropTypes.string,
|
||||||
|
deleteConfirmationButtonContent: PropTypes.string,
|
||||||
|
canLeave: PropTypes.bool.isRequired,
|
||||||
|
canDelete: PropTypes.bool.isRequired,
|
||||||
|
onDelete: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
ActionsStep.defaultProps = {
|
||||||
|
leaveButtonContent: 'action.leaveBoard',
|
||||||
|
leaveConfirmationTitle: 'common.leaveBoard',
|
||||||
|
leaveConfirmationContent: 'common.areYouSureYouWantToLeaveBoard',
|
||||||
|
leaveConfirmationButtonContent: 'action.leaveBoard',
|
||||||
|
deleteButtonContent: 'action.removeFromBoard',
|
||||||
|
deleteConfirmationTitle: 'common.removeMember',
|
||||||
|
deleteConfirmationContent: 'common.areYouSureYouWantToRemoveThisMemberFromBoard',
|
||||||
|
deleteConfirmationButtonContent: 'action.removeMember',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default withPopup(ActionsStep);
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
import AddPopup from './AddPopup';
|
||||||
|
|
||||||
|
export default AddPopup;
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { Button } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
import AddPopup from './AddPopup';
|
||||||
|
import ActionsPopup from './ActionsPopup';
|
||||||
|
import User from '../User';
|
||||||
|
|
||||||
|
import styles from './Memberships.module.scss';
|
||||||
|
|
||||||
|
const Memberships = React.memo(
|
||||||
|
({
|
||||||
|
items,
|
||||||
|
allUsers,
|
||||||
|
addTitle,
|
||||||
|
leaveButtonContent,
|
||||||
|
leaveConfirmationTitle,
|
||||||
|
leaveConfirmationContent,
|
||||||
|
leaveConfirmationButtonContent,
|
||||||
|
deleteButtonContent,
|
||||||
|
deleteConfirmationTitle,
|
||||||
|
deleteConfirmationContent,
|
||||||
|
deleteConfirmationButtonContent,
|
||||||
|
canEdit,
|
||||||
|
canLeaveIfLast,
|
||||||
|
onCreate,
|
||||||
|
onDelete,
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<span className={styles.users}>
|
||||||
|
{items.map((item) => (
|
||||||
|
<span key={item.id} className={styles.user}>
|
||||||
|
<ActionsPopup
|
||||||
|
user={item.user}
|
||||||
|
leaveButtonContent={leaveButtonContent}
|
||||||
|
leaveConfirmationTitle={leaveConfirmationTitle}
|
||||||
|
leaveConfirmationContent={leaveConfirmationContent}
|
||||||
|
leaveConfirmationButtonContent={leaveConfirmationButtonContent}
|
||||||
|
deleteButtonContent={deleteButtonContent}
|
||||||
|
deleteConfirmationTitle={deleteConfirmationTitle}
|
||||||
|
deleteConfirmationContent={deleteConfirmationContent}
|
||||||
|
deleteConfirmationButtonContent={deleteConfirmationButtonContent}
|
||||||
|
canLeave={items.length > 1 || canLeaveIfLast}
|
||||||
|
canDelete={canEdit}
|
||||||
|
onDelete={() => onDelete(item.id)}
|
||||||
|
>
|
||||||
|
<User
|
||||||
|
name={item.user.name}
|
||||||
|
avatarUrl={item.user.avatarUrl}
|
||||||
|
size="large"
|
||||||
|
isDisabled={!item.isPersisted}
|
||||||
|
/>
|
||||||
|
</ActionsPopup>
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</span>
|
||||||
|
{canEdit && (
|
||||||
|
<AddPopup
|
||||||
|
users={allUsers}
|
||||||
|
currentUserIds={items.map((item) => item.user.id)}
|
||||||
|
title={addTitle}
|
||||||
|
onCreate={onCreate}
|
||||||
|
>
|
||||||
|
<Button icon="add user" className={styles.addUser} />
|
||||||
|
</AddPopup>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
Memberships.propTypes = {
|
||||||
|
/* eslint-disable react/forbid-prop-types */
|
||||||
|
items: PropTypes.array.isRequired,
|
||||||
|
allUsers: PropTypes.array.isRequired,
|
||||||
|
/* eslint-enable react/forbid-prop-types */
|
||||||
|
addTitle: PropTypes.string,
|
||||||
|
leaveButtonContent: PropTypes.string,
|
||||||
|
leaveConfirmationTitle: PropTypes.string,
|
||||||
|
leaveConfirmationContent: PropTypes.string,
|
||||||
|
leaveConfirmationButtonContent: PropTypes.string,
|
||||||
|
deleteButtonContent: PropTypes.string,
|
||||||
|
deleteConfirmationTitle: PropTypes.string,
|
||||||
|
deleteConfirmationContent: PropTypes.string,
|
||||||
|
deleteConfirmationButtonContent: PropTypes.string,
|
||||||
|
canEdit: PropTypes.bool,
|
||||||
|
canLeaveIfLast: PropTypes.bool,
|
||||||
|
onCreate: PropTypes.func.isRequired,
|
||||||
|
onDelete: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
Memberships.defaultProps = {
|
||||||
|
addTitle: undefined,
|
||||||
|
leaveButtonContent: undefined,
|
||||||
|
leaveConfirmationTitle: undefined,
|
||||||
|
leaveConfirmationContent: undefined,
|
||||||
|
leaveConfirmationButtonContent: undefined,
|
||||||
|
deleteButtonContent: undefined,
|
||||||
|
deleteConfirmationTitle: undefined,
|
||||||
|
deleteConfirmationContent: undefined,
|
||||||
|
deleteConfirmationButtonContent: undefined,
|
||||||
|
canEdit: true,
|
||||||
|
canLeaveIfLast: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Memberships;
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
:global(#app) {
|
||||||
|
.addUser {
|
||||||
|
background: rgba(0, 0, 0, 0.24);
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: none;
|
||||||
|
color: #fff;
|
||||||
|
line-height: 36px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
transition: all 0.1s ease 0s;
|
||||||
|
vertical-align: top;
|
||||||
|
width: 36px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(0, 0, 0, 0.32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 -4px 0 0;
|
||||||
|
vertical-align: top;
|
||||||
|
line-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.users {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
import Memberships from './Memberships';
|
||||||
|
|
||||||
|
export default Memberships;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue