Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34db8947b6 | ||
|
|
82e4f73c1f | ||
|
|
560bddbe18 | ||
|
|
9c192f4b5c | ||
|
|
a148a3aae5 | ||
|
|
7c1b885d2a | ||
|
|
a3f33d0361 | ||
|
|
fe62180cda | ||
|
|
58abd0691f | ||
|
|
ad67b9ba24 | ||
|
|
ddf9a32ea9 | ||
|
|
e01a2eafba | ||
|
|
3b3bff1b6b | ||
|
|
ecc45c7a9e | ||
|
|
3497e09703 | ||
|
|
dfc52191fc | ||
|
|
6268ced4cb | ||
|
|
e7495e0067 | ||
|
|
b8c065e0c8 | ||
|
|
86e4864d1b | ||
|
|
0be598ca9e | ||
|
|
ba850801c5 | ||
|
|
c9b23652d1 | ||
|
|
8490629e4c | ||
|
|
76fcd79203 | ||
|
|
3ce1bc0419 | ||
|
|
540fbfceb5 | ||
|
|
48a56648e2 | ||
|
|
6d002c311c |
+2
-6
@@ -16,13 +16,9 @@ WORKDIR /app
|
|||||||
|
|
||||||
COPY server/.npmrc server/package.json server/package-lock.json ./
|
COPY server/.npmrc server/package.json server/package-lock.json ./
|
||||||
|
|
||||||
RUN apk add \
|
RUN npm install npm@latest --global \
|
||||||
g++ make python3 \
|
|
||||||
--virtual node-pre-gyp-dependencies \
|
|
||||||
--no-cache \
|
|
||||||
&& npm install npm@latest --global \
|
|
||||||
&& npm install --production \
|
&& npm install --production \
|
||||||
&& apk del node-pre-gyp-dependencies --purge
|
&& apk del vips-dependencies --purge
|
||||||
|
|
||||||
COPY docker-start.sh start.sh
|
COPY docker-start.sh start.sh
|
||||||
COPY server .
|
COPY server .
|
||||||
|
|||||||
+1
-2
@@ -24,5 +24,4 @@ RUN apk -U upgrade \
|
|||||||
&& ./configure \
|
&& ./configure \
|
||||||
&& make \
|
&& make \
|
||||||
&& make install-strip \
|
&& make install-strip \
|
||||||
&& rm -rf /tmp/vips-${VIPS_VERSION} \
|
&& rm -rf /tmp/vips-${VIPS_VERSION}
|
||||||
&& apk del vips-dependencies --purge
|
|
||||||
|
|||||||
Generated
+9695
-6062
File diff suppressed because it is too large
Load Diff
+25
-22
@@ -63,57 +63,60 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.3.1",
|
||||||
"connected-react-router": "^6.9.2",
|
"connected-react-router": "^6.9.3",
|
||||||
"date-fns": "^2.28.0",
|
"date-fns": "^2.29.1",
|
||||||
"dequal": "^2.0.2",
|
"dequal": "^2.0.3",
|
||||||
"history": "^4.10.1",
|
"history": "^4.10.1",
|
||||||
"i18next": "^21.6.16",
|
"i18next": "^21.8.14",
|
||||||
"i18next-browser-languagedetector": "^6.1.4",
|
"i18next-browser-languagedetector": "^6.1.4",
|
||||||
"initials": "^3.1.2",
|
"initials": "^3.1.2",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.21",
|
||||||
"node-sass": "^7.0.1",
|
"node-sass": "^7.0.1",
|
||||||
|
"photoswipe": "^5.3.0",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-beautiful-dnd": "^13.0.0",
|
"react-beautiful-dnd": "^13.1.0",
|
||||||
"react-datepicker": "^4.7.0",
|
"react-datepicker": "^4.8.0",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-dropzone": "^12.0.5",
|
"react-dropzone": "^14.2.2",
|
||||||
"react-i18next": "^11.16.6",
|
"react-i18next": "^11.18.1",
|
||||||
"react-input-mask": "^2.0.4",
|
"react-input-mask": "^2.0.4",
|
||||||
"react-markdown": "^8.0.2",
|
"react-markdown": "^8.0.3",
|
||||||
|
"react-photoswipe-gallery": "^2.2.1",
|
||||||
"react-redux": "^7.2.8",
|
"react-redux": "^7.2.8",
|
||||||
"react-router-dom": "^5.3.1",
|
"react-router-dom": "^5.3.1",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"react-textarea-autosize": "^8.3.3",
|
"react-textarea-autosize": "^8.3.4",
|
||||||
"redux": "^4.1.2",
|
"redux": "^4.2.0",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"redux-orm": "^0.16.2",
|
"redux-orm": "^0.16.2",
|
||||||
"redux-saga": "^1.1.3",
|
"redux-saga": "^1.1.3",
|
||||||
|
"remark-breaks": "^3.0.2",
|
||||||
"remark-gfm": "^3.0.1",
|
"remark-gfm": "^3.0.1",
|
||||||
"reselect": "^4.1.5",
|
"reselect": "^4.1.6",
|
||||||
"sails.io.js": "^1.2.1",
|
"sails.io.js": "^1.2.1",
|
||||||
"semantic-ui-react": "^2.1.2",
|
"semantic-ui-react": "^2.1.3",
|
||||||
"socket.io-client": "^2.3.1",
|
"socket.io-client": "^2.3.1",
|
||||||
"validator": "^13.7.0",
|
"validator": "^13.7.0",
|
||||||
"whatwg-fetch": "^3.5.0"
|
"whatwg-fetch": "^3.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
|
||||||
"babel-preset-airbnb": "^5.0.0",
|
"babel-preset-airbnb": "^5.0.0",
|
||||||
"chai": "^4.3.6",
|
"chai": "^4.3.6",
|
||||||
"enzyme": "^3.11.0",
|
"enzyme": "^3.11.0",
|
||||||
"eslint": "^8.13.0",
|
"eslint": "^8.20.0",
|
||||||
"eslint-config-airbnb": "^19.0.4",
|
"eslint-config-airbnb": "^19.0.4",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-import": "^2.26.0",
|
"eslint-plugin-import": "^2.26.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.5.1",
|
"eslint-plugin-jsx-a11y": "^6.6.1",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"eslint-plugin-react": "^7.29.4",
|
"eslint-plugin-react": "^7.30.1",
|
||||||
"eslint-plugin-react-hooks": "^4.4.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"jest-enzyme": "^7.1.2",
|
"jest-enzyme": "^7.1.2",
|
||||||
"prettier": "2.6.2",
|
"prettier": "2.7.1",
|
||||||
"react-test-renderer": "^17.0.2"
|
"react-test-renderer": "^17.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import ActionTypes from '../constants/ActionTypes';
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export const fetchActions = (cardId) => ({
|
export const fetchActions = (cardId) => ({
|
||||||
type: ActionTypes.ACTIONS_FETCH,
|
type: ActionTypes.ACTIONS_FETCH,
|
||||||
payload: {
|
payload: {
|
||||||
@@ -24,3 +23,28 @@ fetchActions.failure = (cardId, error) => ({
|
|||||||
error,
|
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,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
import EntryActionTypes from '../../constants/EntryActionTypes';
|
import EntryActionTypes from '../../constants/EntryActionTypes';
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export const fetchActionsInCurrentCard = () => ({
|
export const fetchActionsInCurrentCard = () => ({
|
||||||
type: EntryActionTypes.ACTIONS_IN_CURRENT_CARD_FETCH,
|
type: EntryActionTypes.ACTIONS_IN_CURRENT_CARD_FETCH,
|
||||||
payload: {},
|
payload: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const toggleActionsDetailsInCurrentCard = (isVisible) => ({
|
||||||
|
type: EntryActionTypes.ACTIONS_DETAILS_IN_CURRENT_CARD_TOGGLE,
|
||||||
|
payload: {
|
||||||
|
isVisible,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@@ -29,6 +29,14 @@ export const handleTaskUpdate = (task) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const moveTask = (id, index) => ({
|
||||||
|
type: EntryActionTypes.TASK_MOVE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
index,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const deleteTask = (id) => ({
|
export const deleteTask = (id) => ({
|
||||||
type: EntryActionTypes.TASK_DELETE,
|
type: EntryActionTypes.TASK_DELETE,
|
||||||
payload: {
|
payload: {
|
||||||
|
|||||||
@@ -41,6 +41,21 @@ export const handleUserUpdate = (user) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const updateCurrentUserLanguage = (language) => ({
|
||||||
|
type: EntryActionTypes.CURRENT_USER_LANGUAGE_UPDATE,
|
||||||
|
payload: {
|
||||||
|
language,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const updateUserEmail = (id, data) => ({
|
||||||
|
type: EntryActionTypes.USER_EMAIL_UPDATE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const updateCurrentUserEmail = (data) => ({
|
export const updateCurrentUserEmail = (data) => ({
|
||||||
type: EntryActionTypes.CURRENT_USER_EMAIL_UPDATE,
|
type: EntryActionTypes.CURRENT_USER_EMAIL_UPDATE,
|
||||||
payload: {
|
payload: {
|
||||||
@@ -48,11 +63,26 @@ export const updateCurrentUserEmail = (data) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const clearUserEmailUpdateError = (id) => ({
|
||||||
|
type: EntryActionTypes.USER_EMAIL_UPDATE_ERROR_CLEAR,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const clearCurrentUserEmailUpdateError = () => ({
|
export const clearCurrentUserEmailUpdateError = () => ({
|
||||||
type: EntryActionTypes.CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR,
|
type: EntryActionTypes.CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR,
|
||||||
payload: {},
|
payload: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const updateUserPassword = (id, data) => ({
|
||||||
|
type: EntryActionTypes.USER_PASSWORD_UPDATE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const updateCurrentUserPassword = (data) => ({
|
export const updateCurrentUserPassword = (data) => ({
|
||||||
type: EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE,
|
type: EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE,
|
||||||
payload: {
|
payload: {
|
||||||
@@ -60,11 +90,26 @@ export const updateCurrentUserPassword = (data) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const clearUserPasswordUpdateError = (id) => ({
|
||||||
|
type: EntryActionTypes.USER_PASSWORD_UPDATE_ERROR_CLEAR,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const clearCurrentUserPasswordUpdateError = () => ({
|
export const clearCurrentUserPasswordUpdateError = () => ({
|
||||||
type: EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR,
|
type: EntryActionTypes.CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR,
|
||||||
payload: {},
|
payload: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const updateUserUsername = (id, data) => ({
|
||||||
|
type: EntryActionTypes.USER_USERNAME_UPDATE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const updateCurrentUserUsername = (data) => ({
|
export const updateCurrentUserUsername = (data) => ({
|
||||||
type: EntryActionTypes.CURRENT_USER_USERNAME_UPDATE,
|
type: EntryActionTypes.CURRENT_USER_USERNAME_UPDATE,
|
||||||
payload: {
|
payload: {
|
||||||
@@ -72,6 +117,13 @@ export const updateCurrentUserUsername = (data) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const clearUserUsernameUpdateError = (id) => ({
|
||||||
|
type: EntryActionTypes.USER_USERNAME_UPDATE_ERROR_CLEAR,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const clearCurrentUserUsernameUpdateError = () => ({
|
export const clearCurrentUserUsernameUpdateError = () => ({
|
||||||
type: EntryActionTypes.CURRENT_USER_USERNAME_UPDATE_ERROR_CLEAR,
|
type: EntryActionTypes.CURRENT_USER_USERNAME_UPDATE_ERROR_CLEAR,
|
||||||
payload: {},
|
payload: {},
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const DEFAULT_DATA = {
|
|||||||
const ListAdd = React.memo(({ onCreate, onClose }) => {
|
const ListAdd = React.memo(({ onCreate, onClose }) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
||||||
const [selectNameFieldState, selectNameField] = useToggle();
|
const [focusNameFieldState, focusNameField] = useToggle();
|
||||||
|
|
||||||
const nameField = useRef(null);
|
const nameField = useRef(null);
|
||||||
|
|
||||||
@@ -44,16 +44,16 @@ const ListAdd = React.memo(({ onCreate, onClose }) => {
|
|||||||
onCreate(cleanData);
|
onCreate(cleanData);
|
||||||
|
|
||||||
setData(DEFAULT_DATA);
|
setData(DEFAULT_DATA);
|
||||||
selectNameField();
|
focusNameField();
|
||||||
}, [onCreate, data, setData, selectNameField]);
|
}, [onCreate, data, setData, focusNameField]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
nameField.current.select();
|
nameField.current.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useDidUpdate(() => {
|
useDidUpdate(() => {
|
||||||
nameField.current.select();
|
nameField.current.focus();
|
||||||
}, [selectNameFieldState]);
|
}, [focusNameFieldState]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form className={styles.wrapper} onSubmit={handleSubmit}>
|
<Form className={styles.wrapper} onSubmit={handleSubmit}>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const AddStep = React.memo(({ onCreate, onClose }) => {
|
|||||||
}, [onCreate, onClose, data]);
|
}, [onCreate, onClose, data]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
nameField.current.select();
|
nameField.current.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
|
|
||||||
.cover {
|
.cover {
|
||||||
border-radius: 3px 3px 0 0;
|
border-radius: 3px 3px 0 0;
|
||||||
|
margin-bottom: 2px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +115,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
|
cursor: auto;
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
field.current.ref.current.select();
|
field.current.ref.current.focus();
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Comment, Icon, Loader, Visibility } from 'semantic-ui-react';
|
import { Button, Comment, Icon, Loader, Visibility } from 'semantic-ui-react';
|
||||||
|
|
||||||
import { ActionTypes } from '../../../constants/Enums';
|
import { ActionTypes } from '../../../constants/Enums';
|
||||||
import CommentAdd from './CommentAdd';
|
import CommentAdd from './CommentAdd';
|
||||||
@@ -14,15 +14,22 @@ const Actions = React.memo(
|
|||||||
items,
|
items,
|
||||||
isFetching,
|
isFetching,
|
||||||
isAllFetched,
|
isAllFetched,
|
||||||
|
isDetailsVisible,
|
||||||
|
isDetailsFetching,
|
||||||
canEdit,
|
canEdit,
|
||||||
canEditAllComments,
|
canEditAllComments,
|
||||||
onFetch,
|
onFetch,
|
||||||
|
onDetailsToggle,
|
||||||
onCommentCreate,
|
onCommentCreate,
|
||||||
onCommentUpdate,
|
onCommentUpdate,
|
||||||
onCommentDelete,
|
onCommentDelete,
|
||||||
}) => {
|
}) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
|
||||||
|
const handleToggleDetailsClick = useCallback(() => {
|
||||||
|
onDetailsToggle(!isDetailsVisible);
|
||||||
|
}, [isDetailsVisible, onDetailsToggle]);
|
||||||
|
|
||||||
const handleCommentUpdate = useCallback(
|
const handleCommentUpdate = useCallback(
|
||||||
(id, data) => {
|
(id, data) => {
|
||||||
onCommentUpdate(id, data);
|
onCommentUpdate(id, data);
|
||||||
@@ -38,54 +45,51 @@ const Actions = React.memo(
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className={styles.contentModule}>
|
||||||
{canEdit && (
|
<div className={styles.moduleWrapper}>
|
||||||
<div className={styles.contentModule}>
|
<Icon name="list ul" className={styles.moduleIcon} />
|
||||||
<div className={styles.moduleWrapper}>
|
<div className={styles.moduleHeader}>
|
||||||
<Icon name="comment outline" className={styles.moduleIcon} />
|
{t('common.actions')}
|
||||||
<div className={styles.moduleHeader}>{t('common.addComment')}</div>
|
<Button
|
||||||
<CommentAdd onCreate={onCommentCreate} />
|
content={isDetailsVisible ? t('action.hideDetails') : t('action.showDetails')}
|
||||||
</div>
|
className={styles.toggleButton}
|
||||||
|
onClick={handleToggleDetailsClick}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
{canEdit && <CommentAdd onCreate={onCommentCreate} />}
|
||||||
<div className={styles.contentModule}>
|
<div className={styles.wrapper}>
|
||||||
<div className={styles.moduleWrapper}>
|
<Comment.Group>
|
||||||
<Icon name="list ul" className={styles.moduleIcon} />
|
{items.map((item) =>
|
||||||
<div className={styles.moduleHeader}>{t('common.actions')}</div>
|
item.type === ActionTypes.COMMENT_CARD ? (
|
||||||
<div className={styles.wrapper}>
|
<Item.Comment
|
||||||
<Comment.Group>
|
key={item.id}
|
||||||
{items.map((item) =>
|
data={item.data}
|
||||||
item.type === ActionTypes.COMMENT_CARD ? (
|
createdAt={item.createdAt}
|
||||||
<Item.Comment
|
isPersisted={item.isPersisted}
|
||||||
key={item.id}
|
user={item.user}
|
||||||
data={item.data}
|
canEdit={(item.user.isCurrent && canEdit) || canEditAllComments}
|
||||||
createdAt={item.createdAt}
|
onUpdate={(data) => handleCommentUpdate(item.id, data)}
|
||||||
isPersisted={item.isPersisted}
|
onDelete={() => handleCommentDelete(item.id)}
|
||||||
user={item.user}
|
/>
|
||||||
canEdit={(item.user.isCurrent && canEdit) || canEditAllComments}
|
) : (
|
||||||
onUpdate={(data) => handleCommentUpdate(item.id, data)}
|
<Item
|
||||||
onDelete={() => handleCommentDelete(item.id)}
|
key={item.id}
|
||||||
/>
|
type={item.type}
|
||||||
) : (
|
data={item.data}
|
||||||
<Item
|
createdAt={item.createdAt}
|
||||||
key={item.id}
|
user={item.user}
|
||||||
type={item.type}
|
/>
|
||||||
data={item.data}
|
),
|
||||||
createdAt={item.createdAt}
|
)}
|
||||||
user={item.user}
|
</Comment.Group>
|
||||||
/>
|
|
||||||
),
|
|
||||||
)}
|
|
||||||
</Comment.Group>
|
|
||||||
</div>
|
|
||||||
{isFetching ? (
|
|
||||||
<Loader active inverted inline="centered" size="small" className={styles.loader} />
|
|
||||||
) : (
|
|
||||||
!isAllFetched && <Visibility fireOnMount onOnScreen={onFetch} />
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
{isFetching || isDetailsFetching ? (
|
||||||
|
<Loader active inverted inline="centered" size="small" className={styles.loader} />
|
||||||
|
) : (
|
||||||
|
!isAllFetched && <Visibility fireOnMount onOnScreen={onFetch} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -94,9 +98,12 @@ Actions.propTypes = {
|
|||||||
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
|
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
isFetching: PropTypes.bool.isRequired,
|
isFetching: PropTypes.bool.isRequired,
|
||||||
isAllFetched: PropTypes.bool.isRequired,
|
isAllFetched: PropTypes.bool.isRequired,
|
||||||
|
isDetailsVisible: PropTypes.bool.isRequired,
|
||||||
|
isDetailsFetching: PropTypes.bool.isRequired,
|
||||||
canEdit: PropTypes.bool.isRequired,
|
canEdit: PropTypes.bool.isRequired,
|
||||||
canEditAllComments: PropTypes.bool.isRequired,
|
canEditAllComments: PropTypes.bool.isRequired,
|
||||||
onFetch: PropTypes.func.isRequired,
|
onFetch: PropTypes.func.isRequired,
|
||||||
|
onDetailsToggle: PropTypes.func.isRequired,
|
||||||
onCommentCreate: PropTypes.func.isRequired,
|
onCommentCreate: PropTypes.func.isRequired,
|
||||||
onCommentUpdate: PropTypes.func.isRequired,
|
onCommentUpdate: PropTypes.func.isRequired,
|
||||||
onCommentDelete: PropTypes.func.isRequired,
|
onCommentDelete: PropTypes.func.isRequired,
|
||||||
|
|||||||
@@ -8,12 +8,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.moduleHeader {
|
.moduleHeader {
|
||||||
|
align-items: center;
|
||||||
color: #17394d;
|
color: #17394d;
|
||||||
|
display: flex;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 20px;
|
height: 36px;
|
||||||
|
justify-content: space-between;
|
||||||
margin: 0 0 4px;
|
margin: 0 0 4px;
|
||||||
padding: 8px 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.moduleIcon {
|
.moduleIcon {
|
||||||
@@ -33,6 +35,24 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toggleButton {
|
||||||
|
background: transparent;
|
||||||
|
box-shadow: none;
|
||||||
|
color: #6b808c;
|
||||||
|
float: right;
|
||||||
|
font-weight: normal;
|
||||||
|
margin-right: 0;
|
||||||
|
padding: 6px 11px;
|
||||||
|
text-align: left;
|
||||||
|
text-decoration: underline;
|
||||||
|
transition: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(9, 30, 66, 0.08);
|
||||||
|
color: #092d42;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
margin-left: -40px;
|
margin-left: -40px;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import React, { useCallback, useRef } from 'react';
|
import React, { useCallback, useRef, useState } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import TextareaAutosize from 'react-textarea-autosize';
|
import TextareaAutosize from 'react-textarea-autosize';
|
||||||
import { Button, Form, TextArea } from 'semantic-ui-react';
|
import { Button, Form, TextArea } from 'semantic-ui-react';
|
||||||
|
import { useDidUpdate, useToggle } from '../../../lib/hooks';
|
||||||
|
|
||||||
import { useForm } from '../../../hooks';
|
import { useClosableForm, useForm } from '../../../hooks';
|
||||||
|
|
||||||
import styles from './CommentAdd.module.scss';
|
import styles from './CommentAdd.module.scss';
|
||||||
|
|
||||||
@@ -14,10 +15,16 @@ const DEFAULT_DATA = {
|
|||||||
|
|
||||||
const CommentAdd = React.memo(({ onCreate }) => {
|
const CommentAdd = React.memo(({ onCreate }) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
const [isOpened, setIsOpened] = useState(false);
|
||||||
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
||||||
|
const [selectTextFieldState, selectTextField] = useToggle();
|
||||||
|
|
||||||
const textField = useRef(null);
|
const textField = useRef(null);
|
||||||
|
|
||||||
|
const close = useCallback(() => {
|
||||||
|
setIsOpened(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const submit = useCallback(() => {
|
const submit = useCallback(() => {
|
||||||
const cleanData = {
|
const cleanData = {
|
||||||
...data,
|
...data,
|
||||||
@@ -32,7 +39,12 @@ const CommentAdd = React.memo(({ onCreate }) => {
|
|||||||
onCreate(cleanData);
|
onCreate(cleanData);
|
||||||
|
|
||||||
setData(DEFAULT_DATA);
|
setData(DEFAULT_DATA);
|
||||||
}, [onCreate, data, setData]);
|
selectTextField();
|
||||||
|
}, [onCreate, data, setData, selectTextField]);
|
||||||
|
|
||||||
|
const handleFieldFocus = useCallback(() => {
|
||||||
|
setIsOpened(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleFieldKeyDown = useCallback(
|
const handleFieldKeyDown = useCallback(
|
||||||
(event) => {
|
(event) => {
|
||||||
@@ -43,10 +55,16 @@ const CommentAdd = React.memo(({ onCreate }) => {
|
|||||||
[submit],
|
[submit],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [handleFieldBlur, handleControlMouseOver, handleControlMouseOut] = useClosableForm(close);
|
||||||
|
|
||||||
const handleSubmit = useCallback(() => {
|
const handleSubmit = useCallback(() => {
|
||||||
submit();
|
submit();
|
||||||
}, [submit]);
|
}, [submit]);
|
||||||
|
|
||||||
|
useDidUpdate(() => {
|
||||||
|
textField.current.ref.current.focus();
|
||||||
|
}, [selectTextFieldState]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form onSubmit={handleSubmit}>
|
<Form onSubmit={handleSubmit}>
|
||||||
<TextArea
|
<TextArea
|
||||||
@@ -55,15 +73,24 @@ const CommentAdd = React.memo(({ onCreate }) => {
|
|||||||
name="text"
|
name="text"
|
||||||
value={data.text}
|
value={data.text}
|
||||||
placeholder={t('common.writeComment')}
|
placeholder={t('common.writeComment')}
|
||||||
minRows={3}
|
minRows={isOpened ? 3 : 1}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
className={styles.field}
|
className={styles.field}
|
||||||
|
onFocus={handleFieldFocus}
|
||||||
onKeyDown={handleFieldKeyDown}
|
onKeyDown={handleFieldKeyDown}
|
||||||
onChange={handleFieldChange}
|
onChange={handleFieldChange}
|
||||||
|
onBlur={handleFieldBlur}
|
||||||
/>
|
/>
|
||||||
<div className={styles.controls}>
|
{isOpened && (
|
||||||
<Button positive content={t('action.addComment')} disabled={!data.text} />
|
<div className={styles.controls}>
|
||||||
</div>
|
<Button
|
||||||
|
positive
|
||||||
|
content={t('action.addComment')}
|
||||||
|
onMouseOver={handleControlMouseOver}
|
||||||
|
onMouseOut={handleControlMouseOut}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ const CommentEdit = React.forwardRef(({ children, defaultData, onUpdate }, ref)
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
textField.current.ref.current.select();
|
textField.current.ref.current.focus();
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ const TextFileAddModal = React.memo(({ content, onCreate, onClose }) => {
|
|||||||
}, [content, onCreate, onClose, data]);
|
}, [content, onCreate, onClose, data]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
nameField.current.select();
|
nameField.current.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import classNames from 'classnames';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { Gallery, Item as GalleryItem } from 'react-photoswipe-gallery';
|
||||||
import { Button } from 'semantic-ui-react';
|
import { Button } from 'semantic-ui-react';
|
||||||
import { useToggle } from '../../../lib/hooks';
|
import { useToggle } from '../../../lib/hooks';
|
||||||
|
|
||||||
@@ -8,81 +10,152 @@ import Item from './Item';
|
|||||||
|
|
||||||
import styles from './Attachments.module.scss';
|
import styles from './Attachments.module.scss';
|
||||||
|
|
||||||
const Attachments = React.memo(({ items, onUpdate, onDelete, onCoverUpdate }) => {
|
const INITIALLY_VISIBLE = 4;
|
||||||
const [t] = useTranslation();
|
|
||||||
const [isOpened, toggleOpened] = useToggle();
|
|
||||||
|
|
||||||
const handleToggleClick = useCallback(() => {
|
const Attachments = React.memo(
|
||||||
toggleOpened();
|
({ items, onUpdate, onDelete, onCoverUpdate, onGalleryOpen, onGalleryClose }) => {
|
||||||
}, [toggleOpened]);
|
const [t] = useTranslation();
|
||||||
|
const [isAllVisible, toggleAllVisible] = useToggle();
|
||||||
|
|
||||||
const handleCoverSelect = useCallback(
|
const handleCoverSelect = useCallback(
|
||||||
(id) => {
|
(id) => {
|
||||||
onCoverUpdate(id);
|
onCoverUpdate(id);
|
||||||
},
|
},
|
||||||
[onCoverUpdate],
|
[onCoverUpdate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleCoverDeselect = useCallback(() => {
|
const handleCoverDeselect = useCallback(() => {
|
||||||
onCoverUpdate(null);
|
onCoverUpdate(null);
|
||||||
}, [onCoverUpdate]);
|
}, [onCoverUpdate]);
|
||||||
|
|
||||||
const handleUpdate = useCallback(
|
const handleUpdate = useCallback(
|
||||||
(id, data) => {
|
(id, data) => {
|
||||||
onUpdate(id, data);
|
onUpdate(id, data);
|
||||||
},
|
},
|
||||||
[onUpdate],
|
[onUpdate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleDelete = useCallback(
|
const handleDelete = useCallback(
|
||||||
(id) => {
|
(id) => {
|
||||||
onDelete(id);
|
onDelete(id);
|
||||||
},
|
},
|
||||||
[onDelete],
|
[onDelete],
|
||||||
);
|
);
|
||||||
|
|
||||||
const visibleItems = isOpened ? items : items.slice(0, 4);
|
const handleBeforeGalleryOpen = useCallback(
|
||||||
|
(gallery) => {
|
||||||
|
onGalleryOpen();
|
||||||
|
|
||||||
return (
|
gallery.on('destroy', () => {
|
||||||
<>
|
onGalleryClose();
|
||||||
{visibleItems.map((item) => (
|
});
|
||||||
<Item
|
},
|
||||||
|
[onGalleryOpen, onGalleryClose],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleToggleAllVisibleClick = useCallback(() => {
|
||||||
|
toggleAllVisible();
|
||||||
|
}, [toggleAllVisible]);
|
||||||
|
|
||||||
|
const galleryItemsNode = items.map((item, index) => {
|
||||||
|
const isPdf = item.url && item.url.endsWith('.pdf');
|
||||||
|
|
||||||
|
let props;
|
||||||
|
if (item.image) {
|
||||||
|
props = item.image;
|
||||||
|
} else {
|
||||||
|
props = {
|
||||||
|
content: isPdf ? (
|
||||||
|
// eslint-disable-next-line jsx-a11y/alt-text
|
||||||
|
<object
|
||||||
|
data={item.url}
|
||||||
|
type="application/pdf"
|
||||||
|
className={classNames(styles.content, styles.contentPdf)}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<span className={classNames(styles.content, styles.contentError)}>
|
||||||
|
{t('common.thereIsNoPreviewAvailableForThisAttachment')}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const isVisible = isAllVisible || index < INITIALLY_VISIBLE;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<GalleryItem
|
||||||
|
{...props} // eslint-disable-line react/jsx-props-no-spreading
|
||||||
key={item.id}
|
key={item.id}
|
||||||
name={item.name}
|
original={item.url}
|
||||||
url={item.url}
|
caption={item.name}
|
||||||
coverUrl={item.coverUrl}
|
>
|
||||||
createdAt={item.createdAt}
|
{({ ref, open }) =>
|
||||||
isCover={item.isCover}
|
isVisible ? (
|
||||||
isPersisted={item.isPersisted}
|
<Item
|
||||||
onCoverSelect={() => handleCoverSelect(item.id)}
|
ref={ref}
|
||||||
onCoverDeselect={handleCoverDeselect}
|
name={item.name}
|
||||||
onUpdate={(data) => handleUpdate(item.id, data)}
|
url={item.url}
|
||||||
onDelete={() => handleDelete(item.id)}
|
coverUrl={item.coverUrl}
|
||||||
/>
|
createdAt={item.createdAt}
|
||||||
))}
|
isCover={item.isCover}
|
||||||
{items.length > 4 && (
|
isPersisted={item.isPersisted}
|
||||||
<Button
|
onClick={item.image || isPdf ? open : undefined}
|
||||||
fluid
|
onCoverSelect={() => handleCoverSelect(item.id)}
|
||||||
content={
|
onCoverDeselect={handleCoverDeselect}
|
||||||
isOpened
|
onUpdate={(data) => handleUpdate(item.id, data)}
|
||||||
? t('action.showFewerAttachments')
|
onDelete={() => handleDelete(item.id)}
|
||||||
: t('action.showAllAttachments', {
|
/>
|
||||||
hidden: items.length - visibleItems.length,
|
) : (
|
||||||
})
|
<span ref={ref} />
|
||||||
|
)
|
||||||
}
|
}
|
||||||
className={styles.toggleButton}
|
</GalleryItem>
|
||||||
onClick={handleToggleClick}
|
);
|
||||||
/>
|
});
|
||||||
)}
|
|
||||||
</>
|
return (
|
||||||
);
|
<>
|
||||||
});
|
<Gallery
|
||||||
|
withCaption
|
||||||
|
withDownloadButton
|
||||||
|
options={{
|
||||||
|
showHideAnimationType: 'none',
|
||||||
|
closeTitle: '',
|
||||||
|
zoomTitle: '',
|
||||||
|
arrowPrevTitle: '',
|
||||||
|
arrowNextTitle: '',
|
||||||
|
errorMsg: '',
|
||||||
|
}}
|
||||||
|
onBeforeOpen={handleBeforeGalleryOpen}
|
||||||
|
>
|
||||||
|
{galleryItemsNode}
|
||||||
|
</Gallery>
|
||||||
|
{items.length > INITIALLY_VISIBLE && (
|
||||||
|
<Button
|
||||||
|
fluid
|
||||||
|
content={
|
||||||
|
isAllVisible
|
||||||
|
? t('action.showFewerAttachments')
|
||||||
|
: t('action.showAllAttachments', {
|
||||||
|
hidden: items.length - INITIALLY_VISIBLE,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
className={styles.toggleButton}
|
||||||
|
onClick={handleToggleAllVisibleClick}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
Attachments.propTypes = {
|
Attachments.propTypes = {
|
||||||
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
|
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
onDelete: PropTypes.func.isRequired,
|
onDelete: PropTypes.func.isRequired,
|
||||||
onCoverUpdate: PropTypes.func.isRequired,
|
onCoverUpdate: PropTypes.func.isRequired,
|
||||||
|
onGalleryOpen: PropTypes.func.isRequired,
|
||||||
|
onGalleryClose: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Attachments;
|
export default Attachments;
|
||||||
|
|||||||
@@ -1,4 +1,26 @@
|
|||||||
:global(#app) {
|
:global(#app) {
|
||||||
|
.content {
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
margin: auto;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentPdf {
|
||||||
|
height: 100%;
|
||||||
|
width: 1120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentError {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
height: 20px;
|
||||||
|
width: 470px;
|
||||||
|
}
|
||||||
|
|
||||||
.toggleButton {
|
.toggleButton {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
|||||||
@@ -8,24 +8,32 @@ import EditPopup from './EditPopup';
|
|||||||
|
|
||||||
import styles from './Item.module.scss';
|
import styles from './Item.module.scss';
|
||||||
|
|
||||||
const Item = React.memo(
|
const Item = React.forwardRef(
|
||||||
({
|
(
|
||||||
name,
|
{
|
||||||
url,
|
name,
|
||||||
coverUrl,
|
url,
|
||||||
createdAt,
|
coverUrl,
|
||||||
isCover,
|
createdAt,
|
||||||
isPersisted,
|
isCover,
|
||||||
onCoverSelect,
|
isPersisted,
|
||||||
onCoverDeselect,
|
onCoverSelect,
|
||||||
onUpdate,
|
onCoverDeselect,
|
||||||
onDelete,
|
onClick,
|
||||||
}) => {
|
onUpdate,
|
||||||
|
onDelete,
|
||||||
|
},
|
||||||
|
ref,
|
||||||
|
) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => {
|
||||||
window.open(url, '_blank');
|
if (onClick) {
|
||||||
}, [url]);
|
onClick();
|
||||||
|
} else {
|
||||||
|
window.open(url, '_blank');
|
||||||
|
}
|
||||||
|
}, [url, onClick]);
|
||||||
|
|
||||||
const handleToggleCoverClick = useCallback(
|
const handleToggleCoverClick = useCallback(
|
||||||
(event) => {
|
(event) => {
|
||||||
@@ -54,7 +62,7 @@ const Item = React.memo(
|
|||||||
return (
|
return (
|
||||||
/* eslint-disable jsx-a11y/click-events-have-key-events,
|
/* eslint-disable jsx-a11y/click-events-have-key-events,
|
||||||
jsx-a11y/no-static-element-interactions */
|
jsx-a11y/no-static-element-interactions */
|
||||||
<div className={styles.wrapper} onClick={handleClick}>
|
<div ref={ref} className={styles.wrapper} onClick={handleClick}>
|
||||||
{/* eslint-enable jsx-a11y/click-events-have-key-events,
|
{/* eslint-enable jsx-a11y/click-events-have-key-events,
|
||||||
jsx-a11y/no-static-element-interactions */}
|
jsx-a11y/no-static-element-interactions */}
|
||||||
<div
|
<div
|
||||||
@@ -133,6 +141,7 @@ Item.propTypes = {
|
|||||||
createdAt: PropTypes.instanceOf(Date),
|
createdAt: PropTypes.instanceOf(Date),
|
||||||
isCover: PropTypes.bool.isRequired,
|
isCover: PropTypes.bool.isRequired,
|
||||||
isPersisted: PropTypes.bool.isRequired,
|
isPersisted: PropTypes.bool.isRequired,
|
||||||
|
onClick: PropTypes.func,
|
||||||
onCoverSelect: PropTypes.func.isRequired,
|
onCoverSelect: PropTypes.func.isRequired,
|
||||||
onCoverDeselect: PropTypes.func.isRequired,
|
onCoverDeselect: PropTypes.func.isRequired,
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
@@ -143,6 +152,7 @@ Item.defaultProps = {
|
|||||||
url: undefined,
|
url: undefined,
|
||||||
coverUrl: undefined,
|
coverUrl: undefined,
|
||||||
createdAt: undefined,
|
createdAt: undefined,
|
||||||
|
onClick: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Item;
|
export default React.memo(Item);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback, useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -34,6 +34,8 @@ const CardModal = React.memo(
|
|||||||
isSubscribed,
|
isSubscribed,
|
||||||
isActionsFetching,
|
isActionsFetching,
|
||||||
isAllActionsFetched,
|
isAllActionsFetched,
|
||||||
|
isActionsDetailsVisible,
|
||||||
|
isActionsDetailsFetching,
|
||||||
listId,
|
listId,
|
||||||
boardId,
|
boardId,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -61,11 +63,13 @@ const CardModal = React.memo(
|
|||||||
onLabelDelete,
|
onLabelDelete,
|
||||||
onTaskCreate,
|
onTaskCreate,
|
||||||
onTaskUpdate,
|
onTaskUpdate,
|
||||||
|
onTaskMove,
|
||||||
onTaskDelete,
|
onTaskDelete,
|
||||||
onAttachmentCreate,
|
onAttachmentCreate,
|
||||||
onAttachmentUpdate,
|
onAttachmentUpdate,
|
||||||
onAttachmentDelete,
|
onAttachmentDelete,
|
||||||
onActionsFetch,
|
onActionsFetch,
|
||||||
|
onActionsDetailsToggle,
|
||||||
onCommentActionCreate,
|
onCommentActionCreate,
|
||||||
onCommentActionUpdate,
|
onCommentActionUpdate,
|
||||||
onCommentActionDelete,
|
onCommentActionDelete,
|
||||||
@@ -73,6 +77,8 @@ const CardModal = React.memo(
|
|||||||
}) => {
|
}) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
|
||||||
|
const isGalleryOpened = useRef(false);
|
||||||
|
|
||||||
const handleNameUpdate = useCallback(
|
const handleNameUpdate = useCallback(
|
||||||
(newName) => {
|
(newName) => {
|
||||||
onUpdate({
|
onUpdate({
|
||||||
@@ -124,6 +130,22 @@ const CardModal = React.memo(
|
|||||||
});
|
});
|
||||||
}, [isSubscribed, onUpdate]);
|
}, [isSubscribed, onUpdate]);
|
||||||
|
|
||||||
|
const handleGalleryOpen = useCallback(() => {
|
||||||
|
isGalleryOpened.current = true;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleGalleryClose = useCallback(() => {
|
||||||
|
isGalleryOpened.current = false;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleClose = useCallback(() => {
|
||||||
|
if (isGalleryOpened.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose();
|
||||||
|
}, [onClose]);
|
||||||
|
|
||||||
const userIds = users.map((user) => user.id);
|
const userIds = users.map((user) => user.id);
|
||||||
const labelIds = labels.map((label) => label.id);
|
const labelIds = labels.map((label) => label.id);
|
||||||
|
|
||||||
@@ -313,6 +335,7 @@ const CardModal = React.memo(
|
|||||||
canEdit={canEdit}
|
canEdit={canEdit}
|
||||||
onCreate={onTaskCreate}
|
onCreate={onTaskCreate}
|
||||||
onUpdate={onTaskUpdate}
|
onUpdate={onTaskUpdate}
|
||||||
|
onMove={onTaskMove}
|
||||||
onDelete={onTaskDelete}
|
onDelete={onTaskDelete}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -328,6 +351,8 @@ const CardModal = React.memo(
|
|||||||
onUpdate={onAttachmentUpdate}
|
onUpdate={onAttachmentUpdate}
|
||||||
onDelete={onAttachmentDelete}
|
onDelete={onAttachmentDelete}
|
||||||
onCoverUpdate={handleCoverUpdate}
|
onCoverUpdate={handleCoverUpdate}
|
||||||
|
onGalleryOpen={handleGalleryOpen}
|
||||||
|
onGalleryClose={handleGalleryClose}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -336,9 +361,12 @@ const CardModal = React.memo(
|
|||||||
items={actions}
|
items={actions}
|
||||||
isFetching={isActionsFetching}
|
isFetching={isActionsFetching}
|
||||||
isAllFetched={isAllActionsFetched}
|
isAllFetched={isAllActionsFetched}
|
||||||
|
isDetailsVisible={isActionsDetailsVisible}
|
||||||
|
isDetailsFetching={isActionsDetailsFetching}
|
||||||
canEdit={canEdit}
|
canEdit={canEdit}
|
||||||
canEditAllComments={canEditAllCommentActions}
|
canEditAllComments={canEditAllCommentActions}
|
||||||
onFetch={onActionsFetch}
|
onFetch={onActionsFetch}
|
||||||
|
onDetailsToggle={onActionsDetailsToggle}
|
||||||
onCommentCreate={onCommentActionCreate}
|
onCommentCreate={onCommentActionCreate}
|
||||||
onCommentUpdate={onCommentActionUpdate}
|
onCommentUpdate={onCommentActionUpdate}
|
||||||
onCommentDelete={onCommentActionDelete}
|
onCommentDelete={onCommentActionDelete}
|
||||||
@@ -445,7 +473,7 @@ const CardModal = React.memo(
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal open closeIcon size="small" centered={false} onClose={onClose}>
|
<Modal open closeIcon centered={false} onClose={handleClose} className={styles.wrapper}>
|
||||||
{canEdit ? (
|
{canEdit ? (
|
||||||
<AttachmentAddZone onCreate={onAttachmentCreate}>{contentNode}</AttachmentAddZone>
|
<AttachmentAddZone onCreate={onAttachmentCreate}>{contentNode}</AttachmentAddZone>
|
||||||
) : (
|
) : (
|
||||||
@@ -464,6 +492,8 @@ CardModal.propTypes = {
|
|||||||
isSubscribed: PropTypes.bool.isRequired,
|
isSubscribed: PropTypes.bool.isRequired,
|
||||||
isActionsFetching: PropTypes.bool.isRequired,
|
isActionsFetching: PropTypes.bool.isRequired,
|
||||||
isAllActionsFetched: PropTypes.bool.isRequired,
|
isAllActionsFetched: PropTypes.bool.isRequired,
|
||||||
|
isActionsDetailsVisible: PropTypes.bool.isRequired,
|
||||||
|
isActionsDetailsFetching: PropTypes.bool.isRequired,
|
||||||
listId: PropTypes.string.isRequired,
|
listId: PropTypes.string.isRequired,
|
||||||
boardId: PropTypes.string.isRequired,
|
boardId: PropTypes.string.isRequired,
|
||||||
projectId: PropTypes.string.isRequired,
|
projectId: PropTypes.string.isRequired,
|
||||||
@@ -493,11 +523,13 @@ CardModal.propTypes = {
|
|||||||
onLabelDelete: PropTypes.func.isRequired,
|
onLabelDelete: PropTypes.func.isRequired,
|
||||||
onTaskCreate: PropTypes.func.isRequired,
|
onTaskCreate: PropTypes.func.isRequired,
|
||||||
onTaskUpdate: PropTypes.func.isRequired,
|
onTaskUpdate: PropTypes.func.isRequired,
|
||||||
|
onTaskMove: PropTypes.func.isRequired,
|
||||||
onTaskDelete: PropTypes.func.isRequired,
|
onTaskDelete: PropTypes.func.isRequired,
|
||||||
onAttachmentCreate: PropTypes.func.isRequired,
|
onAttachmentCreate: PropTypes.func.isRequired,
|
||||||
onAttachmentUpdate: PropTypes.func.isRequired,
|
onAttachmentUpdate: PropTypes.func.isRequired,
|
||||||
onAttachmentDelete: PropTypes.func.isRequired,
|
onAttachmentDelete: PropTypes.func.isRequired,
|
||||||
onActionsFetch: PropTypes.func.isRequired,
|
onActionsFetch: PropTypes.func.isRequired,
|
||||||
|
onActionsDetailsToggle: PropTypes.func.isRequired,
|
||||||
onCommentActionCreate: PropTypes.func.isRequired,
|
onCommentActionCreate: PropTypes.func.isRequired,
|
||||||
onCommentActionUpdate: PropTypes.func.isRequired,
|
onCommentActionUpdate: PropTypes.func.isRequired,
|
||||||
onCommentActionDelete: PropTypes.func.isRequired,
|
onCommentActionDelete: PropTypes.func.isRequired,
|
||||||
|
|||||||
@@ -193,4 +193,14 @@
|
|||||||
margin: 0 8px 4px 0;
|
margin: 0 8px 4px 0;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
width: 880px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 926px) {
|
||||||
|
.wrapper {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ const DescriptionEdit = React.forwardRef(({ children, defaultValue, onUpdate },
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
field.current.ref.current.select();
|
field.current.ref.current.focus();
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const Add = React.forwardRef(({ children, onCreate }, ref) => {
|
|||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
const [isOpened, setIsOpened] = useState(false);
|
const [isOpened, setIsOpened] = useState(false);
|
||||||
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
||||||
const [selectNameFieldState, selectNameField] = useToggle();
|
const [focusNameFieldState, focusNameField] = useToggle();
|
||||||
|
|
||||||
const nameField = useRef(null);
|
const nameField = useRef(null);
|
||||||
|
|
||||||
@@ -43,8 +43,8 @@ const Add = React.forwardRef(({ children, onCreate }, ref) => {
|
|||||||
onCreate(cleanData);
|
onCreate(cleanData);
|
||||||
|
|
||||||
setData(DEFAULT_DATA);
|
setData(DEFAULT_DATA);
|
||||||
selectNameField();
|
focusNameField();
|
||||||
}, [onCreate, data, setData, selectNameField]);
|
}, [onCreate, data, setData, focusNameField]);
|
||||||
|
|
||||||
useImperativeHandle(
|
useImperativeHandle(
|
||||||
ref,
|
ref,
|
||||||
@@ -81,13 +81,13 @@ const Add = React.forwardRef(({ children, onCreate }, ref) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
nameField.current.ref.current.select();
|
nameField.current.ref.current.focus();
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
useDidUpdate(() => {
|
useDidUpdate(() => {
|
||||||
nameField.current.ref.current.select();
|
nameField.current.ref.current.focus();
|
||||||
}, [selectNameFieldState]);
|
}, [focusNameFieldState]);
|
||||||
|
|
||||||
if (!isOpened) {
|
if (!isOpened) {
|
||||||
return React.cloneElement(children, {
|
return React.cloneElement(children, {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import React, { useCallback, useRef } from 'react';
|
import React, { useCallback, useRef } from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { Draggable } from 'react-beautiful-dnd';
|
||||||
import { Button, Checkbox, Icon } from 'semantic-ui-react';
|
import { Button, Checkbox, Icon } from 'semantic-ui-react';
|
||||||
|
|
||||||
import NameEdit from './NameEdit';
|
import NameEdit from './NameEdit';
|
||||||
@@ -8,72 +10,85 @@ import ActionsPopup from './ActionsPopup';
|
|||||||
|
|
||||||
import styles from './Item.module.scss';
|
import styles from './Item.module.scss';
|
||||||
|
|
||||||
const Item = React.memo(({ name, isCompleted, isPersisted, canEdit, onUpdate, onDelete }) => {
|
const Item = React.memo(
|
||||||
const nameEdit = useRef(null);
|
({ id, index, name, isCompleted, isPersisted, canEdit, onUpdate, onDelete }) => {
|
||||||
|
const nameEdit = useRef(null);
|
||||||
|
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => {
|
||||||
if (isPersisted && canEdit) {
|
if (isPersisted && canEdit) {
|
||||||
nameEdit.current.open();
|
nameEdit.current.open();
|
||||||
}
|
}
|
||||||
}, [isPersisted, canEdit]);
|
}, [isPersisted, canEdit]);
|
||||||
|
|
||||||
const handleNameUpdate = useCallback(
|
const handleNameUpdate = useCallback(
|
||||||
(newName) => {
|
(newName) => {
|
||||||
|
onUpdate({
|
||||||
|
name: newName,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[onUpdate],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleToggleChange = useCallback(() => {
|
||||||
onUpdate({
|
onUpdate({
|
||||||
name: newName,
|
isCompleted: !isCompleted,
|
||||||
});
|
});
|
||||||
},
|
}, [isCompleted, onUpdate]);
|
||||||
[onUpdate],
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleToggleChange = useCallback(() => {
|
const handleNameEdit = useCallback(() => {
|
||||||
onUpdate({
|
nameEdit.current.open();
|
||||||
isCompleted: !isCompleted,
|
}, []);
|
||||||
});
|
|
||||||
}, [isCompleted, onUpdate]);
|
|
||||||
|
|
||||||
const handleNameEdit = useCallback(() => {
|
return (
|
||||||
nameEdit.current.open();
|
<Draggable draggableId={id} index={index} isDragDisabled={!isPersisted || !canEdit}>
|
||||||
}, []);
|
{({ innerRef, draggableProps, dragHandleProps }, { isDragging }) => {
|
||||||
|
const contentNode = (
|
||||||
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||||
|
<div {...draggableProps} {...dragHandleProps} ref={innerRef} className={styles.wrapper}>
|
||||||
|
<span className={styles.checkboxWrapper}>
|
||||||
|
<Checkbox
|
||||||
|
checked={isCompleted}
|
||||||
|
disabled={!isPersisted || !canEdit}
|
||||||
|
className={styles.checkbox}
|
||||||
|
onChange={handleToggleChange}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<NameEdit ref={nameEdit} defaultValue={name} onUpdate={handleNameUpdate}>
|
||||||
|
<div className={classNames(canEdit && styles.contentHoverable)}>
|
||||||
|
{/* eslint-disable jsx-a11y/click-events-have-key-events,
|
||||||
|
jsx-a11y/no-static-element-interactions */}
|
||||||
|
<span
|
||||||
|
className={classNames(styles.text, canEdit && styles.textEditable)}
|
||||||
|
onClick={handleClick}
|
||||||
|
>
|
||||||
|
{/* eslint-enable jsx-a11y/click-events-have-key-events,
|
||||||
|
jsx-a11y/no-static-element-interactions */}
|
||||||
|
<span className={classNames(styles.task, isCompleted && styles.taskCompleted)}>
|
||||||
|
{name}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
{isPersisted && canEdit && (
|
||||||
|
<ActionsPopup onNameEdit={handleNameEdit} onDelete={onDelete}>
|
||||||
|
<Button className={classNames(styles.button, styles.target)}>
|
||||||
|
<Icon fitted name="pencil" size="small" />
|
||||||
|
</Button>
|
||||||
|
</ActionsPopup>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</NameEdit>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return isDragging ? ReactDOM.createPortal(contentNode, document.body) : contentNode;
|
||||||
<div className={styles.wrapper}>
|
}}
|
||||||
<span className={styles.checkboxWrapper}>
|
</Draggable>
|
||||||
<Checkbox
|
);
|
||||||
checked={isCompleted}
|
},
|
||||||
disabled={!isPersisted || !canEdit}
|
);
|
||||||
className={styles.checkbox}
|
|
||||||
onChange={handleToggleChange}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
<NameEdit ref={nameEdit} defaultValue={name} onUpdate={handleNameUpdate}>
|
|
||||||
<div className={classNames(canEdit && styles.contentHoverable)}>
|
|
||||||
{/* eslint-disable jsx-a11y/click-events-have-key-events,
|
|
||||||
jsx-a11y/no-static-element-interactions */}
|
|
||||||
<span
|
|
||||||
className={classNames(styles.text, canEdit && styles.textEditable)}
|
|
||||||
onClick={handleClick}
|
|
||||||
>
|
|
||||||
{/* eslint-enable jsx-a11y/click-events-have-key-events,
|
|
||||||
jsx-a11y/no-static-element-interactions */}
|
|
||||||
<span className={classNames(styles.task, isCompleted && styles.taskCompleted)}>
|
|
||||||
{name}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
{isPersisted && canEdit && (
|
|
||||||
<ActionsPopup onNameEdit={handleNameEdit} onDelete={onDelete}>
|
|
||||||
<Button className={classNames(styles.button, styles.target)}>
|
|
||||||
<Icon fitted name="pencil" size="small" />
|
|
||||||
</Button>
|
|
||||||
</ActionsPopup>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</NameEdit>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
Item.propTypes = {
|
Item.propTypes = {
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
index: PropTypes.number.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
isCompleted: PropTypes.bool.isRequired,
|
isCompleted: PropTypes.bool.isRequired,
|
||||||
isPersisted: PropTypes.bool.isRequired,
|
isPersisted: PropTypes.bool.isRequired,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
z-index: 2000;
|
z-index: 2000;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
height: 32px;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contentHoverable:hover {
|
.contentHoverable:hover {
|
||||||
@@ -69,10 +69,10 @@
|
|||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
cursor: auto;
|
||||||
margin-left: -40px;
|
margin-left: -40px;
|
||||||
min-height: 32px;
|
min-height: 32px;
|
||||||
position: relative;
|
position: relative;
|
||||||
transition: all 0.14s ease-in;
|
|
||||||
width: calc(100% + 40px);
|
width: calc(100% + 40px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
field.current.ref.current.select();
|
field.current.ref.current.focus();
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,34 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
|
||||||
import { Progress } from 'semantic-ui-react';
|
import { Progress } from 'semantic-ui-react';
|
||||||
|
import { closePopup } from '../../../lib/popup';
|
||||||
|
|
||||||
|
import DroppableTypes from '../../../constants/DroppableTypes';
|
||||||
import Item from './Item';
|
import Item from './Item';
|
||||||
import Add from './Add';
|
import Add from './Add';
|
||||||
|
|
||||||
import styles from './Tasks.module.scss';
|
import styles from './Tasks.module.scss';
|
||||||
|
|
||||||
const Tasks = React.memo(({ items, canEdit, onCreate, onUpdate, onDelete }) => {
|
const Tasks = React.memo(({ items, canEdit, onCreate, onUpdate, onMove, onDelete }) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
|
||||||
|
const handleDragStart = useCallback(() => {
|
||||||
|
closePopup();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleDragEnd = useCallback(
|
||||||
|
({ draggableId, source, destination }) => {
|
||||||
|
if (!destination || source.index === destination.index) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
onMove(draggableId, destination.index);
|
||||||
|
},
|
||||||
|
[onMove],
|
||||||
|
);
|
||||||
|
|
||||||
const handleUpdate = useCallback(
|
const handleUpdate = useCallback(
|
||||||
(id, data) => {
|
(id, data) => {
|
||||||
onUpdate(id, data);
|
onUpdate(id, data);
|
||||||
@@ -39,26 +57,38 @@ const Tasks = React.memo(({ items, canEdit, onCreate, onUpdate, onDelete }) => {
|
|||||||
className={styles.progress}
|
className={styles.progress}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{items.map((item) => (
|
<DragDropContext onDragStart={handleDragStart} onDragEnd={handleDragEnd}>
|
||||||
<Item
|
<Droppable droppableId="tasks" type={DroppableTypes.TASK}>
|
||||||
key={item.id}
|
{({ innerRef, droppableProps, placeholder }) => (
|
||||||
name={item.name}
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||||
isCompleted={item.isCompleted}
|
<div {...droppableProps} ref={innerRef}>
|
||||||
isPersisted={item.isPersisted}
|
{items.map((item, index) => (
|
||||||
canEdit={canEdit}
|
<Item
|
||||||
onUpdate={(data) => handleUpdate(item.id, data)}
|
key={item.id}
|
||||||
onDelete={() => handleDelete(item.id)}
|
id={item.id}
|
||||||
/>
|
index={index}
|
||||||
))}
|
name={item.name}
|
||||||
{canEdit && (
|
isCompleted={item.isCompleted}
|
||||||
<Add onCreate={onCreate}>
|
isPersisted={item.isPersisted}
|
||||||
<button type="button" className={styles.taskButton}>
|
canEdit={canEdit}
|
||||||
<span className={styles.taskButtonText}>
|
onUpdate={(data) => handleUpdate(item.id, data)}
|
||||||
{items.length > 0 ? t('action.addAnotherTask') : t('action.addTask')}
|
onDelete={() => handleDelete(item.id)}
|
||||||
</span>
|
/>
|
||||||
</button>
|
))}
|
||||||
</Add>
|
{placeholder}
|
||||||
)}
|
{canEdit && (
|
||||||
|
<Add onCreate={onCreate}>
|
||||||
|
<button type="button" className={styles.taskButton}>
|
||||||
|
<span className={styles.taskButtonText}>
|
||||||
|
{items.length > 0 ? t('action.addAnotherTask') : t('action.addTask')}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</Add>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Droppable>
|
||||||
|
</DragDropContext>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -68,6 +98,7 @@ Tasks.propTypes = {
|
|||||||
canEdit: PropTypes.bool.isRequired,
|
canEdit: PropTypes.bool.isRequired,
|
||||||
onCreate: PropTypes.func.isRequired,
|
onCreate: PropTypes.func.isRequired,
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
|
onMove: PropTypes.func.isRequired,
|
||||||
onDelete: PropTypes.func.isRequired,
|
onDelete: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const DEFAULT_DATA = {
|
|||||||
const CardAdd = React.memo(({ isOpened, onCreate, onClose }) => {
|
const CardAdd = React.memo(({ isOpened, onCreate, onClose }) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
|
||||||
const [selectNameFieldState, selectNameField] = useToggle();
|
const [focusNameFieldState, focusNameField] = useToggle();
|
||||||
|
|
||||||
const nameField = useRef(null);
|
const nameField = useRef(null);
|
||||||
|
|
||||||
@@ -35,8 +35,8 @@ const CardAdd = React.memo(({ isOpened, onCreate, onClose }) => {
|
|||||||
onCreate(cleanData);
|
onCreate(cleanData);
|
||||||
|
|
||||||
setData(DEFAULT_DATA);
|
setData(DEFAULT_DATA);
|
||||||
selectNameField();
|
focusNameField();
|
||||||
}, [onCreate, data, setData, selectNameField]);
|
}, [onCreate, data, setData, focusNameField]);
|
||||||
|
|
||||||
const handleFieldKeyDown = useCallback(
|
const handleFieldKeyDown = useCallback(
|
||||||
(event) => {
|
(event) => {
|
||||||
@@ -65,13 +65,13 @@ const CardAdd = React.memo(({ isOpened, onCreate, onClose }) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
nameField.current.ref.current.select();
|
nameField.current.ref.current.focus();
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
useDidUpdate(() => {
|
useDidUpdate(() => {
|
||||||
nameField.current.ref.current.select();
|
nameField.current.ref.current.focus();
|
||||||
}, [selectNameFieldState]);
|
}, [focusNameFieldState]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ const Login = React.memo(
|
|||||||
}, [onAuthenticate, data]);
|
}, [onAuthenticate, data]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
emailOrUsernameField.current.select();
|
emailOrUsernameField.current.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const ProjectAddModal = React.memo(({ defaultData, isSubmitting, onCreate, onClo
|
|||||||
}, [onCreate, data]);
|
}, [onCreate, data]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
nameField.current.select();
|
nameField.current.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import CoreWrapperContainer from '../containers/CoreWrapperContainer';
|
|||||||
import NotFound from './NotFound';
|
import NotFound from './NotFound';
|
||||||
|
|
||||||
import 'react-datepicker/dist/react-datepicker.css';
|
import 'react-datepicker/dist/react-datepicker.css';
|
||||||
|
import 'photoswipe/dist/photoswipe.css';
|
||||||
import '../lib/custom-ui/styles.css';
|
import '../lib/custom-ui/styles.css';
|
||||||
|
|
||||||
import '../styles.module.scss';
|
import '../styles.module.scss';
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const createData = (timer) => {
|
|||||||
const TimerEditStep = React.memo(({ defaultValue, onUpdate, onBack, onClose }) => {
|
const TimerEditStep = React.memo(({ defaultValue, onUpdate, onBack, onClose }) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
const [data, handleFieldChange, setData] = useForm(() => createData(defaultValue));
|
const [data, handleFieldChange, setData] = useForm(() => createData(defaultValue));
|
||||||
const [isEditing, toggleEdit] = useToggle();
|
const [isEditing, toggleEditing] = useToggle();
|
||||||
|
|
||||||
const hoursField = useRef(null);
|
const hoursField = useRef(null);
|
||||||
const minutesField = useRef(null);
|
const minutesField = useRef(null);
|
||||||
@@ -55,10 +55,10 @@ const TimerEditStep = React.memo(({ defaultValue, onUpdate, onBack, onClose }) =
|
|||||||
onClose();
|
onClose();
|
||||||
}, [defaultValue, onUpdate, onClose]);
|
}, [defaultValue, onUpdate, onClose]);
|
||||||
|
|
||||||
const handleToggleEditClick = useCallback(() => {
|
const handleToggleEditingClick = useCallback(() => {
|
||||||
setData(createData(defaultValue));
|
setData(createData(defaultValue));
|
||||||
toggleEdit();
|
toggleEditing();
|
||||||
}, [defaultValue, setData, toggleEdit]);
|
}, [defaultValue, setData, toggleEditing]);
|
||||||
|
|
||||||
const handleSubmit = useCallback(() => {
|
const handleSubmit = useCallback(() => {
|
||||||
const parts = {
|
const parts = {
|
||||||
@@ -149,7 +149,7 @@ const TimerEditStep = React.memo(({ defaultValue, onUpdate, onBack, onClose }) =
|
|||||||
type="button"
|
type="button"
|
||||||
icon={isEditing ? 'close' : 'edit'}
|
icon={isEditing ? 'close' : 'edit'}
|
||||||
className={styles.iconButton}
|
className={styles.iconButton}
|
||||||
onClick={handleToggleEditClick}
|
onClick={handleToggleEditingClick}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{isEditing && <Button positive content={t('action.save')} />}
|
{isEditing && <Button positive content={t('action.save')} />}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ const UserAddStep = React.memo(
|
|||||||
}, [onCreate, data]);
|
}, [onCreate, data]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
emailField.current.select();
|
emailField.current.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { withPopup } from '../lib/popup';
|
||||||
|
|
||||||
|
import UserEmailEditStep from './UserEmailEditStep';
|
||||||
|
|
||||||
|
export default withPopup(UserEmailEditStep);
|
||||||
+42
-24
@@ -1,15 +1,15 @@
|
|||||||
|
import omit from 'lodash/omit';
|
||||||
import isEmail from 'validator/lib/isEmail';
|
import isEmail from 'validator/lib/isEmail';
|
||||||
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Button, Form, Message } from 'semantic-ui-react';
|
import { Button, Form, Message } from 'semantic-ui-react';
|
||||||
import { useDidUpdate, usePrevious, useToggle } from '../../../lib/hooks';
|
import { useDidUpdate, usePrevious, useToggle } from '../../lib/hooks';
|
||||||
import { withPopup } from '../../../lib/popup';
|
import { Input, Popup } from '../../lib/custom-ui';
|
||||||
import { Input, Popup } from '../../../lib/custom-ui';
|
|
||||||
|
|
||||||
import { useForm } from '../../../hooks';
|
import { useForm } from '../../hooks';
|
||||||
|
|
||||||
import styles from './EmailEditPopup.module.scss';
|
import styles from './UserEmailEditStep.module.scss';
|
||||||
|
|
||||||
const createMessage = (error) => {
|
const createMessage = (error) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
@@ -35,8 +35,18 @@ const createMessage = (error) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const EmailEditStep = React.memo(
|
const UserEmailEditStep = React.memo(
|
||||||
({ defaultData, email, isSubmitting, error, onUpdate, onMessageDismiss, onClose }) => {
|
({
|
||||||
|
defaultData,
|
||||||
|
email,
|
||||||
|
isSubmitting,
|
||||||
|
error,
|
||||||
|
usePasswordConfirmation,
|
||||||
|
onUpdate,
|
||||||
|
onMessageDismiss,
|
||||||
|
onBack,
|
||||||
|
onClose,
|
||||||
|
}) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
const wasSubmitting = usePrevious(isSubmitting);
|
const wasSubmitting = usePrevious(isSubmitting);
|
||||||
|
|
||||||
@@ -68,16 +78,16 @@ const EmailEditStep = React.memo(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cleanData.currentPassword) {
|
if (usePasswordConfirmation && !cleanData.currentPassword) {
|
||||||
currentPasswordField.current.focus();
|
currentPasswordField.current.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdate(cleanData);
|
onUpdate(usePasswordConfirmation ? cleanData : omit(cleanData, 'currentPassword'));
|
||||||
}, [email, onUpdate, onClose, data]);
|
}, [email, usePasswordConfirmation, onUpdate, onClose, data]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
emailField.current.select();
|
emailField.current.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -110,7 +120,7 @@ const EmailEditStep = React.memo(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Popup.Header>
|
<Popup.Header onBack={onBack}>
|
||||||
{t('common.editEmail', {
|
{t('common.editEmail', {
|
||||||
context: 'title',
|
context: 'title',
|
||||||
})}
|
})}
|
||||||
@@ -138,15 +148,19 @@ const EmailEditStep = React.memo(
|
|||||||
className={styles.field}
|
className={styles.field}
|
||||||
onChange={handleFieldChange}
|
onChange={handleFieldChange}
|
||||||
/>
|
/>
|
||||||
<div className={styles.text}>{t('common.currentPassword')}</div>
|
{usePasswordConfirmation && (
|
||||||
<Input.Password
|
<>
|
||||||
fluid
|
<div className={styles.text}>{t('common.currentPassword')}</div>
|
||||||
ref={currentPasswordField}
|
<Input.Password
|
||||||
name="currentPassword"
|
fluid
|
||||||
value={data.currentPassword}
|
ref={currentPasswordField}
|
||||||
className={styles.field}
|
name="currentPassword"
|
||||||
onChange={handleFieldChange}
|
value={data.currentPassword}
|
||||||
/>
|
className={styles.field}
|
||||||
|
onChange={handleFieldChange}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
positive
|
positive
|
||||||
content={t('action.save')}
|
content={t('action.save')}
|
||||||
@@ -160,18 +174,22 @@ const EmailEditStep = React.memo(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
EmailEditStep.propTypes = {
|
UserEmailEditStep.propTypes = {
|
||||||
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
email: PropTypes.string.isRequired,
|
email: PropTypes.string.isRequired,
|
||||||
isSubmitting: PropTypes.bool.isRequired,
|
isSubmitting: PropTypes.bool.isRequired,
|
||||||
error: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
error: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
||||||
|
usePasswordConfirmation: PropTypes.bool,
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
onMessageDismiss: PropTypes.func.isRequired,
|
onMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onBack: PropTypes.func,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
EmailEditStep.defaultProps = {
|
UserEmailEditStep.defaultProps = {
|
||||||
error: undefined,
|
error: undefined,
|
||||||
|
usePasswordConfirmation: false,
|
||||||
|
onBack: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withPopup(EmailEditStep);
|
export default UserEmailEditStep;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import UserEmailEditStep from './UserEmailEditStep';
|
||||||
|
|
||||||
|
export default UserEmailEditStep;
|
||||||
+5
-5
@@ -5,11 +5,11 @@ import PropTypes from 'prop-types';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Button, Form, Input } from 'semantic-ui-react';
|
import { Button, Form, Input } from 'semantic-ui-react';
|
||||||
|
|
||||||
import { useForm } from '../../../hooks';
|
import { useForm } from '../../hooks';
|
||||||
|
|
||||||
import styles from './InformationEdit.module.scss';
|
import styles from './UserInformationEdit.module.scss';
|
||||||
|
|
||||||
const InformationEdit = React.memo(({ defaultData, onUpdate }) => {
|
const UserInformationEdit = React.memo(({ defaultData, onUpdate }) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
|
||||||
const [data, handleFieldChange] = useForm(() => ({
|
const [data, handleFieldChange] = useForm(() => ({
|
||||||
@@ -72,9 +72,9 @@ const InformationEdit = React.memo(({ defaultData, onUpdate }) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
InformationEdit.propTypes = {
|
UserInformationEdit.propTypes = {
|
||||||
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default InformationEdit;
|
export default UserInformationEdit;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import UserInformationEdit from './UserInformationEdit';
|
||||||
|
|
||||||
|
export default UserInformationEdit;
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { Popup } from '../lib/custom-ui';
|
||||||
|
|
||||||
|
import UserInformationEdit from './UserInformationEdit';
|
||||||
|
|
||||||
|
const UserInformationEditStep = React.memo(({ defaultData, onUpdate, onBack, onClose }) => {
|
||||||
|
const [t] = useTranslation();
|
||||||
|
|
||||||
|
const handleUpdate = useCallback(
|
||||||
|
(data) => {
|
||||||
|
onUpdate(data);
|
||||||
|
onClose();
|
||||||
|
},
|
||||||
|
[onUpdate, onClose],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Popup.Header onBack={onBack}>
|
||||||
|
{t('common.editInformation', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Popup.Header>
|
||||||
|
<Popup.Content>
|
||||||
|
<UserInformationEdit defaultData={defaultData} onUpdate={handleUpdate} />
|
||||||
|
</Popup.Content>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
UserInformationEditStep.propTypes = {
|
||||||
|
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
|
onUpdate: PropTypes.func.isRequired,
|
||||||
|
onBack: PropTypes.func,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
UserInformationEditStep.defaultProps = {
|
||||||
|
onBack: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default UserInformationEditStep;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { withPopup } from '../lib/popup';
|
||||||
|
|
||||||
|
import UserPasswordEditStep from './UserPasswordEditStep';
|
||||||
|
|
||||||
|
export default withPopup(UserPasswordEditStep);
|
||||||
+41
-24
@@ -1,14 +1,14 @@
|
|||||||
|
import omit from 'lodash/omit';
|
||||||
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Button, Form, Message } from 'semantic-ui-react';
|
import { Button, Form, Message } from 'semantic-ui-react';
|
||||||
import { useDidUpdate, usePrevious, useToggle } from '../../../lib/hooks';
|
import { useDidUpdate, usePrevious, useToggle } from '../../lib/hooks';
|
||||||
import { withPopup } from '../../../lib/popup';
|
import { Input, Popup } from '../../lib/custom-ui';
|
||||||
import { Input, Popup } from '../../../lib/custom-ui';
|
|
||||||
|
|
||||||
import { useForm } from '../../../hooks';
|
import { useForm } from '../../hooks';
|
||||||
|
|
||||||
import styles from './PasswordEditPopup.module.scss';
|
import styles from './UserPasswordEditStep.module.scss';
|
||||||
|
|
||||||
const createMessage = (error) => {
|
const createMessage = (error) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
@@ -29,8 +29,17 @@ const createMessage = (error) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const PasswordEditStep = React.memo(
|
const UserPasswordEditStep = React.memo(
|
||||||
({ defaultData, isSubmitting, error, onUpdate, onMessageDismiss, onClose }) => {
|
({
|
||||||
|
defaultData,
|
||||||
|
isSubmitting,
|
||||||
|
error,
|
||||||
|
usePasswordConfirmation,
|
||||||
|
onUpdate,
|
||||||
|
onMessageDismiss,
|
||||||
|
onBack,
|
||||||
|
onClose,
|
||||||
|
}) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
const wasSubmitting = usePrevious(isSubmitting);
|
const wasSubmitting = usePrevious(isSubmitting);
|
||||||
|
|
||||||
@@ -52,16 +61,16 @@ const PasswordEditStep = React.memo(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.currentPassword) {
|
if (usePasswordConfirmation && !data.currentPassword) {
|
||||||
currentPasswordField.current.focus();
|
currentPasswordField.current.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdate(data);
|
onUpdate(usePasswordConfirmation ? data : omit(data, 'currentPassword'));
|
||||||
}, [onUpdate, data]);
|
}, [usePasswordConfirmation, onUpdate, data]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
passwordField.current.select();
|
passwordField.current.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -84,7 +93,7 @@ const PasswordEditStep = React.memo(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Popup.Header>
|
<Popup.Header onBack={onBack}>
|
||||||
{t('common.editPassword', {
|
{t('common.editPassword', {
|
||||||
context: 'title',
|
context: 'title',
|
||||||
})}
|
})}
|
||||||
@@ -111,15 +120,19 @@ const PasswordEditStep = React.memo(
|
|||||||
className={styles.field}
|
className={styles.field}
|
||||||
onChange={handleFieldChange}
|
onChange={handleFieldChange}
|
||||||
/>
|
/>
|
||||||
<div className={styles.text}>{t('common.currentPassword')}</div>
|
{usePasswordConfirmation && (
|
||||||
<Input.Password
|
<>
|
||||||
fluid
|
<div className={styles.text}>{t('common.currentPassword')}</div>
|
||||||
ref={currentPasswordField}
|
<Input.Password
|
||||||
name="currentPassword"
|
fluid
|
||||||
value={data.currentPassword}
|
ref={currentPasswordField}
|
||||||
className={styles.field}
|
name="currentPassword"
|
||||||
onChange={handleFieldChange}
|
value={data.currentPassword}
|
||||||
/>
|
className={styles.field}
|
||||||
|
onChange={handleFieldChange}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
positive
|
positive
|
||||||
content={t('action.save')}
|
content={t('action.save')}
|
||||||
@@ -133,17 +146,21 @@ const PasswordEditStep = React.memo(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
PasswordEditStep.propTypes = {
|
UserPasswordEditStep.propTypes = {
|
||||||
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
isSubmitting: PropTypes.bool.isRequired,
|
isSubmitting: PropTypes.bool.isRequired,
|
||||||
error: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
error: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
||||||
|
usePasswordConfirmation: PropTypes.bool,
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
onMessageDismiss: PropTypes.func.isRequired,
|
onMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onBack: PropTypes.func,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
PasswordEditStep.defaultProps = {
|
UserPasswordEditStep.defaultProps = {
|
||||||
error: undefined,
|
error: undefined,
|
||||||
|
usePasswordConfirmation: false,
|
||||||
|
onBack: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withPopup(PasswordEditStep);
|
export default UserPasswordEditStep;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import UserPasswordEditStep from './UserPasswordEditStep';
|
||||||
|
|
||||||
|
export default UserPasswordEditStep;
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Button, Divider, Header, Tab } from 'semantic-ui-react';
|
import { Button, Divider, Dropdown, Header, Tab } from 'semantic-ui-react';
|
||||||
|
|
||||||
import InformationEdit from './InformationEdit';
|
import locales from '../../../locales';
|
||||||
import AvatarEditPopup from './AvatarEditPopup';
|
import AvatarEditPopup from './AvatarEditPopup';
|
||||||
import UsernameEditPopup from './UsernameEditPopup';
|
|
||||||
import EmailEditPopup from './EmailEditPopup';
|
|
||||||
import PasswordEditPopup from './PasswordEditPopup';
|
|
||||||
import User from '../../User';
|
import User from '../../User';
|
||||||
|
import UserInformationEdit from '../../UserInformationEdit';
|
||||||
|
import UserUsernameEditPopup from '../../UserUsernameEditPopup';
|
||||||
|
import UserEmailEditPopup from '../../UserEmailEditPopup';
|
||||||
|
import UserPasswordEditPopup from '../../UserPasswordEditPopup';
|
||||||
|
|
||||||
import styles from './AccountPane.module.scss';
|
import styles from './AccountPane.module.scss';
|
||||||
|
|
||||||
@@ -20,12 +21,14 @@ const AccountPane = React.memo(
|
|||||||
avatarUrl,
|
avatarUrl,
|
||||||
phone,
|
phone,
|
||||||
organization,
|
organization,
|
||||||
|
language,
|
||||||
isAvatarUpdating,
|
isAvatarUpdating,
|
||||||
usernameUpdateForm,
|
usernameUpdateForm,
|
||||||
emailUpdateForm,
|
emailUpdateForm,
|
||||||
passwordUpdateForm,
|
passwordUpdateForm,
|
||||||
onUpdate,
|
onUpdate,
|
||||||
onAvatarUpdate,
|
onAvatarUpdate,
|
||||||
|
onLanguageUpdate,
|
||||||
onUsernameUpdate,
|
onUsernameUpdate,
|
||||||
onUsernameUpdateMessageDismiss,
|
onUsernameUpdateMessageDismiss,
|
||||||
onEmailUpdate,
|
onEmailUpdate,
|
||||||
@@ -41,6 +44,13 @@ const AccountPane = React.memo(
|
|||||||
});
|
});
|
||||||
}, [onUpdate]);
|
}, [onUpdate]);
|
||||||
|
|
||||||
|
const handleLanguageChange = useCallback(
|
||||||
|
(_, { value }) => {
|
||||||
|
onLanguageUpdate(value === 'auto' ? null : value); // FIXME: hack
|
||||||
|
},
|
||||||
|
[onLanguageUpdate],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tab.Pane attached={false} className={styles.wrapper}>
|
<Tab.Pane attached={false} className={styles.wrapper}>
|
||||||
<AvatarEditPopup
|
<AvatarEditPopup
|
||||||
@@ -52,7 +62,7 @@ const AccountPane = React.memo(
|
|||||||
</AvatarEditPopup>
|
</AvatarEditPopup>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<InformationEdit
|
<UserInformationEdit
|
||||||
defaultData={{
|
defaultData={{
|
||||||
name,
|
name,
|
||||||
phone,
|
phone,
|
||||||
@@ -60,6 +70,32 @@ const AccountPane = React.memo(
|
|||||||
}}
|
}}
|
||||||
onUpdate={onUpdate}
|
onUpdate={onUpdate}
|
||||||
/>
|
/>
|
||||||
|
<Divider horizontal section>
|
||||||
|
<Header as="h4">
|
||||||
|
{t('common.language', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Header>
|
||||||
|
</Divider>
|
||||||
|
<Dropdown
|
||||||
|
fluid
|
||||||
|
selection
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
key: 'auto',
|
||||||
|
value: 'auto',
|
||||||
|
text: t('common.detectAutomatically'),
|
||||||
|
},
|
||||||
|
...locales.map((locale) => ({
|
||||||
|
key: locale.language,
|
||||||
|
value: locale.language,
|
||||||
|
flag: locale.country,
|
||||||
|
text: locale.name,
|
||||||
|
})),
|
||||||
|
]}
|
||||||
|
value={language || 'auto'}
|
||||||
|
onChange={handleLanguageChange}
|
||||||
|
/>
|
||||||
<Divider horizontal section>
|
<Divider horizontal section>
|
||||||
<Header as="h4">
|
<Header as="h4">
|
||||||
{t('common.authentication', {
|
{t('common.authentication', {
|
||||||
@@ -68,7 +104,8 @@ const AccountPane = React.memo(
|
|||||||
</Header>
|
</Header>
|
||||||
</Divider>
|
</Divider>
|
||||||
<div className={styles.action}>
|
<div className={styles.action}>
|
||||||
<UsernameEditPopup
|
<UserUsernameEditPopup
|
||||||
|
usePasswordConfirmation
|
||||||
defaultData={usernameUpdateForm.data}
|
defaultData={usernameUpdateForm.data}
|
||||||
username={username}
|
username={username}
|
||||||
isSubmitting={usernameUpdateForm.isSubmitting}
|
isSubmitting={usernameUpdateForm.isSubmitting}
|
||||||
@@ -81,10 +118,11 @@ const AccountPane = React.memo(
|
|||||||
context: 'title',
|
context: 'title',
|
||||||
})}
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
</UsernameEditPopup>
|
</UserUsernameEditPopup>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.action}>
|
<div className={styles.action}>
|
||||||
<EmailEditPopup
|
<UserEmailEditPopup
|
||||||
|
usePasswordConfirmation
|
||||||
defaultData={emailUpdateForm.data}
|
defaultData={emailUpdateForm.data}
|
||||||
email={email}
|
email={email}
|
||||||
isSubmitting={emailUpdateForm.isSubmitting}
|
isSubmitting={emailUpdateForm.isSubmitting}
|
||||||
@@ -97,10 +135,11 @@ const AccountPane = React.memo(
|
|||||||
context: 'title',
|
context: 'title',
|
||||||
})}
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
</EmailEditPopup>
|
</UserEmailEditPopup>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.action}>
|
<div className={styles.action}>
|
||||||
<PasswordEditPopup
|
<UserPasswordEditPopup
|
||||||
|
usePasswordConfirmation
|
||||||
defaultData={passwordUpdateForm.data}
|
defaultData={passwordUpdateForm.data}
|
||||||
isSubmitting={passwordUpdateForm.isSubmitting}
|
isSubmitting={passwordUpdateForm.isSubmitting}
|
||||||
error={passwordUpdateForm.error}
|
error={passwordUpdateForm.error}
|
||||||
@@ -112,7 +151,7 @@ const AccountPane = React.memo(
|
|||||||
context: 'title',
|
context: 'title',
|
||||||
})}
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
</PasswordEditPopup>
|
</UserPasswordEditPopup>
|
||||||
</div>
|
</div>
|
||||||
</Tab.Pane>
|
</Tab.Pane>
|
||||||
);
|
);
|
||||||
@@ -126,6 +165,7 @@ AccountPane.propTypes = {
|
|||||||
avatarUrl: PropTypes.string,
|
avatarUrl: PropTypes.string,
|
||||||
phone: PropTypes.string,
|
phone: PropTypes.string,
|
||||||
organization: PropTypes.string,
|
organization: PropTypes.string,
|
||||||
|
language: PropTypes.string,
|
||||||
isAvatarUpdating: PropTypes.bool.isRequired,
|
isAvatarUpdating: PropTypes.bool.isRequired,
|
||||||
/* eslint-disable react/forbid-prop-types */
|
/* eslint-disable react/forbid-prop-types */
|
||||||
usernameUpdateForm: PropTypes.object.isRequired,
|
usernameUpdateForm: PropTypes.object.isRequired,
|
||||||
@@ -134,6 +174,7 @@ AccountPane.propTypes = {
|
|||||||
/* eslint-enable react/forbid-prop-types */
|
/* eslint-enable react/forbid-prop-types */
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
onAvatarUpdate: PropTypes.func.isRequired,
|
onAvatarUpdate: PropTypes.func.isRequired,
|
||||||
|
onLanguageUpdate: PropTypes.func.isRequired,
|
||||||
onUsernameUpdate: PropTypes.func.isRequired,
|
onUsernameUpdate: PropTypes.func.isRequired,
|
||||||
onUsernameUpdateMessageDismiss: PropTypes.func.isRequired,
|
onUsernameUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
onEmailUpdate: PropTypes.func.isRequired,
|
onEmailUpdate: PropTypes.func.isRequired,
|
||||||
@@ -147,6 +188,7 @@ AccountPane.defaultProps = {
|
|||||||
avatarUrl: undefined,
|
avatarUrl: undefined,
|
||||||
phone: undefined,
|
phone: undefined,
|
||||||
organization: undefined,
|
organization: undefined,
|
||||||
|
language: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AccountPane;
|
export default AccountPane;
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
:global(#app) {
|
|
||||||
.field {
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,6 +14,7 @@ const UserSettingsModal = React.memo(
|
|||||||
avatarUrl,
|
avatarUrl,
|
||||||
phone,
|
phone,
|
||||||
organization,
|
organization,
|
||||||
|
language,
|
||||||
subscribeToOwnCards,
|
subscribeToOwnCards,
|
||||||
isAvatarUpdating,
|
isAvatarUpdating,
|
||||||
usernameUpdateForm,
|
usernameUpdateForm,
|
||||||
@@ -21,6 +22,7 @@ const UserSettingsModal = React.memo(
|
|||||||
passwordUpdateForm,
|
passwordUpdateForm,
|
||||||
onUpdate,
|
onUpdate,
|
||||||
onAvatarUpdate,
|
onAvatarUpdate,
|
||||||
|
onLanguageUpdate,
|
||||||
onUsernameUpdate,
|
onUsernameUpdate,
|
||||||
onUsernameUpdateMessageDismiss,
|
onUsernameUpdateMessageDismiss,
|
||||||
onEmailUpdate,
|
onEmailUpdate,
|
||||||
@@ -44,12 +46,14 @@ const UserSettingsModal = React.memo(
|
|||||||
avatarUrl={avatarUrl}
|
avatarUrl={avatarUrl}
|
||||||
phone={phone}
|
phone={phone}
|
||||||
organization={organization}
|
organization={organization}
|
||||||
|
language={language}
|
||||||
isAvatarUpdating={isAvatarUpdating}
|
isAvatarUpdating={isAvatarUpdating}
|
||||||
usernameUpdateForm={usernameUpdateForm}
|
usernameUpdateForm={usernameUpdateForm}
|
||||||
emailUpdateForm={emailUpdateForm}
|
emailUpdateForm={emailUpdateForm}
|
||||||
passwordUpdateForm={passwordUpdateForm}
|
passwordUpdateForm={passwordUpdateForm}
|
||||||
onUpdate={onUpdate}
|
onUpdate={onUpdate}
|
||||||
onAvatarUpdate={onAvatarUpdate}
|
onAvatarUpdate={onAvatarUpdate}
|
||||||
|
onLanguageUpdate={onLanguageUpdate}
|
||||||
onUsernameUpdate={onUsernameUpdate}
|
onUsernameUpdate={onUsernameUpdate}
|
||||||
onUsernameUpdateMessageDismiss={onUsernameUpdateMessageDismiss}
|
onUsernameUpdateMessageDismiss={onUsernameUpdateMessageDismiss}
|
||||||
onEmailUpdate={onEmailUpdate}
|
onEmailUpdate={onEmailUpdate}
|
||||||
@@ -92,6 +96,7 @@ UserSettingsModal.propTypes = {
|
|||||||
avatarUrl: PropTypes.string,
|
avatarUrl: PropTypes.string,
|
||||||
phone: PropTypes.string,
|
phone: PropTypes.string,
|
||||||
organization: PropTypes.string,
|
organization: PropTypes.string,
|
||||||
|
language: PropTypes.string,
|
||||||
subscribeToOwnCards: PropTypes.bool.isRequired,
|
subscribeToOwnCards: PropTypes.bool.isRequired,
|
||||||
isAvatarUpdating: PropTypes.bool.isRequired,
|
isAvatarUpdating: PropTypes.bool.isRequired,
|
||||||
/* eslint-disable react/forbid-prop-types */
|
/* eslint-disable react/forbid-prop-types */
|
||||||
@@ -101,6 +106,7 @@ UserSettingsModal.propTypes = {
|
|||||||
/* eslint-enable react/forbid-prop-types */
|
/* eslint-enable react/forbid-prop-types */
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
onAvatarUpdate: PropTypes.func.isRequired,
|
onAvatarUpdate: PropTypes.func.isRequired,
|
||||||
|
onLanguageUpdate: PropTypes.func.isRequired,
|
||||||
onUsernameUpdate: PropTypes.func.isRequired,
|
onUsernameUpdate: PropTypes.func.isRequired,
|
||||||
onUsernameUpdateMessageDismiss: PropTypes.func.isRequired,
|
onUsernameUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
onEmailUpdate: PropTypes.func.isRequired,
|
onEmailUpdate: PropTypes.func.isRequired,
|
||||||
@@ -115,6 +121,7 @@ UserSettingsModal.defaultProps = {
|
|||||||
avatarUrl: undefined,
|
avatarUrl: undefined,
|
||||||
phone: undefined,
|
phone: undefined,
|
||||||
organization: undefined,
|
organization: undefined,
|
||||||
|
language: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default UserSettingsModal;
|
export default UserSettingsModal;
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { withPopup } from '../lib/popup';
|
||||||
|
|
||||||
|
import UserUsernameEditStep from './UserUsernameEditStep';
|
||||||
|
|
||||||
|
export default withPopup(UserUsernameEditStep);
|
||||||
+44
-26
@@ -1,15 +1,15 @@
|
|||||||
|
import omit from 'lodash/omit';
|
||||||
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Button, Form, Message } from 'semantic-ui-react';
|
import { Button, Form, Message } from 'semantic-ui-react';
|
||||||
import { useDidUpdate, usePrevious, useToggle } from '../../../lib/hooks';
|
import { useDidUpdate, usePrevious, useToggle } from '../../lib/hooks';
|
||||||
import { withPopup } from '../../../lib/popup';
|
import { Input, Popup } from '../../lib/custom-ui';
|
||||||
import { Input, Popup } from '../../../lib/custom-ui';
|
|
||||||
|
|
||||||
import { useForm } from '../../../hooks';
|
import { useForm } from '../../hooks';
|
||||||
import { isUsername } from '../../../utils/validator';
|
import { isUsername } from '../../utils/validator';
|
||||||
|
|
||||||
import styles from './UsernameEditPopup.module.scss';
|
import styles from './UserUsernameEditStep.module.scss';
|
||||||
|
|
||||||
const createMessage = (error) => {
|
const createMessage = (error) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
@@ -35,8 +35,18 @@ const createMessage = (error) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const UsernameEditStep = React.memo(
|
const UserUsernameEditStep = React.memo(
|
||||||
({ defaultData, username, isSubmitting, error, onUpdate, onMessageDismiss, onClose }) => {
|
({
|
||||||
|
defaultData,
|
||||||
|
username,
|
||||||
|
isSubmitting,
|
||||||
|
error,
|
||||||
|
usePasswordConfirmation,
|
||||||
|
onUpdate,
|
||||||
|
onMessageDismiss,
|
||||||
|
onBack,
|
||||||
|
onClose,
|
||||||
|
}) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
const wasSubmitting = usePrevious(isSubmitting);
|
const wasSubmitting = usePrevious(isSubmitting);
|
||||||
|
|
||||||
@@ -58,7 +68,7 @@ const UsernameEditStep = React.memo(
|
|||||||
username: data.username.trim() || null,
|
username: data.username.trim() || null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cleanData.username && !isUsername(cleanData.username)) {
|
if (!cleanData.username || !isUsername(cleanData.username)) {
|
||||||
usernameField.current.select();
|
usernameField.current.select();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -68,16 +78,16 @@ const UsernameEditStep = React.memo(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cleanData.currentPassword) {
|
if (usePasswordConfirmation && !cleanData.currentPassword) {
|
||||||
currentPasswordField.current.focus();
|
currentPasswordField.current.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdate(cleanData);
|
onUpdate(usePasswordConfirmation ? cleanData : omit(cleanData, 'currentPassword'));
|
||||||
}, [username, onUpdate, onClose, data]);
|
}, [username, usePasswordConfirmation, onUpdate, onClose, data]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
usernameField.current.select();
|
usernameField.current.focus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -110,7 +120,7 @@ const UsernameEditStep = React.memo(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Popup.Header>
|
<Popup.Header onBack={onBack}>
|
||||||
{t('common.editUsername', {
|
{t('common.editUsername', {
|
||||||
context: 'title',
|
context: 'title',
|
||||||
})}
|
})}
|
||||||
@@ -138,15 +148,19 @@ const UsernameEditStep = React.memo(
|
|||||||
className={styles.field}
|
className={styles.field}
|
||||||
onChange={handleFieldChange}
|
onChange={handleFieldChange}
|
||||||
/>
|
/>
|
||||||
<div className={styles.text}>{t('common.currentPassword')}</div>
|
{usePasswordConfirmation && (
|
||||||
<Input.Password
|
<>
|
||||||
fluid
|
<div className={styles.text}>{t('common.currentPassword')}</div>
|
||||||
ref={currentPasswordField}
|
<Input.Password
|
||||||
name="currentPassword"
|
fluid
|
||||||
value={data.currentPassword}
|
ref={currentPasswordField}
|
||||||
className={styles.field}
|
name="currentPassword"
|
||||||
onChange={handleFieldChange}
|
value={data.currentPassword}
|
||||||
/>
|
className={styles.field}
|
||||||
|
onChange={handleFieldChange}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
positive
|
positive
|
||||||
content={t('action.save')}
|
content={t('action.save')}
|
||||||
@@ -160,19 +174,23 @@ const UsernameEditStep = React.memo(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
UsernameEditStep.propTypes = {
|
UserUsernameEditStep.propTypes = {
|
||||||
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
username: PropTypes.string,
|
username: PropTypes.string,
|
||||||
isSubmitting: PropTypes.bool.isRequired,
|
isSubmitting: PropTypes.bool.isRequired,
|
||||||
error: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
error: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
||||||
|
usePasswordConfirmation: PropTypes.bool,
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
onMessageDismiss: PropTypes.func.isRequired,
|
onMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onBack: PropTypes.func,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
UsernameEditStep.defaultProps = {
|
UserUsernameEditStep.defaultProps = {
|
||||||
username: undefined,
|
username: undefined,
|
||||||
error: undefined,
|
error: undefined,
|
||||||
|
usePasswordConfirmation: false,
|
||||||
|
onBack: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withPopup(UsernameEditStep);
|
export default UserUsernameEditStep;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
:global(#app) {
|
||||||
|
.field {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: #444444;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import UserUsernameEditStep from './UserUsernameEditStep';
|
||||||
|
|
||||||
|
export default UserUsernameEditStep;
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
import React, { useCallback } from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { Button, Radio, Table } from 'semantic-ui-react';
|
|
||||||
|
|
||||||
import DeletePopup from '../DeletePopup';
|
|
||||||
|
|
||||||
import styles from './Item.module.scss';
|
|
||||||
|
|
||||||
const Item = React.memo(({ name, username, email, isAdmin, onUpdate, onDelete }) => {
|
|
||||||
const [t] = useTranslation();
|
|
||||||
|
|
||||||
const handleIsAdminChange = useCallback(() => {
|
|
||||||
onUpdate({
|
|
||||||
isAdmin: !isAdmin,
|
|
||||||
});
|
|
||||||
}, [isAdmin, onUpdate]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>{name}</Table.Cell>
|
|
||||||
<Table.Cell>{username || '-'}</Table.Cell>
|
|
||||||
<Table.Cell>{email}</Table.Cell>
|
|
||||||
<Table.Cell collapsing>
|
|
||||||
<Radio toggle checked={isAdmin} onChange={handleIsAdminChange} />
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell collapsing>
|
|
||||||
<DeletePopup
|
|
||||||
title={t('common.deleteUser', {
|
|
||||||
context: 'title',
|
|
||||||
})}
|
|
||||||
content={t('common.areYouSureYouWantToDeleteThisUser')}
|
|
||||||
buttonContent={t('action.deleteUser')}
|
|
||||||
onConfirm={onDelete}
|
|
||||||
>
|
|
||||||
<Button content={t('action.delete')} className={styles.button} />
|
|
||||||
</DeletePopup>
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
Item.propTypes = {
|
|
||||||
name: PropTypes.string.isRequired,
|
|
||||||
username: PropTypes.string,
|
|
||||||
email: PropTypes.string.isRequired,
|
|
||||||
isAdmin: PropTypes.bool.isRequired,
|
|
||||||
onUpdate: PropTypes.func.isRequired,
|
|
||||||
onDelete: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
Item.defaultProps = {
|
|
||||||
username: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Item;
|
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
import pick from 'lodash/pick';
|
||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { Menu } from 'semantic-ui-react';
|
||||||
|
import { withPopup } from '../../../lib/popup';
|
||||||
|
import { Popup } from '../../../lib/custom-ui';
|
||||||
|
|
||||||
|
import { useSteps } from '../../../hooks';
|
||||||
|
import UserInformationEditStep from '../../UserInformationEditStep';
|
||||||
|
import UserUsernameEditStep from '../../UserUsernameEditStep';
|
||||||
|
import UserEmailEditStep from '../../UserEmailEditStep';
|
||||||
|
import UserPasswordEditStep from '../../UserPasswordEditStep';
|
||||||
|
import DeleteStep from '../../DeleteStep';
|
||||||
|
|
||||||
|
import styles from './ActionsPopup.module.scss';
|
||||||
|
|
||||||
|
const StepTypes = {
|
||||||
|
EDIT_INFORMATION: 'EDIT_INFORMATION',
|
||||||
|
EDIT_USERNAME: 'EDIT_USERNAME',
|
||||||
|
EDIT_EMAIL: 'EDIT_EMAIL',
|
||||||
|
EDIT_PASSWORD: 'EDIT_PASSWORD',
|
||||||
|
DELETE: 'DELETE',
|
||||||
|
};
|
||||||
|
|
||||||
|
const ActionsStep = React.memo(
|
||||||
|
({
|
||||||
|
user,
|
||||||
|
onUpdate,
|
||||||
|
onUsernameUpdate,
|
||||||
|
onUsernameUpdateMessageDismiss,
|
||||||
|
onEmailUpdate,
|
||||||
|
onEmailUpdateMessageDismiss,
|
||||||
|
onPasswordUpdate,
|
||||||
|
onPasswordUpdateMessageDismiss,
|
||||||
|
onDelete,
|
||||||
|
onClose,
|
||||||
|
}) => {
|
||||||
|
const [t] = useTranslation();
|
||||||
|
const [step, openStep, handleBack] = useSteps();
|
||||||
|
|
||||||
|
const handleEditInformationClick = useCallback(() => {
|
||||||
|
openStep(StepTypes.EDIT_INFORMATION);
|
||||||
|
}, [openStep]);
|
||||||
|
|
||||||
|
const handleEditUsernameClick = useCallback(() => {
|
||||||
|
openStep(StepTypes.EDIT_USERNAME);
|
||||||
|
}, [openStep]);
|
||||||
|
|
||||||
|
const handleEditEmailClick = useCallback(() => {
|
||||||
|
openStep(StepTypes.EDIT_EMAIL);
|
||||||
|
}, [openStep]);
|
||||||
|
|
||||||
|
const handleEditPasswordClick = useCallback(() => {
|
||||||
|
openStep(StepTypes.EDIT_PASSWORD);
|
||||||
|
}, [openStep]);
|
||||||
|
|
||||||
|
const handleDeleteClick = useCallback(() => {
|
||||||
|
openStep(StepTypes.DELETE);
|
||||||
|
}, [openStep]);
|
||||||
|
|
||||||
|
if (step) {
|
||||||
|
switch (step.type) {
|
||||||
|
case StepTypes.EDIT_INFORMATION:
|
||||||
|
return (
|
||||||
|
<UserInformationEditStep
|
||||||
|
defaultData={pick(user, ['name', 'phone', 'organization'])}
|
||||||
|
onUpdate={onUpdate}
|
||||||
|
onBack={handleBack}
|
||||||
|
onClose={onClose}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case StepTypes.EDIT_USERNAME:
|
||||||
|
return (
|
||||||
|
<UserUsernameEditStep
|
||||||
|
defaultData={user.usernameUpdateForm.data}
|
||||||
|
username={user.username}
|
||||||
|
isSubmitting={user.usernameUpdateForm.isSubmitting}
|
||||||
|
error={user.usernameUpdateForm.error}
|
||||||
|
onUpdate={onUsernameUpdate}
|
||||||
|
onMessageDismiss={onUsernameUpdateMessageDismiss}
|
||||||
|
onBack={handleBack}
|
||||||
|
onClose={onClose}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case StepTypes.EDIT_EMAIL:
|
||||||
|
return (
|
||||||
|
<UserEmailEditStep
|
||||||
|
defaultData={user.emailUpdateForm.data}
|
||||||
|
email={user.email}
|
||||||
|
isSubmitting={user.emailUpdateForm.isSubmitting}
|
||||||
|
error={user.emailUpdateForm.error}
|
||||||
|
onUpdate={onEmailUpdate}
|
||||||
|
onMessageDismiss={onEmailUpdateMessageDismiss}
|
||||||
|
onBack={handleBack}
|
||||||
|
onClose={onClose}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case StepTypes.EDIT_PASSWORD:
|
||||||
|
return (
|
||||||
|
<UserPasswordEditStep
|
||||||
|
defaultData={user.passwordUpdateForm.data}
|
||||||
|
isSubmitting={user.passwordUpdateForm.isSubmitting}
|
||||||
|
error={user.emailUpdateForm.error}
|
||||||
|
onUpdate={onPasswordUpdate}
|
||||||
|
onMessageDismiss={onPasswordUpdateMessageDismiss}
|
||||||
|
onBack={handleBack}
|
||||||
|
onClose={onClose}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case StepTypes.DELETE:
|
||||||
|
return (
|
||||||
|
<DeleteStep
|
||||||
|
title={t('common.deleteUser', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
content={t('common.areYouSureYouWantToDeleteThisUser')}
|
||||||
|
buttonContent={t('action.deleteUser')}
|
||||||
|
onConfirm={onDelete}
|
||||||
|
onBack={handleBack}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Popup.Header>
|
||||||
|
{t('common.userActions', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Popup.Header>
|
||||||
|
<Popup.Content>
|
||||||
|
<Menu secondary vertical className={styles.menu}>
|
||||||
|
<Menu.Item className={styles.menuItem} onClick={handleEditInformationClick}>
|
||||||
|
{t('action.editInformation', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item className={styles.menuItem} onClick={handleEditUsernameClick}>
|
||||||
|
{t('action.editUsername', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item className={styles.menuItem} onClick={handleEditEmailClick}>
|
||||||
|
{t('action.editEmail', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item className={styles.menuItem} onClick={handleEditPasswordClick}>
|
||||||
|
{t('action.editPassword', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item className={styles.menuItem} onClick={handleDeleteClick}>
|
||||||
|
{t('action.deleteUser', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
</Popup.Content>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
ActionsStep.propTypes = {
|
||||||
|
user: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
|
onUpdate: PropTypes.func.isRequired,
|
||||||
|
onUsernameUpdate: PropTypes.func.isRequired,
|
||||||
|
onUsernameUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onEmailUpdate: PropTypes.func.isRequired,
|
||||||
|
onEmailUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onPasswordUpdate: PropTypes.func.isRequired,
|
||||||
|
onPasswordUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onDelete: PropTypes.func.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default withPopup(ActionsStep);
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
:global(#app) {
|
||||||
|
.menu {
|
||||||
|
margin: -7px -12px -5px;
|
||||||
|
width: calc(100% + 24px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menuItem {
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { Button, Icon, Radio, Table } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
import ActionsPopup from './ActionsPopup';
|
||||||
|
|
||||||
|
import styles from './Item.module.scss';
|
||||||
|
|
||||||
|
const Item = React.memo(
|
||||||
|
({
|
||||||
|
email,
|
||||||
|
username,
|
||||||
|
name,
|
||||||
|
organization,
|
||||||
|
phone,
|
||||||
|
isAdmin,
|
||||||
|
emailUpdateForm,
|
||||||
|
passwordUpdateForm,
|
||||||
|
usernameUpdateForm,
|
||||||
|
onUpdate,
|
||||||
|
onUsernameUpdate,
|
||||||
|
onUsernameUpdateMessageDismiss,
|
||||||
|
onEmailUpdate,
|
||||||
|
onEmailUpdateMessageDismiss,
|
||||||
|
onPasswordUpdate,
|
||||||
|
onPasswordUpdateMessageDismiss,
|
||||||
|
onDelete,
|
||||||
|
}) => {
|
||||||
|
const handleIsAdminChange = useCallback(() => {
|
||||||
|
onUpdate({
|
||||||
|
isAdmin: !isAdmin,
|
||||||
|
});
|
||||||
|
}, [isAdmin, onUpdate]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table.Row>
|
||||||
|
<Table.Cell>{name}</Table.Cell>
|
||||||
|
<Table.Cell>{username || '-'}</Table.Cell>
|
||||||
|
<Table.Cell>{email}</Table.Cell>
|
||||||
|
<Table.Cell collapsing>
|
||||||
|
<Radio toggle checked={isAdmin} onChange={handleIsAdminChange} />
|
||||||
|
</Table.Cell>
|
||||||
|
<Table.Cell collapsing>
|
||||||
|
<ActionsPopup
|
||||||
|
user={{
|
||||||
|
email,
|
||||||
|
username,
|
||||||
|
name,
|
||||||
|
organization,
|
||||||
|
phone,
|
||||||
|
isAdmin,
|
||||||
|
emailUpdateForm,
|
||||||
|
passwordUpdateForm,
|
||||||
|
usernameUpdateForm,
|
||||||
|
}}
|
||||||
|
onUpdate={onUpdate}
|
||||||
|
onUsernameUpdate={onUsernameUpdate}
|
||||||
|
onUsernameUpdateMessageDismiss={onUsernameUpdateMessageDismiss}
|
||||||
|
onEmailUpdate={onEmailUpdate}
|
||||||
|
onEmailUpdateMessageDismiss={onEmailUpdateMessageDismiss}
|
||||||
|
onPasswordUpdate={onPasswordUpdate}
|
||||||
|
onPasswordUpdateMessageDismiss={onPasswordUpdateMessageDismiss}
|
||||||
|
onDelete={onDelete}
|
||||||
|
>
|
||||||
|
<Button className={styles.button}>
|
||||||
|
<Icon fitted name="pencil" />
|
||||||
|
</Button>
|
||||||
|
</ActionsPopup>
|
||||||
|
</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
Item.propTypes = {
|
||||||
|
email: PropTypes.string.isRequired,
|
||||||
|
username: PropTypes.string,
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
organization: PropTypes.string,
|
||||||
|
phone: PropTypes.string,
|
||||||
|
isAdmin: PropTypes.bool.isRequired,
|
||||||
|
/* eslint-disable react/forbid-prop-types */
|
||||||
|
emailUpdateForm: PropTypes.object.isRequired,
|
||||||
|
passwordUpdateForm: PropTypes.object.isRequired,
|
||||||
|
usernameUpdateForm: PropTypes.object.isRequired,
|
||||||
|
/* eslint-enable react/forbid-prop-types */
|
||||||
|
onUpdate: PropTypes.func.isRequired,
|
||||||
|
onUsernameUpdate: PropTypes.func.isRequired,
|
||||||
|
onUsernameUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onEmailUpdate: PropTypes.func.isRequired,
|
||||||
|
onEmailUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onPasswordUpdate: PropTypes.func.isRequired,
|
||||||
|
onPasswordUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onDelete: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
Item.defaultProps = {
|
||||||
|
username: undefined,
|
||||||
|
organization: undefined,
|
||||||
|
phone: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Item;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import Item from './Item';
|
||||||
|
|
||||||
|
export default Item;
|
||||||
@@ -6,68 +6,140 @@ import { Button, Modal, Table } from 'semantic-ui-react';
|
|||||||
import UserAddPopupContainer from '../../containers/UserAddPopupContainer';
|
import UserAddPopupContainer from '../../containers/UserAddPopupContainer';
|
||||||
import Item from './Item';
|
import Item from './Item';
|
||||||
|
|
||||||
const UsersModal = React.memo(({ items, onUpdate, onDelete, onClose }) => {
|
const UsersModal = React.memo(
|
||||||
const [t] = useTranslation();
|
({
|
||||||
|
items,
|
||||||
|
onUpdate,
|
||||||
|
onUsernameUpdate,
|
||||||
|
onUsernameUpdateMessageDismiss,
|
||||||
|
onEmailUpdate,
|
||||||
|
onEmailUpdateMessageDismiss,
|
||||||
|
onPasswordUpdate,
|
||||||
|
onPasswordUpdateMessageDismiss,
|
||||||
|
onDelete,
|
||||||
|
onClose,
|
||||||
|
}) => {
|
||||||
|
const [t] = useTranslation();
|
||||||
|
|
||||||
const handleUpdate = useCallback(
|
const handleUpdate = useCallback(
|
||||||
(id, data) => {
|
(id, data) => {
|
||||||
onUpdate(id, data);
|
onUpdate(id, data);
|
||||||
},
|
},
|
||||||
[onUpdate],
|
[onUpdate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleDelete = useCallback(
|
const handleUsernameUpdate = useCallback(
|
||||||
(id) => {
|
(id, data) => {
|
||||||
onDelete(id);
|
onUsernameUpdate(id, data);
|
||||||
},
|
},
|
||||||
[onDelete],
|
[onUsernameUpdate],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
const handleUsernameUpdateMessageDismiss = useCallback(
|
||||||
<Modal open closeIcon size="large" centered={false} onClose={onClose}>
|
(id) => {
|
||||||
<Modal.Header>
|
onUsernameUpdateMessageDismiss(id);
|
||||||
{t('common.users', {
|
},
|
||||||
context: 'title',
|
[onUsernameUpdateMessageDismiss],
|
||||||
})}
|
);
|
||||||
</Modal.Header>
|
|
||||||
<Modal.Content>
|
const handleEmailUpdate = useCallback(
|
||||||
<Table basic="very">
|
(id, data) => {
|
||||||
<Table.Header>
|
onEmailUpdate(id, data);
|
||||||
<Table.Row>
|
},
|
||||||
<Table.HeaderCell width={4}>{t('common.name')}</Table.HeaderCell>
|
[onEmailUpdate],
|
||||||
<Table.HeaderCell width={4}>{t('common.username')}</Table.HeaderCell>
|
);
|
||||||
<Table.HeaderCell width={4}>{t('common.email')}</Table.HeaderCell>
|
|
||||||
<Table.HeaderCell>{t('common.administrator')}</Table.HeaderCell>
|
const handleEmailUpdateMessageDismiss = useCallback(
|
||||||
<Table.HeaderCell />
|
(id) => {
|
||||||
</Table.Row>
|
onEmailUpdateMessageDismiss(id);
|
||||||
</Table.Header>
|
},
|
||||||
<Table.Body>
|
[onEmailUpdateMessageDismiss],
|
||||||
{items.map((item) => (
|
);
|
||||||
<Item
|
|
||||||
key={item.id}
|
const handlePasswordUpdate = useCallback(
|
||||||
name={item.name}
|
(id, data) => {
|
||||||
username={item.username}
|
onPasswordUpdate(id, data);
|
||||||
email={item.email}
|
},
|
||||||
isAdmin={item.isAdmin}
|
[onPasswordUpdate],
|
||||||
onUpdate={(data) => handleUpdate(item.id, data)}
|
);
|
||||||
onDelete={() => handleDelete(item.id)}
|
|
||||||
/>
|
const handlePasswordUpdateMessageDismiss = useCallback(
|
||||||
))}
|
(id) => {
|
||||||
</Table.Body>
|
onPasswordUpdateMessageDismiss(id);
|
||||||
</Table>
|
},
|
||||||
</Modal.Content>
|
[onPasswordUpdateMessageDismiss],
|
||||||
<Modal.Actions>
|
);
|
||||||
<UserAddPopupContainer>
|
|
||||||
<Button positive content={t('action.addUser')} />
|
const handleDelete = useCallback(
|
||||||
</UserAddPopupContainer>
|
(id) => {
|
||||||
</Modal.Actions>
|
onDelete(id);
|
||||||
</Modal>
|
},
|
||||||
);
|
[onDelete],
|
||||||
});
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open closeIcon size="large" centered={false} onClose={onClose}>
|
||||||
|
<Modal.Header>
|
||||||
|
{t('common.users', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Content>
|
||||||
|
<Table basic="very">
|
||||||
|
<Table.Header>
|
||||||
|
<Table.Row>
|
||||||
|
<Table.HeaderCell width={4}>{t('common.name')}</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell width={4}>{t('common.username')}</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell width={4}>{t('common.email')}</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell>{t('common.administrator')}</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell />
|
||||||
|
</Table.Row>
|
||||||
|
</Table.Header>
|
||||||
|
<Table.Body>
|
||||||
|
{items.map((item) => (
|
||||||
|
<Item
|
||||||
|
key={item.id}
|
||||||
|
email={item.email}
|
||||||
|
username={item.username}
|
||||||
|
name={item.name}
|
||||||
|
organization={item.organization}
|
||||||
|
phone={item.phone}
|
||||||
|
isAdmin={item.isAdmin}
|
||||||
|
emailUpdateForm={item.emailUpdateForm}
|
||||||
|
passwordUpdateForm={item.passwordUpdateForm}
|
||||||
|
usernameUpdateForm={item.usernameUpdateForm}
|
||||||
|
onUpdate={(data) => handleUpdate(item.id, data)}
|
||||||
|
onUsernameUpdate={(data) => handleUsernameUpdate(item.id, data)}
|
||||||
|
onUsernameUpdateMessageDismiss={() => handleUsernameUpdateMessageDismiss(item.id)}
|
||||||
|
onEmailUpdate={(data) => handleEmailUpdate(item.id, data)}
|
||||||
|
onEmailUpdateMessageDismiss={() => handleEmailUpdateMessageDismiss(item.id)}
|
||||||
|
onPasswordUpdate={(data) => handlePasswordUpdate(item.id, data)}
|
||||||
|
onPasswordUpdateMessageDismiss={() => handlePasswordUpdateMessageDismiss(item.id)}
|
||||||
|
onDelete={() => handleDelete(item.id)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
|
</Modal.Content>
|
||||||
|
<Modal.Actions>
|
||||||
|
<UserAddPopupContainer>
|
||||||
|
<Button positive content={t('action.addUser')} />
|
||||||
|
</UserAddPopupContainer>
|
||||||
|
</Modal.Actions>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
UsersModal.propTypes = {
|
UsersModal.propTypes = {
|
||||||
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
|
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
|
onUsernameUpdate: PropTypes.func.isRequired,
|
||||||
|
onUsernameUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onEmailUpdate: PropTypes.func.isRequired,
|
||||||
|
onEmailUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
|
onPasswordUpdate: PropTypes.func.isRequired,
|
||||||
|
onPasswordUpdateMessageDismiss: PropTypes.func.isRequired,
|
||||||
onDelete: PropTypes.func.isRequired,
|
onDelete: PropTypes.func.isRequired,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -225,6 +225,9 @@ export default {
|
|||||||
ACTIONS_FETCH: 'ACTIONS_FETCH',
|
ACTIONS_FETCH: 'ACTIONS_FETCH',
|
||||||
ACTIONS_FETCH__SUCCESS: 'ACTIONS_FETCH__SUCCESS',
|
ACTIONS_FETCH__SUCCESS: 'ACTIONS_FETCH__SUCCESS',
|
||||||
ACTIONS_FETCH__FAILURE: 'ACTIONS_FETCH__FAILURE',
|
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',
|
||||||
|
|
||||||
/* Action */
|
/* Action */
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const ACCESS_TOKEN_KEY = 'accessToken';
|
|||||||
const ACCESS_TOKEN_EXPIRES = 365;
|
const ACCESS_TOKEN_EXPIRES = 365;
|
||||||
|
|
||||||
const POSITION_GAP = 65535;
|
const POSITION_GAP = 65535;
|
||||||
const ACTIONS_LIMIT = 10;
|
const ACTIONS_LIMIT = 50;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
SERVER_BASE_URL,
|
SERVER_BASE_URL,
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
const BOARD = 'BOARD';
|
const BOARD = 'BOARD';
|
||||||
const LIST = 'LIST';
|
const LIST = 'LIST';
|
||||||
const CARD = 'CARD';
|
const CARD = 'CARD';
|
||||||
|
const TASK = 'TASK';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
BOARD,
|
BOARD,
|
||||||
LIST,
|
LIST,
|
||||||
CARD,
|
CARD,
|
||||||
|
TASK,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,11 +31,18 @@ export default {
|
|||||||
USER_UPDATE: `${PREFIX}/USER_UPDATE`,
|
USER_UPDATE: `${PREFIX}/USER_UPDATE`,
|
||||||
CURRENT_USER_UPDATE: `${PREFIX}/CURRENT_USER_UPDATE`,
|
CURRENT_USER_UPDATE: `${PREFIX}/CURRENT_USER_UPDATE`,
|
||||||
USER_UPDATE_HANDLE: `${PREFIX}/USER_UPDATE_HANDLE`,
|
USER_UPDATE_HANDLE: `${PREFIX}/USER_UPDATE_HANDLE`,
|
||||||
|
CURRENT_USER_LANGUAGE_UPDATE: `${PREFIX}/CURRENT_USER_LANGUAGE_UPDATE`,
|
||||||
|
USER_EMAIL_UPDATE: `${PREFIX}/USER_EMAIL_UPDATE`,
|
||||||
CURRENT_USER_EMAIL_UPDATE: `${PREFIX}/CURRENT_USER_EMAIL_UPDATE`,
|
CURRENT_USER_EMAIL_UPDATE: `${PREFIX}/CURRENT_USER_EMAIL_UPDATE`,
|
||||||
|
USER_EMAIL_UPDATE_ERROR_CLEAR: `${PREFIX}/USER_EMAIL_UPDATE_ERROR_CLEAR`,
|
||||||
CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR: `${PREFIX}/CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR`,
|
CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR: `${PREFIX}/CURRENT_USER_EMAIL_UPDATE_ERROR_CLEAR`,
|
||||||
|
USER_PASSWORD_UPDATE: `${PREFIX}/USER_PASSWORD_UPDATE`,
|
||||||
CURRENT_USER_PASSWORD_UPDATE: `${PREFIX}/CURRENT_USER_PASSWORD_UPDATE`,
|
CURRENT_USER_PASSWORD_UPDATE: `${PREFIX}/CURRENT_USER_PASSWORD_UPDATE`,
|
||||||
|
USER_PASSWORD_UPDATE_ERROR_CLEAR: `${PREFIX}/USER_PASSWORD_UPDATE_ERROR_CLEAR`,
|
||||||
CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR: `${PREFIX}/CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR`,
|
CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR: `${PREFIX}/CURRENT_USER_PASSWORD_UPDATE_ERROR_CLEAR`,
|
||||||
|
USER_USERNAME_UPDATE: `${PREFIX}/USER_USERNAME_UPDATE`,
|
||||||
CURRENT_USER_USERNAME_UPDATE: `${PREFIX}/CURRENT_USER_USERNAME_UPDATE`,
|
CURRENT_USER_USERNAME_UPDATE: `${PREFIX}/CURRENT_USER_USERNAME_UPDATE`,
|
||||||
|
USER_USERNAME_UPDATE_ERROR_CLEAR: `${PREFIX}/USER_USERNAME_UPDATE_ERROR_CLEAR`,
|
||||||
CURRENT_USER_USERNAME_UPDATE_ERROR_CLEAR: `${PREFIX}/CURRENT_USER_USERNAME_UPDATE_ERROR_CLEAR`,
|
CURRENT_USER_USERNAME_UPDATE_ERROR_CLEAR: `${PREFIX}/CURRENT_USER_USERNAME_UPDATE_ERROR_CLEAR`,
|
||||||
CURRENT_USER_AVATAR_UPDATE: `${PREFIX}/CURRENT_USER_AVATAR_UPDATE`,
|
CURRENT_USER_AVATAR_UPDATE: `${PREFIX}/CURRENT_USER_AVATAR_UPDATE`,
|
||||||
USER_DELETE: `${PREFIX}/USER_DELETE`,
|
USER_DELETE: `${PREFIX}/USER_DELETE`,
|
||||||
@@ -132,6 +139,7 @@ export default {
|
|||||||
TASK_CREATE_HANDLE: `${PREFIX}/TASK_CREATE_HANDLE`,
|
TASK_CREATE_HANDLE: `${PREFIX}/TASK_CREATE_HANDLE`,
|
||||||
TASK_UPDATE: `${PREFIX}/TASK_UPDATE`,
|
TASK_UPDATE: `${PREFIX}/TASK_UPDATE`,
|
||||||
TASK_UPDATE_HANDLE: `${PREFIX}/TASK_UPDATE_HANDLE`,
|
TASK_UPDATE_HANDLE: `${PREFIX}/TASK_UPDATE_HANDLE`,
|
||||||
|
TASK_MOVE: `${PREFIX}/TASK_MOVE`,
|
||||||
TASK_DELETE: `${PREFIX}/TASK_DELETE`,
|
TASK_DELETE: `${PREFIX}/TASK_DELETE`,
|
||||||
TASK_DELETE_HANDLE: `${PREFIX}/TASK_DELETE_HANDLE`,
|
TASK_DELETE_HANDLE: `${PREFIX}/TASK_DELETE_HANDLE`,
|
||||||
|
|
||||||
@@ -147,6 +155,7 @@ export default {
|
|||||||
/* Actions */
|
/* Actions */
|
||||||
|
|
||||||
ACTIONS_IN_CURRENT_CARD_FETCH: `${PREFIX}/ACTIONS_IN_CURRENT_CARD_FETCH`,
|
ACTIONS_IN_CURRENT_CARD_FETCH: `${PREFIX}/ACTIONS_IN_CURRENT_CARD_FETCH`,
|
||||||
|
ACTIONS_DETAILS_IN_CURRENT_CARD_TOGGLE: `${PREFIX}/ACTIONS_DETAILS_IN_CURRENT_CARD_TOGGLE`,
|
||||||
|
|
||||||
/* Action */
|
/* Action */
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ import {
|
|||||||
fetchActionsInCurrentCard,
|
fetchActionsInCurrentCard,
|
||||||
fetchBoard,
|
fetchBoard,
|
||||||
moveCurrentCard,
|
moveCurrentCard,
|
||||||
|
moveTask,
|
||||||
removeLabelFromCurrentCard,
|
removeLabelFromCurrentCard,
|
||||||
removeUserFromCurrentCard,
|
removeUserFromCurrentCard,
|
||||||
|
toggleActionsDetailsInCurrentCard,
|
||||||
transferCurrentCard,
|
transferCurrentCard,
|
||||||
updateAttachment,
|
updateAttachment,
|
||||||
updateCommentAction,
|
updateCommentAction,
|
||||||
@@ -59,6 +61,8 @@ const mapStateToProps = (state) => {
|
|||||||
timer,
|
timer,
|
||||||
isSubscribed,
|
isSubscribed,
|
||||||
isActionsFetching,
|
isActionsFetching,
|
||||||
|
isActionsDetailsVisible,
|
||||||
|
isActionsDetailsFetching,
|
||||||
isAllActionsFetched,
|
isAllActionsFetched,
|
||||||
boardId,
|
boardId,
|
||||||
listId,
|
listId,
|
||||||
@@ -78,6 +82,8 @@ const mapStateToProps = (state) => {
|
|||||||
isSubscribed,
|
isSubscribed,
|
||||||
isActionsFetching,
|
isActionsFetching,
|
||||||
isAllActionsFetched,
|
isAllActionsFetched,
|
||||||
|
isActionsDetailsVisible,
|
||||||
|
isActionsDetailsFetching,
|
||||||
listId,
|
listId,
|
||||||
boardId,
|
boardId,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -111,11 +117,13 @@ const mapDispatchToProps = (dispatch) =>
|
|||||||
onLabelDelete: deleteLabel,
|
onLabelDelete: deleteLabel,
|
||||||
onTaskCreate: createTaskInCurrentCard,
|
onTaskCreate: createTaskInCurrentCard,
|
||||||
onTaskUpdate: updateTask,
|
onTaskUpdate: updateTask,
|
||||||
|
onTaskMove: moveTask,
|
||||||
onTaskDelete: deleteTask,
|
onTaskDelete: deleteTask,
|
||||||
onAttachmentCreate: createAttachmentInCurrentCard,
|
onAttachmentCreate: createAttachmentInCurrentCard,
|
||||||
onAttachmentUpdate: updateAttachment,
|
onAttachmentUpdate: updateAttachment,
|
||||||
onAttachmentDelete: deleteAttachment,
|
onAttachmentDelete: deleteAttachment,
|
||||||
onActionsFetch: fetchActionsInCurrentCard,
|
onActionsFetch: fetchActionsInCurrentCard,
|
||||||
|
onActionsDetailsToggle: toggleActionsDetailsInCurrentCard,
|
||||||
onCommentActionCreate: createCommentActionInCurrentCard,
|
onCommentActionCreate: createCommentActionInCurrentCard,
|
||||||
onCommentActionUpdate: updateCommentAction,
|
onCommentActionUpdate: updateCommentAction,
|
||||||
onCommentActionDelete: deleteCommentAction,
|
onCommentActionDelete: deleteCommentAction,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
updateCurrentUserAvatar,
|
updateCurrentUserAvatar,
|
||||||
updateCurrentUserEmail,
|
updateCurrentUserEmail,
|
||||||
|
updateCurrentUserLanguage,
|
||||||
updateCurrentUserPassword,
|
updateCurrentUserPassword,
|
||||||
updateCurrentUserUsername,
|
updateCurrentUserUsername,
|
||||||
} from '../actions/entry';
|
} from '../actions/entry';
|
||||||
@@ -23,6 +24,7 @@ const mapStateToProps = (state) => {
|
|||||||
avatarUrl,
|
avatarUrl,
|
||||||
phone,
|
phone,
|
||||||
organization,
|
organization,
|
||||||
|
language,
|
||||||
subscribeToOwnCards,
|
subscribeToOwnCards,
|
||||||
isAvatarUpdating,
|
isAvatarUpdating,
|
||||||
emailUpdateForm,
|
emailUpdateForm,
|
||||||
@@ -37,6 +39,7 @@ const mapStateToProps = (state) => {
|
|||||||
avatarUrl,
|
avatarUrl,
|
||||||
phone,
|
phone,
|
||||||
organization,
|
organization,
|
||||||
|
language,
|
||||||
subscribeToOwnCards,
|
subscribeToOwnCards,
|
||||||
isAvatarUpdating,
|
isAvatarUpdating,
|
||||||
emailUpdateForm,
|
emailUpdateForm,
|
||||||
@@ -50,6 +53,7 @@ const mapDispatchToProps = (dispatch) =>
|
|||||||
{
|
{
|
||||||
onUpdate: updateCurrentUser,
|
onUpdate: updateCurrentUser,
|
||||||
onAvatarUpdate: updateCurrentUserAvatar,
|
onAvatarUpdate: updateCurrentUserAvatar,
|
||||||
|
onLanguageUpdate: updateCurrentUserLanguage,
|
||||||
onUsernameUpdate: updateCurrentUserUsername,
|
onUsernameUpdate: updateCurrentUserUsername,
|
||||||
onUsernameUpdateMessageDismiss: clearCurrentUserUsernameUpdateError,
|
onUsernameUpdateMessageDismiss: clearCurrentUserUsernameUpdateError,
|
||||||
onEmailUpdate: updateCurrentUserEmail,
|
onEmailUpdate: updateCurrentUserEmail,
|
||||||
|
|||||||
@@ -2,7 +2,17 @@ import { bindActionCreators } from 'redux';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import { usersExceptCurrentSelector } from '../selectors';
|
import { usersExceptCurrentSelector } from '../selectors';
|
||||||
import { closeModal, deleteUser, updateUser } from '../actions/entry';
|
import {
|
||||||
|
clearUserEmailUpdateError,
|
||||||
|
clearUserPasswordUpdateError,
|
||||||
|
clearUserUsernameUpdateError,
|
||||||
|
closeModal,
|
||||||
|
deleteUser,
|
||||||
|
updateUser,
|
||||||
|
updateUserEmail,
|
||||||
|
updateUserPassword,
|
||||||
|
updateUserUsername,
|
||||||
|
} from '../actions/entry';
|
||||||
import UsersModal from '../components/UsersModal';
|
import UsersModal from '../components/UsersModal';
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
@@ -17,6 +27,12 @@ const mapDispatchToProps = (dispatch) =>
|
|||||||
bindActionCreators(
|
bindActionCreators(
|
||||||
{
|
{
|
||||||
onUpdate: updateUser,
|
onUpdate: updateUser,
|
||||||
|
onUsernameUpdate: updateUserUsername,
|
||||||
|
onUsernameUpdateMessageDismiss: clearUserUsernameUpdateError,
|
||||||
|
onEmailUpdate: updateUserEmail,
|
||||||
|
onEmailUpdateMessageDismiss: clearUserEmailUpdateError,
|
||||||
|
onPasswordUpdate: updateUserPassword,
|
||||||
|
onPasswordUpdateMessageDismiss: clearUserPasswordUpdateError,
|
||||||
onDelete: deleteUser,
|
onDelete: deleteUser,
|
||||||
onClose: closeModal,
|
onClose: closeModal,
|
||||||
},
|
},
|
||||||
|
|||||||
+29
-15
@@ -1,11 +1,11 @@
|
|||||||
import i18n from 'i18next';
|
import i18n from 'i18next';
|
||||||
import languageDetector from 'i18next-browser-languagedetector';
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||||
import { initReactI18next } from 'react-i18next';
|
import { initReactI18next } from 'react-i18next';
|
||||||
import formatDate from 'date-fns/format';
|
import formatDate from 'date-fns/format';
|
||||||
import parseDate from 'date-fns/parse';
|
import parseDate from 'date-fns/parse';
|
||||||
import { registerLocale, setDefaultLocale } from 'react-datepicker';
|
import { registerLocale, setDefaultLocale } from 'react-datepicker';
|
||||||
|
|
||||||
import { embedLocales, languages } from './locales';
|
import { embeddedLocales, languages } from './locales';
|
||||||
|
|
||||||
i18n.dateFns = {
|
i18n.dateFns = {
|
||||||
locales: {},
|
locales: {},
|
||||||
@@ -52,12 +52,12 @@ const parseDatePostProcessor = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
i18n
|
i18n
|
||||||
.use(languageDetector)
|
.use(LanguageDetector)
|
||||||
.use(formatDatePostProcessor)
|
.use(formatDatePostProcessor)
|
||||||
.use(parseDatePostProcessor)
|
.use(parseDatePostProcessor)
|
||||||
.use(initReactI18next)
|
.use(initReactI18next)
|
||||||
.init({
|
.init({
|
||||||
resources: embedLocales,
|
resources: embeddedLocales,
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
supportedLngs: languages,
|
supportedLngs: languages,
|
||||||
load: 'languageOnly',
|
load: 'languageOnly',
|
||||||
@@ -74,27 +74,41 @@ i18n
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
react: {
|
react: {
|
||||||
useSuspense: false,
|
useSuspense: true,
|
||||||
},
|
},
|
||||||
debug: process.env.NODE_ENV !== 'production',
|
debug: process.env.NODE_ENV !== 'production',
|
||||||
});
|
});
|
||||||
|
|
||||||
i18n.loadCoreLocale = (language = i18n.resolvedLanguage) => {
|
i18n.loadCoreLocale = async (language = i18n.resolvedLanguage) => {
|
||||||
if (language === 'en') {
|
if (language === 'en') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
import(`./locales/${language}/core`).then((module) => {
|
const { default: locale } = await import(`./locales/${language}/core`);
|
||||||
const locale = module.default;
|
|
||||||
|
|
||||||
Object.keys(locale).forEach((namespace) => {
|
Object.keys(locale).forEach((namespace) => {
|
||||||
if (namespace === 'dateFns') {
|
if (namespace === 'dateFns') {
|
||||||
i18n.dateFns.addLocale(language, locale[namespace]);
|
i18n.dateFns.addLocale(language, locale[namespace]);
|
||||||
} else {
|
} else {
|
||||||
i18n.addResourceBundle(language, namespace, locale[namespace], true, true);
|
i18n.addResourceBundle(language, namespace, locale[namespace], true, true);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
i18n.detectLanguage = () => {
|
||||||
|
const {
|
||||||
|
services: { languageDetector, languageUtils },
|
||||||
|
} = i18n;
|
||||||
|
|
||||||
|
localStorage.removeItem(languageDetector.options.lookupLocalStorage);
|
||||||
|
|
||||||
|
const detectedLanguages = languageDetector.detect();
|
||||||
|
|
||||||
|
i18n.language = languageUtils.getBestMatchFromCodes(detectedLanguages);
|
||||||
|
i18n.languages = languageUtils.toResolveHierarchy(i18n.language);
|
||||||
|
|
||||||
|
i18n.resolvedLanguage = undefined;
|
||||||
|
i18n.setResolvedLanguage(i18n.language);
|
||||||
|
};
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { useCallback } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
import remarkGfm from 'remark-gfm';
|
import remarkGfm from 'remark-gfm';
|
||||||
|
import remarkBreaks from 'remark-breaks';
|
||||||
|
|
||||||
import './Markdown.module.scss'; // FIXME: import as styles?
|
import './Markdown.module.scss'; // FIXME: import as styles?
|
||||||
|
|
||||||
@@ -31,14 +32,12 @@ const Markdown = React.memo(({ linkStopPropagation, ...props }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
/* eslint-disable react/jsx-props-no-spreading */
|
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
{...props}
|
{...props} // eslint-disable-line react/jsx-props-no-spreading
|
||||||
components={components}
|
components={components}
|
||||||
remarkPlugins={[remarkGfm]}
|
remarkPlugins={[remarkGfm, remarkBreaks]}
|
||||||
className="markdown-body"
|
className="markdown-body"
|
||||||
/>
|
/>
|
||||||
/* eslint-enable react/jsx-props-no-spreading */
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'cs',
|
||||||
|
country: 'cz',
|
||||||
|
name: 'Čeština',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'da',
|
||||||
|
country: 'dk',
|
||||||
|
name: 'Dansk',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -72,6 +72,7 @@ export default {
|
|||||||
deleteTask_title: 'Aufgabe löschen',
|
deleteTask_title: 'Aufgabe löschen',
|
||||||
deleteUser_title: 'Benutzer löschen',
|
deleteUser_title: 'Benutzer löschen',
|
||||||
description: 'Beschreibung',
|
description: 'Beschreibung',
|
||||||
|
detectAutomatically: 'Automatische Erkennung',
|
||||||
dropFileToUpload: 'Datei ablegen, um hochzuladen',
|
dropFileToUpload: 'Datei ablegen, um hochzuladen',
|
||||||
editAttachment_title: 'Anhang bearbieten',
|
editAttachment_title: 'Anhang bearbieten',
|
||||||
editAvatar_title: 'Avatar bearbeiten',
|
editAvatar_title: 'Avatar bearbeiten',
|
||||||
@@ -97,6 +98,7 @@ export default {
|
|||||||
hours: 'Stunden',
|
hours: 'Stunden',
|
||||||
invalidCurrentPassword: 'Das aktuelle Passwort ist falsch',
|
invalidCurrentPassword: 'Das aktuelle Passwort ist falsch',
|
||||||
labels: 'Labels',
|
labels: 'Labels',
|
||||||
|
language: 'Sprache',
|
||||||
leaveBoard_title: 'Board verlassen',
|
leaveBoard_title: 'Board verlassen',
|
||||||
leaveProject_title: 'Projekt verlassen',
|
leaveProject_title: 'Projekt verlassen',
|
||||||
list: 'Listen',
|
list: 'Listen',
|
||||||
@@ -134,6 +136,7 @@ export default {
|
|||||||
subscribeToMyOwnCardsByDefault: 'Standardmäßig meine eigenen Karten abonnieren',
|
subscribeToMyOwnCardsByDefault: 'Standardmäßig meine eigenen Karten abonnieren',
|
||||||
taskActions_title: 'Aufgabenaktionen',
|
taskActions_title: 'Aufgabenaktionen',
|
||||||
tasks: 'Aufgaben',
|
tasks: 'Aufgaben',
|
||||||
|
thereIsNoPreviewAvailableForThisAttachment: 'Für diesen Anhang ist keine Vorschau verfügbar',
|
||||||
time: 'Zeit',
|
time: 'Zeit',
|
||||||
timer: 'Timer',
|
timer: 'Timer',
|
||||||
title: 'Titel',
|
title: 'Titel',
|
||||||
@@ -192,6 +195,7 @@ export default {
|
|||||||
editTimer_title: 'Timer bearbeiten',
|
editTimer_title: 'Timer bearbeiten',
|
||||||
editTitle_title: 'Titel bearbeiten',
|
editTitle_title: 'Titel bearbeiten',
|
||||||
editUsername_title: 'Benutzername ändern',
|
editUsername_title: 'Benutzername ändern',
|
||||||
|
hideDetails: 'Details ausblenden',
|
||||||
leaveBoard: 'Board verlassen',
|
leaveBoard: 'Board verlassen',
|
||||||
leaveProject: 'Projekt verlassen',
|
leaveProject: 'Projekt verlassen',
|
||||||
logOut_title: 'Ausloggen',
|
logOut_title: 'Ausloggen',
|
||||||
@@ -207,6 +211,7 @@ export default {
|
|||||||
removeMember: 'Mitglied entfernen',
|
removeMember: 'Mitglied entfernen',
|
||||||
save: 'Speichern',
|
save: 'Speichern',
|
||||||
showAllAttachments: 'Alle Anhänge anzeigen ({{hidden}} versteckt)',
|
showAllAttachments: 'Alle Anhänge anzeigen ({{hidden}} versteckt)',
|
||||||
|
showDetails: 'Details anzeigen',
|
||||||
showFewerAttachments: 'Weniger Anhänge anzeigen',
|
showFewerAttachments: 'Weniger Anhänge anzeigen',
|
||||||
start: 'Start',
|
start: 'Start',
|
||||||
stop: 'Stopp',
|
stop: 'Stopp',
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'de',
|
||||||
|
country: 'de',
|
||||||
|
name: 'Deutsch',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -64,12 +64,14 @@ export default {
|
|||||||
deleteTask_title: 'Delete Task',
|
deleteTask_title: 'Delete Task',
|
||||||
deleteUser_title: 'Delete User',
|
deleteUser_title: 'Delete User',
|
||||||
description: 'Description',
|
description: 'Description',
|
||||||
|
detectAutomatically: 'Detect automatically',
|
||||||
dropFileToUpload: 'Drop file to upload',
|
dropFileToUpload: 'Drop file to upload',
|
||||||
editAttachment_title: 'Edit Attachment',
|
editAttachment_title: 'Edit Attachment',
|
||||||
editAvatar_title: 'Edit Avatar',
|
editAvatar_title: 'Edit Avatar',
|
||||||
editBoard_title: 'Edit Board',
|
editBoard_title: 'Edit Board',
|
||||||
editDueDate_title: 'Edit Due Date',
|
editDueDate_title: 'Edit Due Date',
|
||||||
editEmail_title: 'Edit E-mail',
|
editEmail_title: 'Edit E-mail',
|
||||||
|
editInformation_title: 'Edit Information',
|
||||||
editLabel_title: 'Edit Label',
|
editLabel_title: 'Edit Label',
|
||||||
editPassword_title: 'Edit Password',
|
editPassword_title: 'Edit Password',
|
||||||
editTimer_title: 'Edit Timer',
|
editTimer_title: 'Edit Timer',
|
||||||
@@ -89,6 +91,7 @@ export default {
|
|||||||
hours: 'Hours',
|
hours: 'Hours',
|
||||||
invalidCurrentPassword: 'Invalid current password',
|
invalidCurrentPassword: 'Invalid current password',
|
||||||
labels: 'Labels',
|
labels: 'Labels',
|
||||||
|
language: 'Language',
|
||||||
leaveBoard_title: 'Leave Board',
|
leaveBoard_title: 'Leave Board',
|
||||||
leaveProject_title: 'Leave Project',
|
leaveProject_title: 'Leave Project',
|
||||||
list: 'List',
|
list: 'List',
|
||||||
@@ -126,6 +129,8 @@ export default {
|
|||||||
subscribeToMyOwnCardsByDefault: 'Subscribe to my own cards by default',
|
subscribeToMyOwnCardsByDefault: 'Subscribe to my own cards by default',
|
||||||
taskActions_title: 'Task Actions',
|
taskActions_title: 'Task Actions',
|
||||||
tasks: 'Tasks',
|
tasks: 'Tasks',
|
||||||
|
thereIsNoPreviewAvailableForThisAttachment:
|
||||||
|
'There is no preview available for this attachment',
|
||||||
time: 'Time',
|
time: 'Time',
|
||||||
timer: 'Timer',
|
timer: 'Timer',
|
||||||
title: 'Title',
|
title: 'Title',
|
||||||
@@ -178,10 +183,12 @@ export default {
|
|||||||
editDueDate_title: 'Edit Due Date',
|
editDueDate_title: 'Edit Due Date',
|
||||||
editDescription_title: 'Edit Description',
|
editDescription_title: 'Edit Description',
|
||||||
editEmail_title: 'Edit E-mail',
|
editEmail_title: 'Edit E-mail',
|
||||||
|
editInformation_title: 'Edit Information',
|
||||||
editPassword_title: 'Edit Password',
|
editPassword_title: 'Edit Password',
|
||||||
editTimer_title: 'Edit Timer',
|
editTimer_title: 'Edit Timer',
|
||||||
editTitle_title: 'Edit Title',
|
editTitle_title: 'Edit Title',
|
||||||
editUsername_title: 'Edit Username',
|
editUsername_title: 'Edit Username',
|
||||||
|
hideDetails: 'Hide details',
|
||||||
leaveBoard: 'Leave board',
|
leaveBoard: 'Leave board',
|
||||||
leaveProject: 'Leave project',
|
leaveProject: 'Leave project',
|
||||||
logOut_title: 'Log Out',
|
logOut_title: 'Log Out',
|
||||||
@@ -197,6 +204,7 @@ export default {
|
|||||||
removeMember: 'Remove member',
|
removeMember: 'Remove member',
|
||||||
save: 'Save',
|
save: 'Save',
|
||||||
showAllAttachments: 'Show all attachments ({{hidden}} hidden)',
|
showAllAttachments: 'Show all attachments ({{hidden}} hidden)',
|
||||||
|
showDetails: 'Show details',
|
||||||
showFewerAttachments: 'Show fewer attachments',
|
showFewerAttachments: 'Show fewer attachments',
|
||||||
start: 'Start',
|
start: 'Start',
|
||||||
stop: 'Stop',
|
stop: 'Stop',
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import merge from 'lodash/merge';
|
||||||
|
|
||||||
|
import login from './login';
|
||||||
|
import core from './core';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'en',
|
||||||
|
country: 'us',
|
||||||
|
name: 'English',
|
||||||
|
embeddedLocale: merge(login, core),
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'es',
|
||||||
|
country: 'es',
|
||||||
|
name: 'Español',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'fr',
|
||||||
|
country: 'fr',
|
||||||
|
name: 'Français',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
+23
-31
@@ -1,35 +1,27 @@
|
|||||||
import merge from 'lodash/merge';
|
import cs from './cs';
|
||||||
import fromPairs from 'lodash/fromPairs';
|
import da from './da';
|
||||||
|
import de from './de';
|
||||||
|
import en from './en';
|
||||||
|
import es from './es';
|
||||||
|
import fr from './fr';
|
||||||
|
import ja from './ja';
|
||||||
|
import pl from './pl';
|
||||||
|
import ru from './ru';
|
||||||
|
import sk from './sk';
|
||||||
|
import sv from './sv';
|
||||||
|
import uz from './uz';
|
||||||
|
import zh from './zh';
|
||||||
|
|
||||||
import csLogin from './cs/login';
|
const locales = [cs, da, de, en, es, fr, ja, pl, ru, sk, sv, uz, zh];
|
||||||
import daLogin from './da/login';
|
|
||||||
import deLogin from './de/login';
|
|
||||||
import enLogin from './en/login';
|
|
||||||
import enCore from './en/core';
|
|
||||||
import esLogin from './es/login';
|
|
||||||
import frLogin from './fr/login';
|
|
||||||
import jaLogin from './ja/login';
|
|
||||||
import plLogin from './pl/login';
|
|
||||||
import ruLogin from './ru/login';
|
|
||||||
import seLogin from './se/login';
|
|
||||||
import uzLogin from './uz/login';
|
|
||||||
import zhLogin from './zh/login';
|
|
||||||
|
|
||||||
const localePairs = [
|
export default locales;
|
||||||
['cs', csLogin],
|
|
||||||
['da', daLogin],
|
|
||||||
['de', deLogin],
|
|
||||||
['en', merge(enLogin, enCore)],
|
|
||||||
['es', esLogin],
|
|
||||||
['fr', frLogin],
|
|
||||||
['ja', jaLogin],
|
|
||||||
['pl', plLogin],
|
|
||||||
['ru', ruLogin],
|
|
||||||
['se', seLogin],
|
|
||||||
['uz', uzLogin],
|
|
||||||
['zh', zhLogin],
|
|
||||||
];
|
|
||||||
|
|
||||||
export const languages = localePairs.map((locale) => locale[0]);
|
export const languages = locales.map((locale) => locale.language);
|
||||||
|
|
||||||
export const embedLocales = fromPairs(localePairs);
|
export const embeddedLocales = locales.reduce(
|
||||||
|
(result, locale) => ({
|
||||||
|
...result,
|
||||||
|
[locale.language]: locale.embeddedLocale,
|
||||||
|
}),
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'ja',
|
||||||
|
country: 'jp',
|
||||||
|
name: '日本語',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'pl',
|
||||||
|
country: 'pl',
|
||||||
|
name: 'Polski',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -62,6 +62,7 @@ export default {
|
|||||||
deleteTask: 'Удаление задачи',
|
deleteTask: 'Удаление задачи',
|
||||||
deleteUser: 'Удаление пользователя',
|
deleteUser: 'Удаление пользователя',
|
||||||
description: 'Описание',
|
description: 'Описание',
|
||||||
|
detectAutomatically: 'Определить автоматически',
|
||||||
dropFileToUpload: 'Перетяните файл, чтобы загрузить',
|
dropFileToUpload: 'Перетяните файл, чтобы загрузить',
|
||||||
editAttachment: 'Изменение вложения',
|
editAttachment: 'Изменение вложения',
|
||||||
editAvatar: 'Изменение аватара',
|
editAvatar: 'Изменение аватара',
|
||||||
@@ -88,6 +89,7 @@ export default {
|
|||||||
hours: 'Часы',
|
hours: 'Часы',
|
||||||
invalidCurrentPassword: 'Неверный текущий пароль',
|
invalidCurrentPassword: 'Неверный текущий пароль',
|
||||||
labels: 'Метки',
|
labels: 'Метки',
|
||||||
|
language: 'Язык',
|
||||||
list: 'Список',
|
list: 'Список',
|
||||||
listActions: 'Действия со списком',
|
listActions: 'Действия со списком',
|
||||||
members: 'Участники',
|
members: 'Участники',
|
||||||
@@ -122,6 +124,7 @@ export default {
|
|||||||
subscribeToMyOwnCardsByDefault: 'По умолчанию подписаться на мои собственные карточки',
|
subscribeToMyOwnCardsByDefault: 'По умолчанию подписаться на мои собственные карточки',
|
||||||
taskActions: 'Действия с задачей',
|
taskActions: 'Действия с задачей',
|
||||||
tasks: 'Задачи',
|
tasks: 'Задачи',
|
||||||
|
thereIsNoPreviewAvailableForThisAttachment: 'Предпросмотр для этого вложения недоступен',
|
||||||
time: 'Время',
|
time: 'Время',
|
||||||
timer: 'Таймер',
|
timer: 'Таймер',
|
||||||
title: 'Название',
|
title: 'Название',
|
||||||
@@ -175,7 +178,8 @@ export default {
|
|||||||
editTask: 'Изменить задачу',
|
editTask: 'Изменить задачу',
|
||||||
editTimer: 'Изменить таймер',
|
editTimer: 'Изменить таймер',
|
||||||
editTitle: 'Изменить название',
|
editTitle: 'Изменить название',
|
||||||
editUsername_title: 'Изменить имя пользователя',
|
editUsername: 'Изменить имя пользователя',
|
||||||
|
hideDetails: 'Скрыть подробности',
|
||||||
logOut: 'Выйти',
|
logOut: 'Выйти',
|
||||||
makeCover: 'Сделать обложкой',
|
makeCover: 'Сделать обложкой',
|
||||||
move: 'Переместить',
|
move: 'Переместить',
|
||||||
@@ -187,6 +191,7 @@ export default {
|
|||||||
removeMember: 'Удалить участника',
|
removeMember: 'Удалить участника',
|
||||||
save: 'Сохранить',
|
save: 'Сохранить',
|
||||||
showAllAttachments: 'Показать все вложения ({{hidden}} скрыто)',
|
showAllAttachments: 'Показать все вложения ({{hidden}} скрыто)',
|
||||||
|
showDetails: 'Показать подробности',
|
||||||
showFewerAttachments: 'Показать меньше вложений',
|
showFewerAttachments: 'Показать меньше вложений',
|
||||||
start: 'Начать',
|
start: 'Начать',
|
||||||
stop: 'Остановить',
|
stop: 'Остановить',
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'ru',
|
||||||
|
country: 'ru',
|
||||||
|
name: 'Русский',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
import dateFns from 'date-fns/locale/sk';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
dateFns,
|
||||||
|
|
||||||
|
format: {
|
||||||
|
date: 'd.M.yyyy',
|
||||||
|
time: 'p',
|
||||||
|
dateTime: '$t(format:date) $t(format:time)',
|
||||||
|
longDate: 'd MMM',
|
||||||
|
longDateTime: "d MMMM 'v' p",
|
||||||
|
},
|
||||||
|
|
||||||
|
translation: {
|
||||||
|
common: {
|
||||||
|
account: 'Účet',
|
||||||
|
actions: 'Akcia',
|
||||||
|
addAttachment_title: 'Pridať prílohu',
|
||||||
|
addComment: 'Pridať komentár',
|
||||||
|
addManager_title: 'Pridať správcu',
|
||||||
|
addMember_title: 'Pridať člena',
|
||||||
|
addUser_title: 'Pridať používateľa',
|
||||||
|
administrator: 'Administrátor',
|
||||||
|
all: 'Všetko',
|
||||||
|
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
||||||
|
'Všetky zmeny budú automaticky uložené<br />po obnovení spojenia',
|
||||||
|
areYouSureYouWantToDeleteThisAttachment: 'Naozaj chcete zmazať túto prílohu?',
|
||||||
|
areYouSureYouWantToDeleteThisBoard: 'Naozaj chcete zmazať túto tabuľu?',
|
||||||
|
areYouSureYouWantToDeleteThisCard: 'Naozaj chcete zmazať túto kartu?',
|
||||||
|
areYouSureYouWantToDeleteThisComment: 'Naozaj chcete zmazať tento komentár?',
|
||||||
|
areYouSureYouWantToDeleteThisLabel: 'Naozaj chcete zmazať tento štítok?',
|
||||||
|
areYouSureYouWantToDeleteThisList: 'Naozaj chcete zmazať tento zoznam?',
|
||||||
|
areYouSureYouWantToDeleteThisProject: 'Naozaj chcete zmazať tento projekt?',
|
||||||
|
areYouSureYouWantToDeleteThisTask: 'Naozaj chcete zmazať túto úlohu?',
|
||||||
|
areYouSureYouWantToDeleteThisUser: 'Naozaj chcete zmazať tohoto používateľa?',
|
||||||
|
areYouSureYouWantToLeaveBoard: 'Naozaj chcete opustiť túto tabuľu?',
|
||||||
|
areYouSureYouWantToLeaveProject: 'Naozaj chcete opustiť tento projekt?',
|
||||||
|
areYouSureYouWantToRemoveThisManagerFromProject:
|
||||||
|
'Naozaj chcete zmazať daného správcu tohto projektu?',
|
||||||
|
areYouSureYouWantToRemoveThisMemberFromBoard:
|
||||||
|
'Naozaj chcete odstrániť tohoto člena z tabule?',
|
||||||
|
attachment: 'Príloha',
|
||||||
|
attachments: 'Prílohy',
|
||||||
|
authentication: 'Overenie',
|
||||||
|
background: 'Pozadie',
|
||||||
|
board: 'Tabuľa',
|
||||||
|
boardNotFound_title: 'Tabuľa neexistuje',
|
||||||
|
cardActions_title: 'Akcie na karte',
|
||||||
|
cardNotFound_title: 'Karta neexistuje',
|
||||||
|
cardOrActionAreDeleted: 'Karta alebo akcia sú zmazané',
|
||||||
|
color: 'Farba',
|
||||||
|
createBoard_title: 'Vytvoriť tabuľu',
|
||||||
|
createLabel_title: 'Vytvoriť štítok',
|
||||||
|
createNewOneOrSelectExistingOne: 'Vytvoriť nový alebo vyberte<br />už existujúci',
|
||||||
|
createProject_title: 'Vytvoriť projekt',
|
||||||
|
createTextFile_title: 'Vytvoriť textový súbor',
|
||||||
|
currentPassword: 'Aktuálne heslo',
|
||||||
|
dangerZone_title: 'Nebezpečná zóna',
|
||||||
|
date: 'Dátum',
|
||||||
|
dueDate_title: 'Termín do',
|
||||||
|
deleteAttachment_title: 'Zmazať prílohu',
|
||||||
|
deleteBoard_title: 'Zmazať tabuľu',
|
||||||
|
deleteCard_title: 'Zmazať kartu',
|
||||||
|
deleteComment_title: 'Zmazať komentár',
|
||||||
|
deleteLabel_title: 'Zmazať štítok',
|
||||||
|
deleteList_title: 'Zmazať zoznam',
|
||||||
|
deleteProject_title: 'Zmazať projekt',
|
||||||
|
deleteTask_title: 'Zmazať úlohu',
|
||||||
|
deleteUser_title: 'Zmazať používateľa',
|
||||||
|
description: 'Popis',
|
||||||
|
dropFileToUpload: 'Potiahnutím nahraj súbor',
|
||||||
|
editAttachment_title: 'Upraviť prílohu',
|
||||||
|
editAvatar_title: 'Upraviť avatar',
|
||||||
|
editBoard_title: 'Upraviť tabuľu',
|
||||||
|
editDueDate_title: 'Upraviť Termín do',
|
||||||
|
editEmail_title: 'Upraviť e-mail',
|
||||||
|
editInformation_title: 'Upraviť informácie',
|
||||||
|
editLabel_title: 'Upraviť štítok',
|
||||||
|
editPassword_title: 'Upraviť heslo',
|
||||||
|
editTimer_title: 'Upraviť časovač',
|
||||||
|
editUsername_title: 'Upraviť používateľské meno',
|
||||||
|
email: 'E-mail',
|
||||||
|
emailAlreadyInUse: 'E-mail je už použitý',
|
||||||
|
enterCardTitle: 'Vlož názov karty...',
|
||||||
|
enterDescription: 'Vlož popis...',
|
||||||
|
enterFilename: 'Vlož názov súboru',
|
||||||
|
enterListTitle: 'Vlož názov zoznamu...',
|
||||||
|
enterProjectTitle: 'Vlož názov projektu',
|
||||||
|
enterTaskDescription: 'Vlož popis úlohy...',
|
||||||
|
filterByLabels_title: 'Filtruj podľa štítku',
|
||||||
|
filterByMembers_title: 'Filtruj podľa člena',
|
||||||
|
fromComputer_title: 'Z počítača',
|
||||||
|
general: 'Všeobecné',
|
||||||
|
hours: 'Hodiny',
|
||||||
|
invalidCurrentPassword: 'Neplatné aktuálne heslo',
|
||||||
|
labels: 'Štítky',
|
||||||
|
leaveBoard_title: 'Opustiť tabuľu',
|
||||||
|
leaveProject_title: 'Opustiť projekt',
|
||||||
|
list: 'Zoznam',
|
||||||
|
listActions_title: 'Zoznam akcií',
|
||||||
|
managers: 'Správcovia',
|
||||||
|
members: 'Členovia',
|
||||||
|
minutes: 'Minúty',
|
||||||
|
moveCard_title: 'Presunúť kartu',
|
||||||
|
name: 'Meno',
|
||||||
|
newEmail: 'Nový e-mail',
|
||||||
|
newPassword: 'Nové heslo',
|
||||||
|
newUsername: 'Nové používateľské meno',
|
||||||
|
noConnectionToServer: 'Nie je spojenie k serveru',
|
||||||
|
noBoards: 'Žiadne tabule',
|
||||||
|
noLists: 'Žiadne zoznamy',
|
||||||
|
noProjects: 'Žiadne projekty',
|
||||||
|
notifications: 'Oznámenia',
|
||||||
|
noUnreadNotifications: 'Žiadne neprečítané oznámenia',
|
||||||
|
openBoard_title: 'Otvoriť tabuľu',
|
||||||
|
optional_inline: 'voliteľné',
|
||||||
|
organization: 'Spoločnosť',
|
||||||
|
phone: 'Telefón',
|
||||||
|
preferences: 'Voľby',
|
||||||
|
pressPasteShortcutToAddAttachmentFromClipboard:
|
||||||
|
'Tip: stlačte Ctrl-V (Cmd-V na Mac) pre vloženie prílohy zo schránky.',
|
||||||
|
project: 'Projekt',
|
||||||
|
projectNotFound_title: 'Projekt neexistuje',
|
||||||
|
removeManager_title: 'Odstrániť správcu',
|
||||||
|
removeMember_title: 'Odstrániť člena',
|
||||||
|
seconds: 'Sekúnd',
|
||||||
|
selectBoard: 'Vybrať tabuľu',
|
||||||
|
selectList: 'Vybrať zoznam',
|
||||||
|
selectProject: 'Vybrať projekt',
|
||||||
|
settings: 'Nastavenia',
|
||||||
|
subscribeToMyOwnCardsByDefault: 'Predvolene odoberať vlastné karty',
|
||||||
|
taskActions_title: 'Akcie na úlohe',
|
||||||
|
tasks: 'Úlohy',
|
||||||
|
time: 'Čas',
|
||||||
|
timer: 'Časovač',
|
||||||
|
title: 'Názov',
|
||||||
|
userActions_title: 'Akcie na používateľovi',
|
||||||
|
userAddedThisCardToList: '<0>{{user}}</0><1> pridal kartu do {{list}}</1>',
|
||||||
|
userLeftNewCommentToCard: '{{user}} zanechal nový komentár «{{comment}}» k <2>{{card}}</2>',
|
||||||
|
userMovedCardFromListToList: '{{user}} presunul <2>{{card}}</2> z {{fromList}} do {{toList}}',
|
||||||
|
userMovedThisCardFromListToList:
|
||||||
|
'<0>{{user}}</0><1> presunul túto kartu z {{fromList}} do {{toList}}</1>',
|
||||||
|
username: 'Používateľské meno',
|
||||||
|
usernameAlreadyInUse: 'Používateľské meno je zabrané',
|
||||||
|
users: 'Používatelia',
|
||||||
|
writeComment: 'Napísať komentár...',
|
||||||
|
},
|
||||||
|
|
||||||
|
action: {
|
||||||
|
addAnotherCard: 'Pridať ďalšiu kartu',
|
||||||
|
addAnotherList: 'Pridať ďalší zoznam',
|
||||||
|
addAnotherTask: 'Pridať ďalšiu úlohu',
|
||||||
|
addCard: 'Pridať kartu',
|
||||||
|
addCard_title: 'Pridať kartu',
|
||||||
|
addComment: 'Pridať komentár',
|
||||||
|
addList: 'Pridať zoznam',
|
||||||
|
addMoreDetailedDescription: 'Pridať ďalší detailný popis',
|
||||||
|
addTask: 'Pridať úlohu',
|
||||||
|
addToCard: 'Pridať na kartu',
|
||||||
|
addUser: 'Pridať používateľa',
|
||||||
|
createBoard: 'Vytvoriť tabuľu',
|
||||||
|
createFile: 'Vytvoriť súbor',
|
||||||
|
createLabel: 'Vytvoriť štítok',
|
||||||
|
createNewLabel: 'Vytvoriť nový štítok',
|
||||||
|
createProject: 'Vytvoriť projekt',
|
||||||
|
delete: 'Zmazať',
|
||||||
|
deleteAttachment: 'Zmazať prílohu',
|
||||||
|
deleteAvatar: 'Zmazať avatar',
|
||||||
|
deleteBoard: 'Zmazať tabuľu',
|
||||||
|
deleteCard: 'Zmazať kartu',
|
||||||
|
deleteCard_title: 'Zmazať kartu',
|
||||||
|
deleteComment: 'Zmazať komentár',
|
||||||
|
deleteImage: 'Zmazať obrázok',
|
||||||
|
deleteLabel: 'Zmazať štítok',
|
||||||
|
deleteList: 'Zmazať zoznam',
|
||||||
|
deleteList_title: 'Zmazať zoznam',
|
||||||
|
deleteProject: 'Zmazať projekt',
|
||||||
|
deleteProject_title: 'Zmazať projekt',
|
||||||
|
deleteTask: 'Zmazať úlohu',
|
||||||
|
deleteTask_title: 'Zmazať úlohu',
|
||||||
|
deleteUser: 'Zmazať používateľa',
|
||||||
|
edit: 'Upraviť',
|
||||||
|
editDueDate_title: 'Upraviť termín do',
|
||||||
|
editDescription_title: 'Upraviť popis',
|
||||||
|
editEmail_title: 'Upraviť e-mail',
|
||||||
|
editInformation_title: 'Upraviť informácie',
|
||||||
|
editPassword_title: 'Upraviť heslo',
|
||||||
|
editTimer_title: 'Upraviť časovač',
|
||||||
|
editTitle_title: 'Upraviť názov',
|
||||||
|
editUsername_title: 'Upraviť používateľské meno',
|
||||||
|
leaveBoard: 'Opustiť tabuľu',
|
||||||
|
leaveProject: 'Opustiť projekt',
|
||||||
|
logOut_title: 'Odhlásiť sa',
|
||||||
|
makeCover_title: 'Vytvoriť obal',
|
||||||
|
move: 'Presunúť',
|
||||||
|
moveCard_title: 'Presunúť kartu',
|
||||||
|
remove: 'Odstrániť',
|
||||||
|
removeBackground: 'Odstrániť pozadie',
|
||||||
|
removeCover_title: 'Odstrániť obal',
|
||||||
|
removeFromBoard: 'Odstrániť z tabule',
|
||||||
|
removeFromProject: 'Odstrániť z projektu',
|
||||||
|
removeManager: 'Odstrániť správcu',
|
||||||
|
removeMember: 'Odstrániť člena',
|
||||||
|
save: 'Uložiť',
|
||||||
|
showAllAttachments: 'Zozbraziť všetky prílohy ({{hidden}} skryté)',
|
||||||
|
showFewerAttachments: 'Zobraziť menej príloh',
|
||||||
|
start: 'Start',
|
||||||
|
stop: 'Stop',
|
||||||
|
subscribe: 'Odoberať',
|
||||||
|
unsubscribe: 'Neodoberať',
|
||||||
|
uploadNewAvatar: 'Nahrať nový avatar',
|
||||||
|
uploadNewImage: 'Nahrať nový obrázok',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'sk',
|
||||||
|
country: 'sk',
|
||||||
|
name: 'Slovenčina',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
export default {
|
||||||
|
translation: {
|
||||||
|
common: {
|
||||||
|
emailOrUsername: 'E-mail alebo používateľské meno',
|
||||||
|
invalidEmailOrUsername: 'Nesprávny e-mail alebo používateľské meno',
|
||||||
|
invalidPassword: 'Nesprávne heslo',
|
||||||
|
logInToPlanka: 'Prihlásiť sa do Planka',
|
||||||
|
noInternetConnection: 'Bez pripojenia k internetu',
|
||||||
|
pageNotFound_title: 'Stránka neexistuje',
|
||||||
|
password: 'Heslo',
|
||||||
|
projectManagement: 'Správa projektu',
|
||||||
|
serverConnectionFailed: 'Pripojenie k serveru zlyhalo',
|
||||||
|
unknownError: 'Neznáma chyba, skúste to neskôr',
|
||||||
|
},
|
||||||
|
|
||||||
|
action: {
|
||||||
|
logIn: 'Prihlásiť sa',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import dateFns from 'date-fns/locale/se';
|
import dateFns from 'date-fns/locale/sv';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
dateFns,
|
dateFns,
|
||||||
@@ -24,10 +24,12 @@ export default {
|
|||||||
all: 'Alla',
|
all: 'Alla',
|
||||||
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
||||||
'Alla ändringar kommer att sparas automatiskt<br />så fort anslutningen är återställd',
|
'Alla ändringar kommer att sparas automatiskt<br />så fort anslutningen är återställd',
|
||||||
areYouSureYouWantToDeleteThisAttachment: 'Är du säker på att du vill ta bort den här bilagan?',
|
areYouSureYouWantToDeleteThisAttachment:
|
||||||
|
'Är du säker på att du vill ta bort den här bilagan?',
|
||||||
areYouSureYouWantToDeleteThisBoard: 'Är du säker på att du vill ta bort den här tavlan?',
|
areYouSureYouWantToDeleteThisBoard: 'Är du säker på att du vill ta bort den här tavlan?',
|
||||||
areYouSureYouWantToDeleteThisCard: 'Är du säker på att du vill ta bort det här kortet?',
|
areYouSureYouWantToDeleteThisCard: 'Är du säker på att du vill ta bort det här kortet?',
|
||||||
areYouSureYouWantToDeleteThisComment: 'Är du säker på att du vill ta bort den här kommentaren?',
|
areYouSureYouWantToDeleteThisComment:
|
||||||
|
'Är du säker på att du vill ta bort den här kommentaren?',
|
||||||
areYouSureYouWantToDeleteThisLabel: 'Är du säker på att du vill ta bort den här etiketten?',
|
areYouSureYouWantToDeleteThisLabel: 'Är du säker på att du vill ta bort den här etiketten?',
|
||||||
areYouSureYouWantToDeleteThisList: 'Är du säker på att du vill ta bort den här listan?',
|
areYouSureYouWantToDeleteThisList: 'Är du säker på att du vill ta bort den här listan?',
|
||||||
areYouSureYouWantToDeleteThisProject: 'Är du säker på att du vill ta bort det här projektet?',
|
areYouSureYouWantToDeleteThisProject: 'Är du säker på att du vill ta bort det här projektet?',
|
||||||
@@ -136,7 +138,8 @@ export default {
|
|||||||
userActions_title: 'Användaråtgärder',
|
userActions_title: 'Användaråtgärder',
|
||||||
userAddedThisCardToList: '<0>{{user}}</0><1> lade till detta kort i {{list}}</1>',
|
userAddedThisCardToList: '<0>{{user}}</0><1> lade till detta kort i {{list}}</1>',
|
||||||
userLeftNewCommentToCard: '{{user}} lämnade en ny kommentar «{{comment}}» på <2>{{card}}</2>',
|
userLeftNewCommentToCard: '{{user}} lämnade en ny kommentar «{{comment}}» på <2>{{card}}</2>',
|
||||||
userMovedCardFromListToList: '{{user}} flyttade <2>{{card}}</2> från {{fromList}} till {{toList}}',
|
userMovedCardFromListToList:
|
||||||
|
'{{user}} flyttade <2>{{card}}</2> från {{fromList}} till {{toList}}',
|
||||||
userMovedThisCardFromListToList:
|
userMovedThisCardFromListToList:
|
||||||
'<0>{{user}}</0><1> flyttade detta kort från {{fromList}} till {{toList}}</1>',
|
'<0>{{user}}</0><1> flyttade detta kort från {{fromList}} till {{toList}}</1>',
|
||||||
username: 'Användarnamn',
|
username: 'Användarnamn',
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'sv',
|
||||||
|
country: 'se',
|
||||||
|
name: 'Svenska',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'uz',
|
||||||
|
country: 'uz',
|
||||||
|
name: "O'zbek",
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import login from './login';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
language: 'zh',
|
||||||
|
country: 'cn',
|
||||||
|
name: '中文',
|
||||||
|
embeddedLocale: login,
|
||||||
|
};
|
||||||
@@ -50,6 +50,7 @@ export default class extends Model {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case ActionTypes.ACTIONS_FETCH__SUCCESS:
|
case ActionTypes.ACTIONS_FETCH__SUCCESS:
|
||||||
|
case ActionTypes.ACTIONS_DETAILS_TOGGLE__SUCCESS:
|
||||||
case ActionTypes.NOTIFICATION_CREATE_HANDLE:
|
case ActionTypes.NOTIFICATION_CREATE_HANDLE:
|
||||||
payload.actions.forEach((action) => {
|
payload.actions.forEach((action) => {
|
||||||
Action.upsert(action);
|
Action.upsert(action);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export default class extends Model {
|
|||||||
id: attr(),
|
id: attr(),
|
||||||
url: attr(),
|
url: attr(),
|
||||||
coverUrl: attr(),
|
coverUrl: attr(),
|
||||||
|
image: attr(),
|
||||||
name: attr(),
|
name: attr(),
|
||||||
cardId: fk({
|
cardId: fk({
|
||||||
to: 'Card',
|
to: 'Card',
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Model, attr, fk, many, oneToOne } from 'redux-orm';
|
|||||||
|
|
||||||
import ActionTypes from '../constants/ActionTypes';
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
import Config from '../constants/Config';
|
import Config from '../constants/Config';
|
||||||
|
import { ActionTypes as ActionTypesEnum } from '../constants/Enums';
|
||||||
|
|
||||||
export default class extends Model {
|
export default class extends Model {
|
||||||
static modelName = 'Card';
|
static modelName = 'Card';
|
||||||
@@ -22,6 +23,12 @@ export default class extends Model {
|
|||||||
isAllActionsFetched: attr({
|
isAllActionsFetched: attr({
|
||||||
getDefault: () => false,
|
getDefault: () => false,
|
||||||
}),
|
}),
|
||||||
|
isActionsDetailsVisible: attr({
|
||||||
|
getDefault: () => false,
|
||||||
|
}),
|
||||||
|
isActionsDetailsFetching: attr({
|
||||||
|
getDefault: () => false,
|
||||||
|
}),
|
||||||
boardId: fk({
|
boardId: fk({
|
||||||
to: 'Board',
|
to: 'Board',
|
||||||
as: 'board',
|
as: 'board',
|
||||||
@@ -195,6 +202,36 @@ export default class extends Model {
|
|||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case ActionTypes.ACTIONS_DETAILS_TOGGLE: {
|
||||||
|
const cardModel = Card.withId(payload.cardId);
|
||||||
|
cardModel.isActionsDetailsVisible = payload.isVisible;
|
||||||
|
|
||||||
|
if (payload.isVisible) {
|
||||||
|
cardModel.isActionsDetailsFetching = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ActionTypes.ACTIONS_DETAILS_TOGGLE__SUCCESS: {
|
||||||
|
const cardModel = Card.withId(payload.cardId);
|
||||||
|
|
||||||
|
cardModel.update({
|
||||||
|
isAllActionsFetched: payload.actions.length < Config.ACTIONS_LIMIT,
|
||||||
|
isActionsDetailsFetching: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
cardModel.actions.toModelArray().forEach((actionModel) => {
|
||||||
|
if (actionModel.notification) {
|
||||||
|
actionModel.update({
|
||||||
|
isInCard: false,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
actionModel.delete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ActionTypes.NOTIFICATION_CREATE_HANDLE:
|
case ActionTypes.NOTIFICATION_CREATE_HANDLE:
|
||||||
payload.cards.forEach((card) => {
|
payload.cards.forEach((card) => {
|
||||||
Card.upsert(card);
|
Card.upsert(card);
|
||||||
@@ -206,15 +243,23 @@ export default class extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getOrderedTasksQuerySet() {
|
getOrderedTasksQuerySet() {
|
||||||
return this.tasks.orderBy('id');
|
return this.tasks.orderBy('position');
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderedAttachmentsQuerySet() {
|
getOrderedAttachmentsQuerySet() {
|
||||||
return this.attachments.orderBy('id', false);
|
return this.attachments.orderBy('id', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderedInCardActionsQuerySet() {
|
getFilteredOrderedInCardActionsQuerySet() {
|
||||||
return this.actions.orderBy('id', false);
|
const filter = {
|
||||||
|
isInCard: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!this.isActionsDetailsVisible) {
|
||||||
|
filter.type = ActionTypesEnum.COMMENT_CARD;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.actions.filter(filter).orderBy('id', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUnreadNotificationsQuerySet() {
|
getUnreadNotificationsQuerySet() {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export default class extends Model {
|
|||||||
return this.cards.orderBy('position');
|
return this.cards.orderBy('position');
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderedFilteredCardsModelArray() {
|
getFilteredOrderedCardsModelArray() {
|
||||||
let cardModels = this.getOrderedCardsQuerySet().toModelArray();
|
let cardModels = this.getOrderedCardsQuerySet().toModelArray();
|
||||||
|
|
||||||
const filterUserIds = this.board.filterUsers.toRefArray().map((user) => user.id);
|
const filterUserIds = this.board.filterUsers.toRefArray().map((user) => user.id);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Model, attr, fk } from 'redux-orm';
|
import { Model, attr, fk, oneToOne } from 'redux-orm';
|
||||||
|
|
||||||
import ActionTypes from '../constants/ActionTypes';
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
|
|
||||||
@@ -15,16 +15,15 @@ export default class extends Model {
|
|||||||
as: 'user',
|
as: 'user',
|
||||||
relatedName: 'notifications',
|
relatedName: 'notifications',
|
||||||
}),
|
}),
|
||||||
actionId: fk({
|
|
||||||
to: 'Action',
|
|
||||||
as: 'action',
|
|
||||||
relatedName: 'notifications',
|
|
||||||
}),
|
|
||||||
cardId: fk({
|
cardId: fk({
|
||||||
to: 'Card',
|
to: 'Card',
|
||||||
as: 'card',
|
as: 'card',
|
||||||
relatedName: 'notifications',
|
relatedName: 'notifications',
|
||||||
}),
|
}),
|
||||||
|
actionId: oneToOne({
|
||||||
|
to: 'Action',
|
||||||
|
as: 'action',
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
static reducer({ type, payload }, Notification) {
|
static reducer({ type, payload }, Notification) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export default class extends Model {
|
|||||||
|
|
||||||
static fields = {
|
static fields = {
|
||||||
id: attr(),
|
id: attr(),
|
||||||
|
position: attr(),
|
||||||
name: attr(),
|
name: attr(),
|
||||||
isCompleted: attr({
|
isCompleted: attr({
|
||||||
getDefault: () => false,
|
getDefault: () => false,
|
||||||
|
|||||||
@@ -35,10 +35,12 @@ export default class extends Model {
|
|||||||
static fields = {
|
static fields = {
|
||||||
id: attr(),
|
id: attr(),
|
||||||
email: attr(),
|
email: attr(),
|
||||||
|
username: attr(),
|
||||||
name: attr(),
|
name: attr(),
|
||||||
avatarUrl: attr(),
|
avatarUrl: attr(),
|
||||||
phone: attr(),
|
phone: attr(),
|
||||||
organization: attr(),
|
organization: attr(),
|
||||||
|
language: attr(),
|
||||||
subscribeToOwnCards: attr(),
|
subscribeToOwnCards: attr(),
|
||||||
deletedAt: attr(),
|
deletedAt: attr(),
|
||||||
isAdmin: attr({
|
isAdmin: attr({
|
||||||
@@ -140,6 +142,18 @@ export default class extends Model {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ActionTypes.USER_EMAIL_UPDATE_ERROR_CLEAR: {
|
||||||
|
const userModel = User.withId(payload.id);
|
||||||
|
|
||||||
|
userModel.update({
|
||||||
|
emailUpdateForm: {
|
||||||
|
...userModel.emailUpdateForm,
|
||||||
|
error: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ActionTypes.USER_PASSWORD_UPDATE: {
|
case ActionTypes.USER_PASSWORD_UPDATE: {
|
||||||
const userModel = User.withId(payload.id);
|
const userModel = User.withId(payload.id);
|
||||||
|
|
||||||
@@ -174,6 +188,18 @@ export default class extends Model {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ActionTypes.USER_PASSWORD_UPDATE_ERROR_CLEAR: {
|
||||||
|
const userModel = User.withId(payload.id);
|
||||||
|
|
||||||
|
userModel.update({
|
||||||
|
passwordUpdateForm: {
|
||||||
|
...userModel.passwordUpdateForm,
|
||||||
|
error: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ActionTypes.USER_USERNAME_UPDATE: {
|
case ActionTypes.USER_USERNAME_UPDATE: {
|
||||||
const userModel = User.withId(payload.id);
|
const userModel = User.withId(payload.id);
|
||||||
|
|
||||||
@@ -208,6 +234,18 @@ export default class extends Model {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ActionTypes.USER_USERNAME_UPDATE_ERROR_CLEAR: {
|
||||||
|
const userModel = User.withId(payload.id);
|
||||||
|
|
||||||
|
userModel.update({
|
||||||
|
usernameUpdateForm: {
|
||||||
|
...userModel.usernameUpdateForm,
|
||||||
|
error: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ActionTypes.USER_AVATAR_UPDATE:
|
case ActionTypes.USER_AVATAR_UPDATE:
|
||||||
User.withId(payload.id).update({
|
User.withId(payload.id).update({
|
||||||
isAvatarUpdating: true,
|
isAvatarUpdating: true,
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { call, put, select } from 'redux-saga/effects';
|
import { call, put, select } from 'redux-saga/effects';
|
||||||
|
|
||||||
import request from '../request';
|
import request from '../request';
|
||||||
import { lastActionIdByCardIdSelector, pathSelector } from '../../../selectors';
|
import { cardByIdSelector, lastActionIdByCardIdSelector, pathSelector } from '../../../selectors';
|
||||||
import { fetchActions } from '../../../actions';
|
import { fetchActions, toggleActionsDetails } from '../../../actions';
|
||||||
import api from '../../../api';
|
import api from '../../../api';
|
||||||
|
|
||||||
export function* fetchActionsService(cardId) {
|
export function* fetchActionsService(cardId) {
|
||||||
|
const { isActionsDetailsVisible } = yield select(cardByIdSelector, cardId);
|
||||||
const lastId = yield select(lastActionIdByCardIdSelector, cardId);
|
const lastId = yield select(lastActionIdByCardIdSelector, cardId);
|
||||||
|
|
||||||
yield put(fetchActions(cardId));
|
yield put(fetchActions(cardId));
|
||||||
@@ -19,6 +20,7 @@ export function* fetchActionsService(cardId) {
|
|||||||
included: { users },
|
included: { users },
|
||||||
} = yield call(request, api.getActions, cardId, {
|
} = yield call(request, api.getActions, cardId, {
|
||||||
beforeId: lastId,
|
beforeId: lastId,
|
||||||
|
withDetails: isActionsDetailsVisible,
|
||||||
}));
|
}));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
yield put(fetchActions.failure(cardId, error));
|
yield put(fetchActions.failure(cardId, error));
|
||||||
@@ -33,3 +35,32 @@ export function* fetchActionsInCurrentCardService() {
|
|||||||
|
|
||||||
yield call(fetchActionsService, cardId);
|
yield call(fetchActionsService, cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function* toggleActionsDetailsService(cardId, isVisible) {
|
||||||
|
yield put(toggleActionsDetails(cardId, isVisible));
|
||||||
|
|
||||||
|
if (isVisible) {
|
||||||
|
let actions;
|
||||||
|
let users;
|
||||||
|
|
||||||
|
try {
|
||||||
|
({
|
||||||
|
items: actions,
|
||||||
|
included: { users },
|
||||||
|
} = yield call(request, api.getActions, cardId, {
|
||||||
|
withDetails: isVisible,
|
||||||
|
}));
|
||||||
|
} catch (error) {
|
||||||
|
yield put(toggleActionsDetails.failure(cardId, error));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield put(toggleActionsDetails.success(cardId, actions, users));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* toggleActionsDetailsInCurrentCardService(isVisible) {
|
||||||
|
const { cardId } = yield select(pathSelector);
|
||||||
|
|
||||||
|
yield call(toggleActionsDetailsService, cardId, isVisible);
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { fetchCoreRequest } from '../requests';
|
|||||||
import { initializeCore } from '../../../actions';
|
import { initializeCore } from '../../../actions';
|
||||||
import i18n from '../../../i18n';
|
import i18n from '../../../i18n';
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
|
||||||
export function* initializeCoreService() {
|
export function* initializeCoreService() {
|
||||||
const {
|
const {
|
||||||
user,
|
user,
|
||||||
@@ -25,6 +24,7 @@ export function* initializeCoreService() {
|
|||||||
notifications,
|
notifications,
|
||||||
} = yield call(fetchCoreRequest); // TODO: handle error
|
} = yield call(fetchCoreRequest); // TODO: handle error
|
||||||
|
|
||||||
|
yield call(i18n.changeLanguage, user.language);
|
||||||
yield call(i18n.loadCoreLocale);
|
yield call(i18n.loadCoreLocale);
|
||||||
|
|
||||||
yield put(
|
yield put(
|
||||||
@@ -48,3 +48,14 @@ export function* initializeCoreService() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function* changeCoreLanguageService(language) {
|
||||||
|
if (language === null) {
|
||||||
|
yield call(i18n.detectLanguage);
|
||||||
|
yield call(i18n.loadCoreLocale);
|
||||||
|
yield call(i18n.changeLanguage, i18n.resolvedLanguage);
|
||||||
|
} else {
|
||||||
|
yield call(i18n.loadCoreLocale, language);
|
||||||
|
yield call(i18n.changeLanguage, language);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { call, put, select } from 'redux-saga/effects';
|
import { call, put, select } from 'redux-saga/effects';
|
||||||
|
|
||||||
import request from '../request';
|
import request from '../request';
|
||||||
import { pathSelector } from '../../../selectors';
|
import { nextTaskPositionSelector, pathSelector, taskByIdSelector } from '../../../selectors';
|
||||||
import {
|
import {
|
||||||
createTask,
|
createTask,
|
||||||
deleteTask,
|
deleteTask,
|
||||||
@@ -14,11 +14,16 @@ import api from '../../../api';
|
|||||||
import { createLocalId } from '../../../utils/local-id';
|
import { createLocalId } from '../../../utils/local-id';
|
||||||
|
|
||||||
export function* createTaskService(cardId, data) {
|
export function* createTaskService(cardId, data) {
|
||||||
|
const nextData = {
|
||||||
|
...data,
|
||||||
|
position: yield select(nextTaskPositionSelector, cardId),
|
||||||
|
};
|
||||||
|
|
||||||
const localId = yield call(createLocalId);
|
const localId = yield call(createLocalId);
|
||||||
|
|
||||||
yield put(
|
yield put(
|
||||||
createTask({
|
createTask({
|
||||||
...data,
|
...nextData,
|
||||||
cardId,
|
cardId,
|
||||||
id: localId,
|
id: localId,
|
||||||
}),
|
}),
|
||||||
@@ -26,7 +31,7 @@ export function* createTaskService(cardId, data) {
|
|||||||
|
|
||||||
let task;
|
let task;
|
||||||
try {
|
try {
|
||||||
({ item: task } = yield call(request, api.createTask, cardId, data));
|
({ item: task } = yield call(request, api.createTask, cardId, nextData));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
yield put(createTask.failure(localId, error));
|
yield put(createTask.failure(localId, error));
|
||||||
return;
|
return;
|
||||||
@@ -63,6 +68,15 @@ export function* handleTaskUpdateService(task) {
|
|||||||
yield put(handleTaskUpdate(task));
|
yield put(handleTaskUpdate(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function* moveTaskService(id, index) {
|
||||||
|
const { cardId } = yield select(taskByIdSelector, id);
|
||||||
|
const position = yield select(nextTaskPositionSelector, cardId, index, id);
|
||||||
|
|
||||||
|
yield call(updateTaskService, id, {
|
||||||
|
position,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function* deleteTaskService(id) {
|
export function* deleteTaskService(id) {
|
||||||
yield put(deleteTask(id));
|
yield put(deleteTask(id));
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user