Compare commits

...
24 Commits
Author SHA1 Message Date
Maksim Eltyshev 3ad383fca6 chore: Update version 2023-01-09 12:35:08 +01:00
Maksim Eltyshev 38eab8b166 ref: Prettify eslint-disables 2023-01-09 12:33:49 +01:00
Maksim Eltyshev aa69bb8d1e feat: Labels reordering
Closes #289
2023-01-09 12:17:06 +01:00
dependabot[bot] d627a19935 chore(deps): Bump json5 from 1.0.1 to 1.0.2 in /client (#370)
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 02:26:00 +05:00
dependabot[bot] b7cf1853f5 chore(deps): Bump json5 from 1.0.1 to 1.0.2 in /server (#369)
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 02:23:01 +05:00
dependabot[bot] 4850fc5fc8 chore(deps): Bump jsonwebtoken from 8.5.1 to 9.0.0 in /server (#357)
Bumps [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) from 8.5.1 to 9.0.0.
- [Release notes](https://github.com/auth0/node-jsonwebtoken/releases)
- [Changelog](https://github.com/auth0/node-jsonwebtoken/blob/master/CHANGELOG.md)
- [Commits](https://github.com/auth0/node-jsonwebtoken/compare/v8.5.1...v9.0.0)

---
updated-dependencies:
- dependency-name: jsonwebtoken
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 02:20:25 +05:00
Maksim Eltyshev 1dfd6972bf Merge branch 'master' of https://github.com/plankanban/planka 2023-01-08 22:11:20 +01:00
Maksim Eltyshev b58b91baa1 ref: Little refactoring 2023-01-08 22:10:41 +01:00
RAR ed89fe5351 feat: Open card once created with Ctrl+Enter (#373) 2023-01-09 01:59:24 +05:00
Maksim Eltyshev 6021d67a00 fix: Subscribe only when needed 2023-01-05 15:03:06 +01:00
RAR 58afeb1e6b fix: Fix npm install errors on Windows (#368) 2023-01-05 18:16:55 +05:00
albanobattistella 7182a09931 fix: Update Italian translation (#363) 2023-01-03 03:16:35 +05:00
Maksim Eltyshev 33765dfe8a chore: Update version 2022-12-26 22:56:13 +01:00
Maksim Eltyshev d21dee05a3 fix: Show completed tasks greyed out 2022-12-26 22:55:04 +01:00
Maksim Eltyshev 1dacd6e700 fix: Prevent scroll when focusing 2022-12-26 22:51:17 +01:00
Maksim Eltyshev 7e07a75124 fix: Improve quality of resized images 2022-12-26 22:43:21 +01:00
Maksim Eltyshev 6ffa817b53 ref: Remove board types, refactoring 2022-12-26 21:10:50 +01:00
Maksim Eltyshev 2b131f76c1 fix: Proper image error handling during migration 2022-12-24 16:24:50 +01:00
Maksim Eltyshev 2bc82d557a fix: Fix image size for animated attachments 2022-12-24 02:59:03 +01:00
Maksim Eltyshev 7c99aeb9e1 chore: Update version 2022-12-24 01:04:46 +01:00
Maksim Eltyshev 8d477af498 fix: Fix active tab style 2022-12-24 01:03:36 +01:00
Maksim Eltyshev 32507f2799 fix: Add missing translation key 2022-12-24 01:00:57 +01:00
Maksim Eltyshev 0a5210dd21 feat: Preserve original format of images, change interpolation kernel
Closes #349
2022-12-24 00:47:59 +01:00
Maksim Eltyshev b82a601f46 fix: Increase height of scroll area in popups 2022-12-21 22:57:04 +01:00
249 changed files with 2472 additions and 1673 deletions
+12 -12
View File
@@ -14958,9 +14958,9 @@
"peer": true "peer": true
}, },
"node_modules/json5": { "node_modules/json5": {
"version": "2.2.1", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
"bin": { "bin": {
"json5": "lib/cli.js" "json5": "lib/cli.js"
}, },
@@ -21971,9 +21971,9 @@
} }
}, },
"node_modules/tsconfig-paths/node_modules/json5": { "node_modules/tsconfig-paths/node_modules/json5": {
"version": "1.0.1", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dependencies": { "dependencies": {
"minimist": "^1.2.0" "minimist": "^1.2.0"
}, },
@@ -34502,9 +34502,9 @@
"peer": true "peer": true
}, },
"json5": { "json5": {
"version": "2.2.1", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==" "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="
}, },
"jsonfile": { "jsonfile": {
"version": "6.1.0", "version": "6.1.0",
@@ -39416,9 +39416,9 @@
}, },
"dependencies": { "dependencies": {
"json5": { "json5": {
"version": "1.0.1", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"requires": { "requires": {
"minimist": "^1.2.0" "minimist": "^1.2.0"
} }
+11 -9
View File
@@ -11,15 +11,17 @@ const createBoard = (projectId, data, headers) =>
const createBoardWithImport = (projectId, data, requestId, headers) => const createBoardWithImport = (projectId, data, requestId, headers) =>
http.post(`/projects/${projectId}/boards?requestId=${requestId}`, data, headers); http.post(`/projects/${projectId}/boards?requestId=${requestId}`, data, headers);
const getBoard = (id, headers) => const getBoard = (id, subscribe, headers) =>
socket.get(`/boards/${id}`, undefined, headers).then((body) => ({ socket
...body, .get(`/boards/${id}${subscribe ? '?subscribe=true' : ''}`, undefined, headers)
included: { .then((body) => ({
...body.included, ...body,
cards: body.included.cards.map(transformCard), included: {
attachments: body.included.attachments.map(transformAttachment), ...body.included,
}, cards: body.included.cards.map(transformCard),
})); attachments: body.included.attachments.map(transformAttachment),
},
}));
const updateBoard = (id, data, headers) => socket.patch(`/boards/${id}`, data, headers); const updateBoard = (id, data, headers) => socket.patch(`/boards/${id}`, data, headers);
+6 -13
View File
@@ -35,18 +35,8 @@ export const transformCardData = (data) => ({
/* Actions */ /* Actions */
const getCards = (boardId, data, headers) => const createCard = (listId, data, headers) =>
socket.get(`/board/${boardId}/cards`, data, headers).then((body) => ({ socket.post(`/lists/${listId}/cards`, transformCardData(data), headers).then((body) => ({
...body,
items: body.items.map(transformCard),
included: {
...body.included,
attachments: body.included.attachments.map(transformAttachment),
},
}));
const createCard = (boardId, data, headers) =>
socket.post(`/boards/${boardId}/cards`, transformCardData(data), headers).then((body) => ({
...body, ...body,
item: transformCard(body.item), item: transformCard(body.item),
})); }));
@@ -55,6 +45,10 @@ const getCard = (id, headers) =>
socket.get(`/cards/${id}`, undefined, headers).then((body) => ({ socket.get(`/cards/${id}`, undefined, headers).then((body) => ({
...body, ...body,
item: transformCard(body.item), item: transformCard(body.item),
included: {
...body.included,
attachments: body.included.attachments.map(transformAttachment),
},
})); }));
const updateCard = (id, data, headers) => const updateCard = (id, data, headers) =>
@@ -83,7 +77,6 @@ const makeHandleCardUpdate = makeHandleCardCreate;
const makeHandleCardDelete = makeHandleCardCreate; const makeHandleCardDelete = makeHandleCardCreate;
export default { export default {
getCards,
createCard, createCard,
getCard, getCard,
updateCard, updateCard,
+2 -1
View File
@@ -9,7 +9,8 @@ const createUser = (data, headers) => socket.post('/users', data, headers);
const getUser = (id, headers) => socket.get(`/users/${id}`, undefined, headers); const getUser = (id, headers) => socket.get(`/users/${id}`, undefined, headers);
const getCurrentUser = (headers) => socket.get('/users/me', undefined, headers); const getCurrentUser = (subscribe, headers) =>
socket.get(`/users/me${subscribe ? '?subscribe=true' : ''}`, undefined, headers);
const updateUser = (id, data, headers) => socket.patch(`/users/${id}`, data, headers); const updateUser = (id, data, headers) => socket.patch(`/users/${id}`, data, headers);
@@ -10,11 +10,11 @@ import CardModalContainer from '../../containers/CardModalContainer';
import ListAdd from './ListAdd'; import ListAdd from './ListAdd';
import { ReactComponent as PlusMathIcon } from '../../assets/images/plus-math-icon.svg'; import { ReactComponent as PlusMathIcon } from '../../assets/images/plus-math-icon.svg';
import styles from './BoardKanban.module.scss'; import styles from './Board.module.scss';
const parseDndId = (dndId) => dndId.split(':')[1]; const parseDndId = (dndId) => dndId.split(':')[1];
const BoardKanban = React.memo( const Board = React.memo(
({ listIds, isCardModalOpened, canEdit, onListCreate, onListMove, onCardMove }) => { ({ listIds, isCardModalOpened, canEdit, onListCreate, onListMove, onCardMove }) => {
const [t] = useTranslation(); const [t] = useTranslation();
const [isListAddOpened, setIsListAddOpened] = useState(false); const [isListAddOpened, setIsListAddOpened] = useState(false);
@@ -166,7 +166,7 @@ const BoardKanban = React.memo(
}, },
); );
BoardKanban.propTypes = { Board.propTypes = {
listIds: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types listIds: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
isCardModalOpened: PropTypes.bool.isRequired, isCardModalOpened: PropTypes.bool.isRequired,
canEdit: PropTypes.bool.isRequired, canEdit: PropTypes.bool.isRequired,
@@ -175,4 +175,4 @@ BoardKanban.propTypes = {
onCardMove: PropTypes.func.isRequired, onCardMove: PropTypes.func.isRequired,
}; };
export default BoardKanban; export default Board;
@@ -72,7 +72,7 @@ const ListAdd = React.memo(({ onCreate, onClose }) => {
<Button <Button
positive positive
content={t('action.addList')} content={t('action.addList')}
className={styles.submitButton} className={styles.button}
onMouseOver={handleControlMouseOver} onMouseOver={handleControlMouseOver}
onMouseOut={handleControlMouseOut} onMouseOut={handleControlMouseOut}
/> />
@@ -1,4 +1,9 @@
:global(#app) { :global(#app) {
.button {
min-height: 30px;
vertical-align: top;
}
.controls { .controls {
margin-top: 4px; margin-top: 4px;
} }
@@ -18,11 +23,6 @@
} }
} }
.submitButton {
min-height: 30px;
vertical-align: top;
}
.wrapper { .wrapper {
background: #e2e4e6; background: #e2e4e6;
border-radius: 3px; border-radius: 3px;
+3
View File
@@ -0,0 +1,3 @@
import Board from './Board';
export default Board;
@@ -25,6 +25,7 @@ const BoardActions = React.memo(
onLabelFromFilterRemove, onLabelFromFilterRemove,
onLabelCreate, onLabelCreate,
onLabelUpdate, onLabelUpdate,
onLabelMove,
onLabelDelete, onLabelDelete,
}) => { }) => {
return ( return (
@@ -54,6 +55,7 @@ const BoardActions = React.memo(
onLabelRemove={onLabelFromFilterRemove} onLabelRemove={onLabelFromFilterRemove}
onLabelCreate={onLabelCreate} onLabelCreate={onLabelCreate}
onLabelUpdate={onLabelUpdate} onLabelUpdate={onLabelUpdate}
onLabelMove={onLabelMove}
onLabelDelete={onLabelDelete} onLabelDelete={onLabelDelete}
/> />
</div> </div>
@@ -82,6 +84,7 @@ BoardActions.propTypes = {
onLabelFromFilterRemove: PropTypes.func.isRequired, onLabelFromFilterRemove: PropTypes.func.isRequired,
onLabelCreate: PropTypes.func.isRequired, onLabelCreate: PropTypes.func.isRequired,
onLabelUpdate: PropTypes.func.isRequired, onLabelUpdate: PropTypes.func.isRequired,
onLabelMove: PropTypes.func.isRequired,
onLabelDelete: PropTypes.func.isRequired, onLabelDelete: PropTypes.func.isRequired,
}; };
@@ -22,6 +22,7 @@ const Filters = React.memo(
onLabelRemove, onLabelRemove,
onLabelCreate, onLabelCreate,
onLabelUpdate, onLabelUpdate,
onLabelMove,
onLabelDelete, onLabelDelete,
}) => { }) => {
const [t] = useTranslation(); const [t] = useTranslation();
@@ -80,6 +81,7 @@ const Filters = React.memo(
onDeselect={onLabelRemove} onDeselect={onLabelRemove}
onCreate={onLabelCreate} onCreate={onLabelCreate}
onUpdate={onLabelUpdate} onUpdate={onLabelUpdate}
onMove={onLabelMove}
onDelete={onLabelDelete} onDelete={onLabelDelete}
> >
<button type="button" className={styles.filterButton}> <button type="button" className={styles.filterButton}>
@@ -117,6 +119,7 @@ Filters.propTypes = {
onLabelRemove: PropTypes.func.isRequired, onLabelRemove: PropTypes.func.isRequired,
onLabelCreate: PropTypes.func.isRequired, onLabelCreate: PropTypes.func.isRequired,
onLabelUpdate: PropTypes.func.isRequired, onLabelUpdate: PropTypes.func.isRequired,
onLabelMove: PropTypes.func.isRequired,
onLabelDelete: PropTypes.func.isRequired, onLabelDelete: PropTypes.func.isRequired,
}; };
@@ -1,3 +0,0 @@
import BoardKanban from './BoardKanban';
export default BoardKanban;
@@ -1,3 +1,4 @@
import { dequal } from 'dequal';
import omit from 'lodash/omit'; import omit from 'lodash/omit';
import React, { useCallback, useState } from 'react'; import React, { useCallback, useState } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@@ -10,7 +11,7 @@ import { BoardMembershipRoles } from '../../constants/Enums';
import styles from './BoardMembershipPermissionsSelectStep.module.scss'; import styles from './BoardMembershipPermissionsSelectStep.module.scss';
const BoardMembershipPermissionsSelectStep = React.memo( const BoardMembershipPermissionsSelectStep = React.memo(
({ defaultData, title, buttonContent, onSelect, onBack }) => { ({ defaultData, title, buttonContent, onSelect, onBack, onClose }) => {
const [t] = useTranslation(); const [t] = useTranslation();
const [data, setData] = useState(() => ({ const [data, setData] = useState(() => ({
@@ -23,7 +24,7 @@ const BoardMembershipPermissionsSelectStep = React.memo(
setData((prevData) => ({ setData((prevData) => ({
...prevData, ...prevData,
role, role,
canComment: role === BoardMembershipRoles.EDITOR ? null : !!prevData.canComment, canComment: role === BoardMembershipRoles.VIEWER ? !!prevData.canComment : null,
})); }));
}, []); }, []);
@@ -35,8 +36,12 @@ const BoardMembershipPermissionsSelectStep = React.memo(
}, []); }, []);
const handleSubmit = useCallback(() => { const handleSubmit = useCallback(() => {
onSelect(data.role === BoardMembershipRoles.EDITOR ? omit(data, 'canComment') : data); if (!dequal(data, defaultData)) {
}, [onSelect, data]); onSelect(data.role === BoardMembershipRoles.VIEWER ? data : omit(data, 'canComment'));
}
onClose();
}, [defaultData, onSelect, onClose, data]);
return ( return (
<> <>
@@ -65,7 +70,7 @@ const BoardMembershipPermissionsSelectStep = React.memo(
<div className={styles.menuItemDescription}>{t('common.canOnlyViewBoard')}</div> <div className={styles.menuItemDescription}>{t('common.canOnlyViewBoard')}</div>
</Menu.Item> </Menu.Item>
</Menu> </Menu>
{data.role !== BoardMembershipRoles.EDITOR && ( {data.role === BoardMembershipRoles.VIEWER && (
<Segment basic className={styles.settings}> <Segment basic className={styles.settings}>
<Radio <Radio
toggle toggle
@@ -90,6 +95,7 @@ BoardMembershipPermissionsSelectStep.propTypes = {
buttonContent: PropTypes.string, buttonContent: PropTypes.string,
onSelect: PropTypes.func.isRequired, onSelect: PropTypes.func.isRequired,
onBack: PropTypes.func.isRequired, onBack: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
}; };
BoardMembershipPermissionsSelectStep.defaultProps = { BoardMembershipPermissionsSelectStep.defaultProps = {
@@ -43,7 +43,9 @@ const BoardMembershipsStep = React.memo(
); );
useEffect(() => { useEffect(() => {
searchField.current.focus(); searchField.current.focus({
preventScroll: true,
});
}, []); }, []);
return ( return (
@@ -1,7 +1,7 @@
:global(#app) { :global(#app) {
.menu { .menu {
margin: 8px auto 0; margin: 8px auto 0;
max-height: 320px; max-height: 60vh;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
scrollbar-width: thin; scrollbar-width: thin;
-25
View File
@@ -1,25 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Loader } from 'semantic-ui-react';
import { BoardTypes } from '../constants/Enums';
import BoardKanbanContainer from '../containers/BoardKanbanContainer';
const BoardWrapper = React.memo(({ type, isFetching }) => {
if (isFetching) {
return <Loader active />;
}
if (type === BoardTypes.KANBAN) {
return <BoardKanbanContainer />;
}
return null;
});
BoardWrapper.propTypes = {
type: PropTypes.string.isRequired,
isFetching: PropTypes.bool.isRequired,
};
export default BoardWrapper;
@@ -46,7 +46,6 @@ const AddStep = React.memo(({ onCreate, onClose }) => {
const handleSubmit = useCallback(() => { const handleSubmit = useCallback(() => {
const cleanData = { const cleanData = {
...data, ...data,
type: 'kanban',
name: data.name.trim(), name: data.name.trim(),
}; };
@@ -64,7 +63,9 @@ const AddStep = React.memo(({ onCreate, onClose }) => {
}, [openStep]); }, [openStep]);
useEffect(() => { useEffect(() => {
nameField.current.focus(); nameField.current.focus({
preventScroll: true,
});
}, []); }, []);
useDidUpdate(() => { useDidUpdate(() => {
@@ -29,7 +29,7 @@
} }
.link { .link {
color: #fff; color: rgba(255, 255, 255, 0.72);
cursor: pointer; cursor: pointer;
display: block; display: block;
line-height: 20px; line-height: 20px;
@@ -60,6 +60,11 @@
&:hover { &:hover {
background: rgba(0, 0, 0, 0.32); background: rgba(0, 0, 0, 0.32);
} }
.link {
color: #fff;
font-weight: bold;
}
} }
.tabWrapper { .tabWrapper {
@@ -45,6 +45,7 @@ const ActionsStep = React.memo(
onLabelRemove, onLabelRemove,
onLabelCreate, onLabelCreate,
onLabelUpdate, onLabelUpdate,
onLabelMove,
onLabelDelete, onLabelDelete,
onClose, onClose,
}) => { }) => {
@@ -119,6 +120,7 @@ const ActionsStep = React.memo(
onDeselect={onLabelRemove} onDeselect={onLabelRemove}
onCreate={onLabelCreate} onCreate={onLabelCreate}
onUpdate={onLabelUpdate} onUpdate={onLabelUpdate}
onMove={onLabelMove}
onDelete={onLabelDelete} onDelete={onLabelDelete}
onBack={handleBack} onBack={handleBack}
/> />
@@ -241,6 +243,7 @@ ActionsStep.propTypes = {
onLabelRemove: PropTypes.func.isRequired, onLabelRemove: PropTypes.func.isRequired,
onLabelCreate: PropTypes.func.isRequired, onLabelCreate: PropTypes.func.isRequired,
onLabelUpdate: PropTypes.func.isRequired, onLabelUpdate: PropTypes.func.isRequired,
onLabelMove: PropTypes.func.isRequired,
onLabelDelete: PropTypes.func.isRequired, onLabelDelete: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired,
}; };
+3
View File
@@ -48,6 +48,7 @@ const Card = React.memo(
onLabelRemove, onLabelRemove,
onLabelCreate, onLabelCreate,
onLabelUpdate, onLabelUpdate,
onLabelMove,
onLabelDelete, onLabelDelete,
}) => { }) => {
const nameEdit = useRef(null); const nameEdit = useRef(null);
@@ -189,6 +190,7 @@ const Card = React.memo(
onLabelRemove={onLabelRemove} onLabelRemove={onLabelRemove}
onLabelCreate={onLabelCreate} onLabelCreate={onLabelCreate}
onLabelUpdate={onLabelUpdate} onLabelUpdate={onLabelUpdate}
onLabelMove={onLabelMove}
onLabelDelete={onLabelDelete} onLabelDelete={onLabelDelete}
> >
<Button className={classNames(styles.actionsButton, styles.target)}> <Button className={classNames(styles.actionsButton, styles.target)}>
@@ -241,6 +243,7 @@ Card.propTypes = {
onLabelRemove: PropTypes.func.isRequired, onLabelRemove: PropTypes.func.isRequired,
onLabelCreate: PropTypes.func.isRequired, onLabelCreate: PropTypes.func.isRequired,
onLabelUpdate: PropTypes.func.isRequired, onLabelUpdate: PropTypes.func.isRequired,
onLabelMove: PropTypes.func.isRequired,
onLabelDelete: PropTypes.func.isRequired, onLabelDelete: PropTypes.func.isRequired,
}; };
+2 -4
View File
@@ -22,11 +22,9 @@ const Tasks = React.memo(({ items }) => {
return ( return (
<> <>
{/* eslint-disable jsx-a11y/click-events-have-key-events, {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions */} jsx-a11y/no-static-element-interactions */}
<div className={styles.button} onClick={handleToggleClick}> <div className={styles.button} onClick={handleToggleClick}>
{/* eslint-enable jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions */}
<span className={styles.progressWrapper}> <span className={styles.progressWrapper}>
<Progress <Progress
autoSuccess autoSuccess
@@ -14,7 +14,6 @@ const Item = React.memo(({ type, data, createdAt, user }) => {
const [t] = useTranslation(); const [t] = useTranslation();
let contentNode; let contentNode;
switch (type) { switch (type) {
case ActivityTypes.CREATE_CARD: case ActivityTypes.CREATE_CARD:
contentNode = ( contentNode = (
@@ -120,6 +120,7 @@ const Attachments = React.memo(
withCaption withCaption
withDownloadButton withDownloadButton
options={{ options={{
wheelToZoom: true,
showHideAnimationType: 'none', showHideAnimationType: 'none',
closeTitle: '', closeTitle: '',
zoomTitle: '', zoomTitle: '',
@@ -61,11 +61,9 @@ const Item = React.forwardRef(
const extension = filename.slice((Math.max(0, filename.lastIndexOf('.')) || Infinity) + 1); const extension = filename.slice((Math.max(0, filename.lastIndexOf('.')) || Infinity) + 1);
return ( return (
/* eslint-disable jsx-a11y/click-events-have-key-events, /* eslint-disable-next-line jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions */ jsx-a11y/no-static-element-interactions */
<div ref={ref} className={styles.wrapper} onClick={handleClick}> <div ref={ref} className={styles.wrapper} onClick={handleClick}>
{/* eslint-enable jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions */}
<div <div
className={styles.thumbnail} className={styles.thumbnail}
style={{ style={{
@@ -62,6 +62,7 @@ const CardModal = React.memo(
onLabelRemove, onLabelRemove,
onLabelCreate, onLabelCreate,
onLabelUpdate, onLabelUpdate,
onLabelMove,
onLabelDelete, onLabelDelete,
onTaskCreate, onTaskCreate,
onTaskUpdate, onTaskUpdate,
@@ -235,6 +236,7 @@ const CardModal = React.memo(
onDeselect={onLabelRemove} onDeselect={onLabelRemove}
onCreate={onLabelCreate} onCreate={onLabelCreate}
onUpdate={onLabelUpdate} onUpdate={onLabelUpdate}
onMove={onLabelMove}
onDelete={onLabelDelete} onDelete={onLabelDelete}
> >
<Label name={label.name} color={label.color} /> <Label name={label.name} color={label.color} />
@@ -252,6 +254,7 @@ const CardModal = React.memo(
onDeselect={onLabelRemove} onDeselect={onLabelRemove}
onCreate={onLabelCreate} onCreate={onLabelCreate}
onUpdate={onLabelUpdate} onUpdate={onLabelUpdate}
onMove={onLabelMove}
onDelete={onLabelDelete} onDelete={onLabelDelete}
> >
<button <button
@@ -419,6 +422,7 @@ const CardModal = React.memo(
onDeselect={onLabelRemove} onDeselect={onLabelRemove}
onCreate={onLabelCreate} onCreate={onLabelCreate}
onUpdate={onLabelUpdate} onUpdate={onLabelUpdate}
onMove={onLabelMove}
onDelete={onLabelDelete} onDelete={onLabelDelete}
> >
<Button fluid className={styles.actionButton}> <Button fluid className={styles.actionButton}>
@@ -546,6 +550,7 @@ CardModal.propTypes = {
onLabelRemove: PropTypes.func.isRequired, onLabelRemove: PropTypes.func.isRequired,
onLabelCreate: PropTypes.func.isRequired, onLabelCreate: PropTypes.func.isRequired,
onLabelUpdate: PropTypes.func.isRequired, onLabelUpdate: PropTypes.func.isRequired,
onLabelMove: PropTypes.func.isRequired,
onLabelDelete: PropTypes.func.isRequired, onLabelDelete: PropTypes.func.isRequired,
onTaskCreate: PropTypes.func.isRequired, onTaskCreate: PropTypes.func.isRequired,
onTaskUpdate: PropTypes.func.isRequired, onTaskUpdate: PropTypes.func.isRequired,
@@ -9,6 +9,7 @@
text-align: left; text-align: left;
text-overflow: ellipsis; text-overflow: ellipsis;
transition: background 85ms ease; transition: background 85ms ease;
white-space: nowrap;
&:hover { &:hover {
background: #dfe3e6; background: #dfe3e6;
@@ -55,14 +55,12 @@ const Item = React.memo(
</span> </span>
<NameEdit ref={nameEdit} defaultValue={name} onUpdate={handleNameUpdate}> <NameEdit ref={nameEdit} defaultValue={name} onUpdate={handleNameUpdate}>
<div className={classNames(canEdit && styles.contentHoverable)}> <div className={classNames(canEdit && styles.contentHoverable)}>
{/* eslint-disable jsx-a11y/click-events-have-key-events, {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions */} jsx-a11y/no-static-element-interactions */}
<span <span
className={classNames(styles.text, canEdit && styles.textEditable)} className={classNames(styles.text, canEdit && styles.textEditable)}
onClick={handleClick} 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)}> <span className={classNames(styles.task, isCompleted && styles.taskCompleted)}>
{name} {name}
</span> </span>
@@ -48,6 +48,7 @@
} }
.taskCompleted { .taskCompleted {
color: #aaa;
text-decoration: line-through; text-decoration: line-through;
} }
-41
View File
@@ -1,41 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import ModalTypes from '../constants/ModalTypes';
import FixedContainer from '../containers/FixedContainer';
import StaticContainer from '../containers/StaticContainer';
import UsersModalContainer from '../containers/UsersModalContainer';
import UserSettingsModalContainer from '../containers/UserSettingsModalContainer';
import ProjectAddModalContainer from '../containers/ProjectAddModalContainer';
import Background from './Background';
function Core({ currentModal, currentProject }) {
return (
<>
{currentProject && currentProject.background && (
<Background
type={currentProject.background.type}
name={currentProject.background.name}
imageUrl={currentProject.backgroundImage && currentProject.backgroundImage.url}
/>
)}
<FixedContainer />
<StaticContainer />
{currentModal === ModalTypes.USERS && <UsersModalContainer />}
{currentModal === ModalTypes.USER_SETTINGS && <UserSettingsModalContainer />}
{currentModal === ModalTypes.PROJECT_ADD && <ProjectAddModalContainer />}
</>
);
}
Core.propTypes = {
currentModal: PropTypes.oneOf(Object.values(ModalTypes)),
currentProject: PropTypes.object, // eslint-disable-line react/forbid-prop-types
};
Core.defaultProps = {
currentModal: undefined,
currentProject: undefined,
};
export default Core;
+69
View File
@@ -0,0 +1,69 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useTranslation, Trans } from 'react-i18next';
import { Loader } from 'semantic-ui-react';
import ModalTypes from '../../constants/ModalTypes';
import FixedContainer from '../../containers/FixedContainer';
import StaticContainer from '../../containers/StaticContainer';
import UsersModalContainer from '../../containers/UsersModalContainer';
import UserSettingsModalContainer from '../../containers/UserSettingsModalContainer';
import ProjectAddModalContainer from '../../containers/ProjectAddModalContainer';
import Background from '../Background';
import styles from './Core.module.scss';
const Core = React.memo(
({ isInitializing, isSocketDisconnected, currentModal, currentProject }) => {
const [t] = useTranslation();
return (
<>
{isInitializing ? (
<Loader active size="massive" />
) : (
<>
{currentProject && currentProject.background && (
<Background
type={currentProject.background.type}
name={currentProject.background.name}
imageUrl={currentProject.backgroundImage && currentProject.backgroundImage.url}
/>
)}
<FixedContainer />
<StaticContainer />
{currentModal === ModalTypes.USERS && <UsersModalContainer />}
{currentModal === ModalTypes.USER_SETTINGS && <UserSettingsModalContainer />}
{currentModal === ModalTypes.PROJECT_ADD && <ProjectAddModalContainer />}
</>
)}
{isSocketDisconnected && (
<div className={styles.message}>
<div className={styles.messageHeader}>{t('common.noConnectionToServer')}</div>
<div className={styles.messageContent}>
<Trans i18nKey="common.allChangesWillBeAutomaticallySavedAfterConnectionRestored">
All changes will be automatically saved
<br />
after connection restored
</Trans>
</div>
</div>
)}
</>
);
},
);
Core.propTypes = {
isInitializing: PropTypes.bool.isRequired,
isSocketDisconnected: PropTypes.bool.isRequired,
currentModal: PropTypes.oneOf(Object.values(ModalTypes)),
currentProject: PropTypes.object, // eslint-disable-line react/forbid-prop-types
};
Core.defaultProps = {
currentModal: undefined,
currentProject: undefined,
};
export default Core;
+3
View File
@@ -0,0 +1,3 @@
import Core from './Core';
export default Core;
@@ -1,37 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useTranslation, Trans } from 'react-i18next';
import { Loader } from 'semantic-ui-react';
import CoreContainer from '../../containers/CoreContainer';
import styles from './CoreWrapper.module.scss';
const CoreWrapper = React.memo(({ isInitializing, isSocketDisconnected }) => {
const [t] = useTranslation();
return (
<>
{isInitializing ? <Loader active size="massive" /> : <CoreContainer />}
{isSocketDisconnected && (
<div className={styles.message}>
<div className={styles.messageHeader}>{t('common.noConnectionToServer')}</div>
<div className={styles.messageContent}>
<Trans i18nKey="common.allChangesWillBeAutomaticallySavedAfterConnectionRestored">
All changes will be automatically saved
<br />
after connection restored
</Trans>
</div>
</div>
)}
</>
);
});
CoreWrapper.propTypes = {
isInitializing: PropTypes.bool.isRequired,
isSocketDisconnected: PropTypes.bool.isRequired,
};
export default CoreWrapper;
@@ -1,3 +0,0 @@
import CoreWrapper from './CoreWrapper';
export default CoreWrapper;
+46 -30
View File
@@ -1,53 +1,69 @@
import upperFirst from 'lodash/upperFirst'; import upperFirst from 'lodash/upperFirst';
import camelCase from 'lodash/camelCase'; import camelCase from 'lodash/camelCase';
import React, { useCallback } from 'react'; import React, { useCallback } 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 } from 'semantic-ui-react'; import { Button } from 'semantic-ui-react';
import styles from './Item.module.scss'; import styles from './Item.module.scss';
import globalStyles from '../../styles.module.scss'; import globalStyles from '../../styles.module.scss';
const Item = React.memo( const Item = React.memo(
({ name, color, isPersisted, isActive, canEdit, onSelect, onDeselect, onEdit }) => { ({ id, index, name, color, isPersisted, isActive, canEdit, onSelect, onDeselect, onEdit }) => {
const handleToggleClick = useCallback(() => { const handleToggleClick = useCallback(() => {
if (isActive) { if (isPersisted) {
onDeselect(); if (isActive) {
} else { onDeselect();
onSelect(); } else {
onSelect();
}
} }
}, [isActive, onSelect, onDeselect]); }, [isPersisted, isActive, onSelect, onDeselect]);
return ( return (
<div className={styles.wrapper}> <Draggable draggableId={id} index={index} isDragDisabled={!isPersisted || !canEdit}>
<Button {({ innerRef, draggableProps, dragHandleProps }, { isDragging }) => {
fluid const contentNode = (
content={name} // eslint-disable-next-line react/jsx-props-no-spreading
active={isActive} <div {...draggableProps} ref={innerRef} className={styles.wrapper}>
disabled={!isPersisted} {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,
className={classNames( jsx-a11y/no-static-element-interactions */}
styles.labelButton, <span
isActive && styles.labelButtonActive, {...dragHandleProps} // eslint-disable-line react/jsx-props-no-spreading
globalStyles[`background${upperFirst(camelCase(color))}`], className={classNames(
)} styles.name,
onClick={handleToggleClick} isActive && styles.nameActive,
/> globalStyles[`background${upperFirst(camelCase(color))}`],
{canEdit && ( )}
<Button onClick={handleToggleClick}
icon="pencil" >
size="small" {name}
floated="right" </span>
disabled={!isPersisted} {canEdit && (
className={styles.editButton} <Button
onClick={onEdit} icon="pencil"
/> size="small"
)} floated="right"
</div> disabled={!isPersisted}
className={styles.editButton}
onClick={onEdit}
/>
)}
</div>
);
return isDragging ? ReactDOM.createPortal(contentNode, document.body) : contentNode;
}}
</Draggable>
); );
}, },
); );
Item.propTypes = { Item.propTypes = {
id: PropTypes.string.isRequired,
index: PropTypes.number.isRequired,
name: PropTypes.string, name: PropTypes.string,
color: PropTypes.string.isRequired, color: PropTypes.string.isRequired,
isPersisted: PropTypes.bool.isRequired, isPersisted: PropTypes.bool.isRequired,
@@ -12,16 +12,15 @@
} }
} }
.labelButton { .name {
border-radius: 3px;
color: #fff; color: #fff;
cursor: pointer;
flex: 1 1 auto; flex: 1 1 auto;
font-size: 14px;
font-weight: bold; font-weight: bold;
margin-right: 0;
overflow: hidden; overflow: hidden;
padding: 8px 32px 8px 10px; padding: 8px 32px 8px 10px;
position: relative; position: relative;
text-align: left;
text-overflow: ellipsis; text-overflow: ellipsis;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2); text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
@@ -30,7 +29,7 @@
} }
} }
.labelButtonActive:before { .nameActive:before {
bottom: 1px; bottom: 1px;
content: "Г"; content: "Г";
font-size: 18px; font-size: 18px;
+57 -16
View File
@@ -2,10 +2,12 @@ import pick from 'lodash/pick';
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 { DragDropContext, Droppable } from 'react-beautiful-dnd';
import { Button } from 'semantic-ui-react'; import { Button } from 'semantic-ui-react';
import { Input, Popup } from '../../lib/custom-ui'; import { Input, Popup } from '../../lib/custom-ui';
import { useField, useSteps } from '../../hooks'; import { useField, useSteps } from '../../hooks';
import DroppableTypes from '../../constants/DroppableTypes';
import AddStep from './AddStep'; import AddStep from './AddStep';
import EditStep from './EditStep'; import EditStep from './EditStep';
import Item from './Item'; import Item from './Item';
@@ -27,6 +29,7 @@ const LabelsStep = React.memo(
onDeselect, onDeselect,
onCreate, onCreate,
onUpdate, onUpdate,
onMove,
onDelete, onDelete,
onBack, onBack,
}) => { }) => {
@@ -74,6 +77,17 @@ const LabelsStep = React.memo(
[onDeselect], [onDeselect],
); );
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);
@@ -89,7 +103,9 @@ const LabelsStep = React.memo(
); );
useEffect(() => { useEffect(() => {
searchField.current.focus(); searchField.current.focus({
preventScroll: true,
});
}, []); }, []);
if (step) { if (step) {
@@ -143,21 +159,45 @@ const LabelsStep = React.memo(
onChange={handleSearchChange} onChange={handleSearchChange}
/> />
{filteredItems.length > 0 && ( {filteredItems.length > 0 && (
<div className={styles.items}> <DragDropContext onDragEnd={handleDragEnd}>
{filteredItems.map((item) => ( <Droppable droppableId="labels" type={DroppableTypes.LABEL}>
<Item {({ innerRef, droppableProps, placeholder }) => (
key={item.id} <div
name={item.name} {...droppableProps} // eslint-disable-line react/jsx-props-no-spreading
color={item.color} ref={innerRef}
isPersisted={item.isPersisted} className={styles.items}
isActive={currentIds.includes(item.id)} >
canEdit={canEdit} {filteredItems.map((item, index) => (
onSelect={() => handleSelect(item.id)} <Item
onDeselect={() => handleDeselect(item.id)} key={item.id}
onEdit={() => handleEdit(item.id)} id={item.id}
/> index={index}
))} name={item.name}
</div> color={item.color}
isPersisted={item.isPersisted}
isActive={currentIds.includes(item.id)}
canEdit={canEdit}
onSelect={() => handleSelect(item.id)}
onDeselect={() => handleDeselect(item.id)}
onEdit={() => handleEdit(item.id)}
/>
))}
{placeholder}
</div>
)}
</Droppable>
<Droppable droppableId="labels:hack" type={DroppableTypes.LABEL}>
{({ innerRef, droppableProps, placeholder }) => (
<div
{...droppableProps} // eslint-disable-line react/jsx-props-no-spreading
ref={innerRef}
className={styles.droppableHack}
>
{placeholder}
</div>
)}
</Droppable>
</DragDropContext>
)} )}
{canEdit && ( {canEdit && (
<Button <Button
@@ -184,6 +224,7 @@ LabelsStep.propTypes = {
onDeselect: PropTypes.func.isRequired, onDeselect: PropTypes.func.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,
onBack: PropTypes.func, onBack: PropTypes.func,
}; };
@@ -15,9 +15,14 @@
} }
} }
.droppableHack {
display: none;
position: fixed;
}
.items { .items {
margin-top: 8px; margin-top: 8px;
max-height: 320px; max-height: 60vh;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
scrollbar-width: thin; scrollbar-width: thin;
+26 -16
View File
@@ -21,36 +21,46 @@ const CardAdd = React.memo(({ isOpened, onCreate, onClose }) => {
const nameField = useRef(null); const nameField = useRef(null);
const submit = useCallback(() => { const submit = useCallback(
const cleanData = { (autoOpen) => {
...data, const cleanData = {
name: data.name.trim(), ...data,
}; name: data.name.trim(),
};
if (!cleanData.name) { if (!cleanData.name) {
nameField.current.ref.current.select(); nameField.current.ref.current.select();
return; return;
} }
onCreate(cleanData); onCreate(cleanData, autoOpen);
setData(DEFAULT_DATA);
setData(DEFAULT_DATA); if (autoOpen) {
focusNameField(); onClose();
}, [onCreate, data, setData, focusNameField]); } else {
focusNameField();
}
},
[onCreate, onClose, data, setData, focusNameField],
);
const handleFieldKeyDown = useCallback( const handleFieldKeyDown = useCallback(
(event) => { (event) => {
switch (event.key) { switch (event.key) {
case 'Enter': case 'Enter': {
event.preventDefault(); event.preventDefault();
submit(); const autoOpen = event.ctrlKey;
submit(autoOpen);
break; break;
case 'Escape': }
case 'Escape': {
onClose(); onClose();
break; break;
}
default: default:
} }
}, },
+3 -7
View File
@@ -95,18 +95,14 @@ const List = React.memo(
ref={innerRef} ref={innerRef}
className={styles.innerWrapper} className={styles.innerWrapper}
> >
{/* eslint-disable jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions,
react/jsx-props-no-spreading */}
<div className={styles.outerWrapper}> <div className={styles.outerWrapper}>
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions */}
<div <div
{...dragHandleProps} {...dragHandleProps} // eslint-disable-line react/jsx-props-no-spreading
className={classNames(styles.header, canEdit && styles.headerEditable)} className={classNames(styles.header, canEdit && styles.headerEditable)}
onClick={handleHeaderClick} onClick={handleHeaderClick}
> >
{/* eslint-enable jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions,
react/jsx-props-no-spreading */}
<NameEdit ref={nameEdit} defaultValue={name} onUpdate={handleNameUpdate}> <NameEdit ref={nameEdit} defaultValue={name} onUpdate={handleNameUpdate}>
<div className={styles.headerName}>{name}</div> <div className={styles.headerName}>{name}</div>
</NameEdit> </NameEdit>
@@ -28,8 +28,8 @@ const ActionsStep = React.memo(
deleteConfirmationTitle, deleteConfirmationTitle,
deleteConfirmationContent, deleteConfirmationContent,
deleteConfirmationButtonContent, deleteConfirmationButtonContent,
canLeave,
canEdit, canEdit,
canLeave,
onUpdate, onUpdate,
onDelete, onDelete,
onClose, onClose,
@@ -50,10 +50,8 @@ const ActionsStep = React.memo(
if (onUpdate) { if (onUpdate) {
onUpdate(data); onUpdate(data);
} }
onClose();
}, },
[onUpdate, onClose], [onUpdate],
); );
if (step) { if (step) {
@@ -68,6 +66,7 @@ const ActionsStep = React.memo(
buttonContent="action.save" buttonContent="action.save"
onSelect={handleRoleSelect} onSelect={handleRoleSelect}
onBack={handleBack} onBack={handleBack}
onClose={onClose}
/> />
); );
} }
@@ -146,8 +145,8 @@ ActionsStep.propTypes = {
deleteConfirmationTitle: PropTypes.string, deleteConfirmationTitle: PropTypes.string,
deleteConfirmationContent: PropTypes.string, deleteConfirmationContent: PropTypes.string,
deleteConfirmationButtonContent: PropTypes.string, deleteConfirmationButtonContent: PropTypes.string,
canLeave: PropTypes.bool.isRequired,
canEdit: PropTypes.bool.isRequired, canEdit: PropTypes.bool.isRequired,
canLeave: PropTypes.bool.isRequired,
onUpdate: PropTypes.func, onUpdate: PropTypes.func,
onDelete: PropTypes.func.isRequired, onDelete: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired,
@@ -56,14 +56,14 @@ const AddStep = React.memo(
userId: step.params.userId, userId: step.params.userId,
...data, ...data,
}); });
onClose();
}, },
[onCreate, onClose, step], [onCreate, step],
); );
useEffect(() => { useEffect(() => {
searchField.current.focus(); searchField.current.focus({
preventScroll: true,
});
}, []); }, []);
if (step) { if (step) {
@@ -79,6 +79,7 @@ const AddStep = React.memo(
buttonContent="action.addMember" buttonContent="action.addMember"
onSelect={handleRoleSelect} onSelect={handleRoleSelect}
onBack={handleBack} onBack={handleBack}
onClose={onClose}
/> />
); );
} }
@@ -1,7 +1,7 @@
:global(#app) { :global(#app) {
.users { .users {
margin-top: 8px; margin-top: 8px;
max-height: 320px; max-height: 60vh;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
scrollbar-width: thin; scrollbar-width: thin;
@@ -44,8 +44,8 @@ const Memberships = React.memo(
deleteConfirmationTitle={deleteConfirmationTitle} deleteConfirmationTitle={deleteConfirmationTitle}
deleteConfirmationContent={deleteConfirmationContent} deleteConfirmationContent={deleteConfirmationContent}
deleteConfirmationButtonContent={deleteConfirmationButtonContent} deleteConfirmationButtonContent={deleteConfirmationButtonContent}
canLeave={items.length > 1 || canLeaveIfLast}
canEdit={canEdit} canEdit={canEdit}
canLeave={items.length > 1 || canLeaveIfLast}
onUpdate={(data) => onUpdate(item.id, data)} onUpdate={(data) => onUpdate(item.id, data)}
onDelete={() => onDelete(item.id)} onDelete={() => onDelete(item.id)}
> >
+5 -5
View File
@@ -6,7 +6,7 @@ import { ReduxRouter } from '../lib/redux-router';
import Paths from '../constants/Paths'; import Paths from '../constants/Paths';
import LoginContainer from '../containers/LoginContainer'; import LoginContainer from '../containers/LoginContainer';
import CoreWrapperContainer from '../containers/CoreWrapperContainer'; import CoreContainer from '../containers/CoreContainer';
import NotFound from './NotFound'; import NotFound from './NotFound';
import 'react-datepicker/dist/react-datepicker.css'; import 'react-datepicker/dist/react-datepicker.css';
@@ -22,10 +22,10 @@ function Root({ store, history }) {
<ReduxRouter history={history}> <ReduxRouter history={history}>
<Routes> <Routes>
<Route path={Paths.LOGIN} element={<LoginContainer />} /> <Route path={Paths.LOGIN} element={<LoginContainer />} />
<Route path={Paths.ROOT} element={<CoreWrapperContainer />} /> <Route path={Paths.ROOT} element={<CoreContainer />} />
<Route path={Paths.PROJECTS} element={<CoreWrapperContainer />} /> <Route path={Paths.PROJECTS} element={<CoreContainer />} />
<Route path={Paths.BOARDS} element={<CoreWrapperContainer />} /> <Route path={Paths.BOARDS} element={<CoreContainer />} />
<Route path={Paths.CARDS} element={<CoreWrapperContainer />} /> <Route path={Paths.CARDS} element={<CoreContainer />} />
<Route path="*" element={<NotFound />} /> <Route path="*" element={<NotFound />} />
</Routes> </Routes>
</ReduxRouter> </ReduxRouter>
+24 -16
View File
@@ -2,19 +2,19 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { useTranslation, Trans } from 'react-i18next'; import { useTranslation, Trans } from 'react-i18next';
import { Icon } from 'semantic-ui-react'; import { Icon, Loader } from 'semantic-ui-react';
import ProjectsContainer from '../../containers/ProjectsContainer'; import ProjectsContainer from '../../containers/ProjectsContainer';
import BoardWrapperContainer from '../../containers/BoardWrapperContainer'; import BoardContainer from '../../containers/BoardContainer';
import styles from './Static.module.scss'; import styles from './Static.module.scss';
function Static({ cardId, boardId, projectId }) { function Static({ projectId, cardId, board }) {
const [t] = useTranslation(); const [t] = useTranslation();
if (projectId === undefined) { if (projectId === undefined) {
return ( return (
<div className={styles.root}> <div className={styles.wrapper}>
<ProjectsContainer /> <ProjectsContainer />
</div> </div>
); );
@@ -22,7 +22,7 @@ function Static({ cardId, boardId, projectId }) {
if (cardId === null) { if (cardId === null) {
return ( return (
<div className={classNames(styles.root, styles.flex)}> <div className={classNames(styles.wrapper, styles.wrapperFlex)}>
<div className={styles.message}> <div className={styles.message}>
<h1> <h1>
{t('common.cardNotFound', { {t('common.cardNotFound', {
@@ -34,9 +34,9 @@ function Static({ cardId, boardId, projectId }) {
); );
} }
if (boardId === null) { if (board === null) {
return ( return (
<div className={classNames(styles.root, styles.flex)}> <div className={classNames(styles.wrapper, styles.wrapperFlex)}>
<div className={styles.message}> <div className={styles.message}>
<h1> <h1>
{t('common.boardNotFound', { {t('common.boardNotFound', {
@@ -50,7 +50,7 @@ function Static({ cardId, boardId, projectId }) {
if (projectId === null) { if (projectId === null) {
return ( return (
<div className={classNames(styles.root, styles.flex)}> <div className={classNames(styles.wrapper, styles.wrapperFlex)}>
<div className={styles.message}> <div className={styles.message}>
<h1> <h1>
{t('common.projectNotFound', { {t('common.projectNotFound', {
@@ -62,9 +62,9 @@ function Static({ cardId, boardId, projectId }) {
); );
} }
if (boardId === undefined) { if (board === undefined) {
return ( return (
<div className={classNames(styles.board, styles.flex)}> <div className={classNames(styles.wrapper, styles.wrapperFlex, styles.wrapperProject)}>
<div className={styles.message}> <div className={styles.message}>
<Icon inverted name="hand point up outline" size="huge" className={styles.messageIcon} /> <Icon inverted name="hand point up outline" size="huge" className={styles.messageIcon} />
<h1 className={styles.messageTitle}> <h1 className={styles.messageTitle}>
@@ -80,23 +80,31 @@ function Static({ cardId, boardId, projectId }) {
); );
} }
if (board.isFetching) {
return (
<div className={classNames(styles.wrapper, styles.wrapperLoader, styles.wrapperProject)}>
<Loader active size="big" />
</div>
);
}
return ( return (
<div className={classNames(styles.board, styles.flex)}> <div className={classNames(styles.wrapper, styles.wrapperFlex, styles.wrapperBoard)}>
<BoardWrapperContainer /> <BoardContainer />
</div> </div>
); );
} }
Static.propTypes = { Static.propTypes = {
cardId: PropTypes.string,
boardId: PropTypes.string,
projectId: PropTypes.string, projectId: PropTypes.string,
cardId: PropTypes.string,
board: PropTypes.object, // eslint-disable-line react/forbid-prop-types
}; };
Static.defaultProps = { Static.defaultProps = {
cardId: undefined,
boardId: undefined,
projectId: undefined, projectId: undefined,
cardId: undefined,
board: undefined,
}; };
export default Static; export default Static;
+18 -10
View File
@@ -1,13 +1,4 @@
:global(#app) { :global(#app) {
.board {
margin-top: 174px;
}
.flex {
display: flex;
height: 100%;
}
.message { .message {
align-content: space-between; align-content: space-between;
align-items: center; align-items: center;
@@ -34,7 +25,24 @@
text-align: center; text-align: center;
} }
.root { .wrapper {
height: 100%;
margin-top: 50px; margin-top: 50px;
} }
.wrapperBoard {
margin-top: 174px;
}
.wrapperFlex {
display: flex;
}
.wrapperLoader {
position: relative;
}
.wrapperProject {
margin-top: 98px;
}
} }
@@ -88,7 +88,9 @@ const UserAddStep = React.memo(
}, [onCreate, data]); }, [onCreate, data]);
useEffect(() => { useEffect(() => {
emailField.current.focus(); emailField.current.focus({
preventScroll: true,
});
}, []); }, []);
useEffect(() => { useEffect(() => {
@@ -1,4 +1,3 @@
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';
@@ -78,16 +77,22 @@ const UserEmailEditStep = React.memo(
return; return;
} }
if (usePasswordConfirmation && !cleanData.currentPassword) { if (usePasswordConfirmation) {
currentPasswordField.current.focus(); if (!cleanData.currentPassword) {
return; currentPasswordField.current.focus();
return;
}
} else {
delete cleanData.currentPassword;
} }
onUpdate(usePasswordConfirmation ? cleanData : omit(cleanData, 'currentPassword')); onUpdate(cleanData);
}, [email, usePasswordConfirmation, onUpdate, onClose, data]); }, [email, usePasswordConfirmation, onUpdate, onClose, data]);
useEffect(() => { useEffect(() => {
emailField.current.focus(); emailField.current.focus({
preventScroll: true,
});
}, []); }, []);
useEffect(() => { useEffect(() => {
@@ -71,7 +71,9 @@ const UserPasswordEditStep = React.memo(
}, [usePasswordConfirmation, onUpdate, data]); }, [usePasswordConfirmation, onUpdate, data]);
useEffect(() => { useEffect(() => {
passwordField.current.focus(); passwordField.current.focus({
preventScroll: true,
});
}, []); }, []);
useEffect(() => { useEffect(() => {
@@ -73,7 +73,9 @@ const UserSettingsModal = React.memo(
), ),
}, },
{ {
menuItem: 'About Planka', menuItem: t('common.aboutPlanka', {
context: 'title',
}),
render: () => <AboutPane />, render: () => <AboutPane />,
}, },
]; ];
@@ -1,4 +1,3 @@
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';
@@ -78,16 +77,22 @@ const UserUsernameEditStep = React.memo(
return; return;
} }
if (usePasswordConfirmation && !cleanData.currentPassword) { if (usePasswordConfirmation) {
currentPasswordField.current.focus(); if (!cleanData.currentPassword) {
return; currentPasswordField.current.focus();
return;
}
} else {
delete cleanData.currentPassword;
} }
onUpdate(usePasswordConfirmation ? cleanData : omit(cleanData, 'currentPassword')); onUpdate(cleanData);
}, [username, usePasswordConfirmation, onUpdate, onClose, data]); }, [username, usePasswordConfirmation, onUpdate, onClose, data]);
useEffect(() => { useEffect(() => {
usernameField.current.focus(); usernameField.current.focus({
preventScroll: true,
});
}, []); }, []);
useEffect(() => { useEffect(() => {
+2
View File
@@ -1,10 +1,12 @@
const BOARD = 'BOARD'; const BOARD = 'BOARD';
const LABEL = 'LABEL';
const LIST = 'LIST'; const LIST = 'LIST';
const CARD = 'CARD'; const CARD = 'CARD';
const TASK = 'TASK'; const TASK = 'TASK';
export default { export default {
BOARD, BOARD,
LABEL,
LIST, LIST,
CARD, CARD,
TASK, TASK,
+1
View File
@@ -99,6 +99,7 @@ export default {
LABEL_CREATE_HANDLE: `${PREFIX}/LABEL_CREATE_HANDLE`, LABEL_CREATE_HANDLE: `${PREFIX}/LABEL_CREATE_HANDLE`,
LABEL_UPDATE: `${PREFIX}/LABEL_UPDATE`, LABEL_UPDATE: `${PREFIX}/LABEL_UPDATE`,
LABEL_UPDATE_HANDLE: `${PREFIX}/LABEL_UPDATE_HANDLE`, LABEL_UPDATE_HANDLE: `${PREFIX}/LABEL_UPDATE_HANDLE`,
LABEL_MOVE: `${PREFIX}/LABEL_MOVE`,
LABEL_DELETE: `${PREFIX}/LABEL_DELETE`, LABEL_DELETE: `${PREFIX}/LABEL_DELETE`,
LABEL_DELETE_HANDLE: `${PREFIX}/LABEL_DELETE_HANDLE`, LABEL_DELETE_HANDLE: `${PREFIX}/LABEL_DELETE_HANDLE`,
LABEL_TO_CARD_ADD: `${PREFIX}/LABEL_TO_CARD_ADD`, LABEL_TO_CARD_ADD: `${PREFIX}/LABEL_TO_CARD_ADD`,
-4
View File
@@ -3,10 +3,6 @@ export const ProjectBackgroundTypes = {
IMAGE: 'image', IMAGE: 'image',
}; };
export const BoardTypes = {
KANBAN: 'kanban',
};
export const BoardMembershipRoles = { export const BoardMembershipRoles = {
EDITOR: 'editor', EDITOR: 'editor',
VIEWER: 'viewer', VIEWER: 'viewer',
@@ -15,13 +15,16 @@ const mapStateToProps = (state) => {
const filterLabels = selectors.selectFilterLabelsForCurrentBoard(state); const filterLabels = selectors.selectFilterLabelsForCurrentBoard(state);
const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state); const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state);
const isCurrentUserEditor =
!!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR;
return { return {
memberships, memberships,
labels, labels,
filterUsers, filterUsers,
filterLabels, filterLabels,
allUsers, allUsers,
canEdit: !!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR, canEdit: isCurrentUserEditor,
canEditMemberships: isCurrentUserManager, canEditMemberships: isCurrentUserManager,
}; };
}; };
@@ -38,6 +41,7 @@ const mapDispatchToProps = (dispatch) =>
onLabelFromFilterRemove: entryActions.removeLabelFromFilterInCurrentBoard, onLabelFromFilterRemove: entryActions.removeLabelFromFilterInCurrentBoard,
onLabelCreate: entryActions.createLabelInCurrentBoard, onLabelCreate: entryActions.createLabelInCurrentBoard,
onLabelUpdate: entryActions.updateLabel, onLabelUpdate: entryActions.updateLabel,
onLabelMove: entryActions.moveLabel,
onLabelDelete: entryActions.deleteLabel, onLabelDelete: entryActions.deleteLabel,
}, },
dispatch, dispatch,
@@ -4,17 +4,20 @@ import { connect } from 'react-redux';
import selectors from '../selectors'; import selectors from '../selectors';
import entryActions from '../entry-actions'; import entryActions from '../entry-actions';
import { BoardMembershipRoles } from '../constants/Enums'; import { BoardMembershipRoles } from '../constants/Enums';
import BoardKanban from '../components/BoardKanban'; import Board from '../components/Board';
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const { cardId } = selectors.selectPath(state); const { cardId } = selectors.selectPath(state);
const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state); const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state);
const listIds = selectors.selectListIdsForCurrentBoard(state); const listIds = selectors.selectListIdsForCurrentBoard(state);
const isCurrentUserEditor =
!!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR;
return { return {
listIds, listIds,
isCardModalOpened: !!cardId, isCardModalOpened: !!cardId,
canEdit: !!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR, canEdit: isCurrentUserEditor,
}; };
}; };
@@ -28,4 +31,4 @@ const mapDispatchToProps = (dispatch) =>
dispatch, dispatch,
); );
export default connect(mapStateToProps, mapDispatchToProps)(BoardKanban); export default connect(mapStateToProps, mapDispatchToProps)(Board);
@@ -1,15 +0,0 @@
import { connect } from 'react-redux';
import selectors from '../selectors';
import BoardWrapper from '../components/BoardWrapper';
const mapStateToProps = (state) => {
const { type, isFetching } = selectors.selectCurrentBoard(state);
return {
type,
isFetching,
};
};
export default connect(mapStateToProps)(BoardWrapper);
+5 -2
View File
@@ -30,6 +30,9 @@ const makeMapStateToProps = () => {
const tasks = selectTasksByCardId(state, id); const tasks = selectTasksByCardId(state, id);
const notificationsTotal = selectNotificationsTotalByCardId(state, id); const notificationsTotal = selectNotificationsTotalByCardId(state, id);
const isCurrentUserEditor =
!!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR;
return { return {
id, id,
index, index,
@@ -48,8 +51,7 @@ const makeMapStateToProps = () => {
allProjectsToLists, allProjectsToLists,
allBoardMemberships, allBoardMemberships,
allLabels, allLabels,
canEdit: canEdit: isCurrentUserEditor,
!!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR,
}; };
}; };
}; };
@@ -68,6 +70,7 @@ const mapDispatchToProps = (dispatch, { id }) =>
onLabelRemove: (labelId) => entryActions.removeLabelFromCard(labelId, id), onLabelRemove: (labelId) => entryActions.removeLabelFromCard(labelId, id),
onLabelCreate: (data) => entryActions.createLabelInCurrentBoard(data), onLabelCreate: (data) => entryActions.createLabelInCurrentBoard(data),
onLabelUpdate: (labelId, data) => entryActions.updateLabel(labelId, data), onLabelUpdate: (labelId, data) => entryActions.updateLabel(labelId, data),
onLabelMove: (labelId, index) => entryActions.moveLabel(labelId, index),
onLabelDelete: (labelId) => entryActions.deleteLabel(labelId), onLabelDelete: (labelId) => entryActions.deleteLabel(labelId),
}, },
dispatch, dispatch,
+11 -5
View File
@@ -37,6 +37,14 @@ const mapStateToProps = (state) => {
const attachments = selectors.selectAttachmentsForCurrentCard(state); const attachments = selectors.selectAttachmentsForCurrentCard(state);
const activities = selectors.selectActivitiesForCurrentCard(state); const activities = selectors.selectActivitiesForCurrentCard(state);
let isCurrentUserEditor = false;
let isCurrentUserEditorOrCanComment = false;
if (currentUserMembership) {
isCurrentUserEditor = currentUserMembership.role === BoardMembershipRoles.EDITOR;
isCurrentUserEditorOrCanComment = isCurrentUserEditor || currentUserMembership.canComment;
}
return { return {
name, name,
description, description,
@@ -58,11 +66,8 @@ const mapStateToProps = (state) => {
allProjectsToLists, allProjectsToLists,
allBoardMemberships, allBoardMemberships,
allLabels, allLabels,
canEdit: !!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR, canEdit: isCurrentUserEditor,
canEditCommentActivities: canEditCommentActivities: isCurrentUserEditorOrCanComment,
!!currentUserMembership &&
(currentUserMembership.role === BoardMembershipRoles.EDITOR ||
currentUserMembership.canComment),
canEditAllCommentActivities: isCurrentUserManager, canEditAllCommentActivities: isCurrentUserManager,
}; };
}; };
@@ -81,6 +86,7 @@ const mapDispatchToProps = (dispatch) =>
onLabelRemove: entryActions.removeLabelFromCurrentCard, onLabelRemove: entryActions.removeLabelFromCurrentCard,
onLabelCreate: entryActions.createLabelInCurrentBoard, onLabelCreate: entryActions.createLabelInCurrentBoard,
onLabelUpdate: entryActions.updateLabel, onLabelUpdate: entryActions.updateLabel,
onLabelMove: entryActions.moveLabel,
onLabelDelete: entryActions.deleteLabel, onLabelDelete: entryActions.deleteLabel,
onTaskCreate: entryActions.createTaskInCurrentCard, onTaskCreate: entryActions.createTaskInCurrentCard,
onTaskUpdate: entryActions.updateTask, onTaskUpdate: entryActions.updateTask,
+4
View File
@@ -4,12 +4,16 @@ import selectors from '../selectors';
import Core from '../components/Core'; import Core from '../components/Core';
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const isCoreInitializing = selectors.selectIsCoreInitializing(state);
const isSocketDisconnected = selectors.selectIsSocketDisconnected(state);
const currentModal = selectors.selectCurrentModal(state); const currentModal = selectors.selectCurrentModal(state);
const currentProject = selectors.selectCurrentProject(state); const currentProject = selectors.selectCurrentProject(state);
return { return {
isSocketDisconnected,
currentModal, currentModal,
currentProject, currentProject,
isInitializing: isCoreInitializing,
}; };
}; };
@@ -1,15 +0,0 @@
import { connect } from 'react-redux';
import selectors from '../selectors';
import CoreWrapper from '../components/CoreWrapper';
const mapStateToProps = (state) => {
const isCoreInitializing = selectors.selectIsCoreInitializing(state);
return {
isInitializing: isCoreInitializing,
isSocketDisconnected: state.socket.isDisconnected,
};
};
export default connect(mapStateToProps)(CoreWrapper);
+5 -3
View File
@@ -15,14 +15,16 @@ const makeMapStateToProps = () => {
const cardIds = selectCardIdsByListId(state, id); const cardIds = selectCardIdsByListId(state, id);
const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state); const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state);
const isCurrentUserEditor =
!!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR;
return { return {
id, id,
index, index,
name, name,
isPersisted, isPersisted,
cardIds, cardIds,
canEdit: canEdit: isCurrentUserEditor,
!!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR,
}; };
}; };
}; };
@@ -32,7 +34,7 @@ const mapDispatchToProps = (dispatch, { id }) =>
{ {
onUpdate: (data) => entryActions.updateList(id, data), onUpdate: (data) => entryActions.updateList(id, data),
onDelete: () => entryActions.deleteList(id), onDelete: () => entryActions.deleteList(id),
onCardCreate: (data) => entryActions.createCard(id, data), onCardCreate: (data, autoOpen) => entryActions.createCard(id, data, autoOpen),
}, },
dispatch, dispatch,
); );
+4 -3
View File
@@ -4,12 +4,13 @@ import selectors from '../selectors';
import Static from '../components/Static'; import Static from '../components/Static';
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const { cardId, boardId, projectId } = selectors.selectPath(state); const { cardId, projectId } = selectors.selectPath(state);
const currentBoard = selectors.selectCurrentBoard(state);
return { return {
cardId,
boardId,
projectId, projectId,
cardId,
board: currentBoard,
}; };
}; };
+2 -1
View File
@@ -1,10 +1,11 @@
import EntryActionTypes from '../constants/EntryActionTypes'; import EntryActionTypes from '../constants/EntryActionTypes';
const createCard = (listId, data) => ({ const createCard = (listId, data, autoOpen) => ({
type: EntryActionTypes.CARD_CREATE, type: EntryActionTypes.CARD_CREATE,
payload: { payload: {
listId, listId,
data, data,
autoOpen,
}, },
}); });
+9
View File
@@ -29,6 +29,14 @@ const handleLabelUpdate = (label) => ({
}, },
}); });
const moveLabel = (id, index) => ({
type: EntryActionTypes.LABEL_MOVE,
payload: {
id,
index,
},
});
const deleteLabel = (id) => ({ const deleteLabel = (id) => ({
type: EntryActionTypes.LABEL_DELETE, type: EntryActionTypes.LABEL_DELETE,
payload: { payload: {
@@ -106,6 +114,7 @@ export default {
handleLabelCreate, handleLabelCreate,
updateLabel, updateLabel,
handleLabelUpdate, handleLabelUpdate,
moveLabel,
deleteLabel, deleteLabel,
handleLabelDelete, handleLabelDelete,
addLabelToCard, addLabelToCard,
@@ -3,9 +3,10 @@ import { Input as SemanticUIInput } from 'semantic-ui-react';
import InputPassword from './InputPassword'; import InputPassword from './InputPassword';
import InputMask from './InputMask'; import InputMask from './InputMask';
const Input = SemanticUIInput; export default class Input extends SemanticUIInput {
static Password = InputPassword;
Input.Password = InputPassword; static Mask = InputMask;
Input.Mask = InputMask;
export default Input; focus = (options) => this.inputRef.current.focus(options);
}
@@ -1,8 +1,8 @@
import InputMask from 'react-input-mask'; import InputMask from 'react-input-mask';
export default class MaskedInput extends InputMask { export default class MaskedInput extends InputMask {
focus() { focus(options) {
this.getInputDOMNode().focus(); this.getInputDOMNode().focus(options);
} }
select() { select() {
@@ -14,13 +14,12 @@ const Markdown = React.memo(({ linkStopPropagation, ...props }) => {
}, []); }, []);
const linkRenderer = useCallback( const linkRenderer = useCallback(
/* eslint-disable jsx-a11y/anchor-has-content,
jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions,
react/jsx-props-no-spreading */
({ node, ...linkProps }) => ( ({ node, ...linkProps }) => (
/* eslint-disable-next-line jsx-a11y/anchor-has-content,
jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions */
<a <a
{...linkProps} {...linkProps} // eslint-disable-line react/jsx-props-no-spreading
rel={ rel={
ABSOLUTE_URL_REGEX.test(linkProps.href) && linkProps.target === '_blank' ABSOLUTE_URL_REGEX.test(linkProps.href) && linkProps.target === '_blank'
? 'noreferrer' ? 'noreferrer'
@@ -29,10 +28,6 @@ const Markdown = React.memo(({ linkStopPropagation, ...props }) => {
onClick={linkStopPropagation ? handleLinkClick : undefined} onClick={linkStopPropagation ? handleLinkClick : undefined}
/> />
), ),
/* eslint-enable jsx-a11y/anchor-has-content,
jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions,
react/jsx-props-no-spreading */
[linkStopPropagation, handleLinkClick], [linkStopPropagation, handleLinkClick],
); );
+11 -2
View File
@@ -6,7 +6,7 @@ import { Button, Popup as SemanticUIPopup } from 'semantic-ui-react';
import styles from './Popup.module.css'; import styles from './Popup.module.css';
export default (WrappedComponent, defaultProps) => { export default (WrappedComponent, defaultProps) => {
const Popup = React.memo(({ children, ...props }) => { const Popup = React.memo(({ children, onClose, ...props }) => {
const [isOpened, setIsOpened] = useState(false); const [isOpened, setIsOpened] = useState(false);
const wrapper = useRef(null); const wrapper = useRef(null);
@@ -18,7 +18,11 @@ export default (WrappedComponent, defaultProps) => {
const handleClose = useCallback(() => { const handleClose = useCallback(() => {
setIsOpened(false); setIsOpened(false);
}, []);
if (onClose) {
onClose();
}
}, [onClose]);
const handleMouseDown = useCallback((event) => { const handleMouseDown = useCallback((event) => {
event.stopPropagation(); event.stopPropagation();
@@ -105,6 +109,11 @@ export default (WrappedComponent, defaultProps) => {
Popup.propTypes = { Popup.propTypes = {
children: PropTypes.node.isRequired, children: PropTypes.node.isRequired,
onClose: PropTypes.func,
};
Popup.defaultProps = {
onClose: undefined,
}; };
return Popup; return Popup;
+2 -1
View File
@@ -9,6 +9,7 @@ export default {
translation: { translation: {
common: { common: {
aboutPlanka: 'About Planka',
account: 'Account', account: 'Account',
actions: 'Actions', actions: 'Actions',
addAttachment_title: 'Add Attachment', addAttachment_title: 'Add Attachment',
@@ -83,7 +84,7 @@ export default {
editUsername_title: 'Edit Username', editUsername_title: 'Edit Username',
email: 'E-mail', email: 'E-mail',
emailAlreadyInUse: 'E-mail already in use', emailAlreadyInUse: 'E-mail already in use',
enterCardTitle: 'Enter card title...', enterCardTitle: 'Enter card title... [Ctrl+Enter] to auto-open',
enterDescription: 'Enter description...', enterDescription: 'Enter description...',
enterFilename: 'Enter filename', enterFilename: 'Enter filename',
enterListTitle: 'Enter list title...', enterListTitle: 'Enter list title...',
+5 -5
View File
@@ -54,7 +54,7 @@ export default {
createProject_title: 'Crea Progetto', createProject_title: 'Crea Progetto',
createTextFile_title: 'Create File di Testo', createTextFile_title: 'Create File di Testo',
currentPassword: 'Password corrente', currentPassword: 'Password corrente',
dangerZone_title: 'Danger Zone', dangerZone_title: 'Zona pericolosa',
date: 'Data', date: 'Data',
dueDate_title: 'Data di scadenza', dueDate_title: 'Data di scadenza',
deleteAttachment_title: 'Elimina Allegato', deleteAttachment_title: 'Elimina Allegato',
@@ -219,10 +219,10 @@ export default {
showAllAttachments: 'Mostra tutti gli allegati ({{hidden}} hidden)', showAllAttachments: 'Mostra tutti gli allegati ({{hidden}} hidden)',
showDetails: 'Mostra dettagli', showDetails: 'Mostra dettagli',
showFewerAttachments: 'Mostra meno allegati', showFewerAttachments: 'Mostra meno allegati',
start: 'Start', start: 'Inizio',
stop: 'Stop', stop: 'Ferma',
subscribe: 'Subscribe', subscribe: 'Iscriviti',
unsubscribe: 'Unsubscribe', unsubscribe: 'Annulla iscrizione',
uploadNewAvatar: 'Carica nuovo avatar', uploadNewAvatar: 'Carica nuovo avatar',
uploadNewImage: 'Carica nuova immagine', uploadNewImage: 'Carica nuova immagine',
}, },
+2 -2
View File
@@ -2,13 +2,13 @@ export default {
translation: { translation: {
common: { common: {
emailOrUsername: 'E-mail o username', emailOrUsername: 'E-mail o username',
invalidEmailOrUsername: 'E-mail or username invalido', invalidEmailOrUsername: 'E-mail o username non valido',
invalidPassword: 'Password non valida', invalidPassword: 'Password non valida',
logInToPlanka: 'Log in Planka', logInToPlanka: 'Log in Planka',
noInternetConnection: 'Nessuna connessione internet', noInternetConnection: 'Nessuna connessione internet',
pageNotFound_title: 'Pagina non trovata', pageNotFound_title: 'Pagina non trovata',
password: 'Password', password: 'Password',
projectManagement: 'Project management', projectManagement: 'Gestione del progetto',
serverConnectionFailed: 'Connesione al server fallita', serverConnectionFailed: 'Connesione al server fallita',
unknownError: 'Errore sconosciuto, prova ancora', unknownError: 'Errore sconosciuto, prova ancora',
}, },
+3 -2
View File
@@ -1,8 +1,9 @@
import { Model, attr, fk } from 'redux-orm'; import { attr, fk } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
export default class extends Model { export default class extends BaseModel {
static modelName = 'Activity'; static modelName = 'Activity';
static fields = { static fields = {
+3 -2
View File
@@ -1,8 +1,9 @@
import { Model, attr, fk } from 'redux-orm'; import { attr, fk } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
export default class extends Model { export default class extends BaseModel {
static modelName = 'Attachment'; static modelName = 'Attachment';
static fields = { static fields = {
+6
View File
@@ -0,0 +1,6 @@
import { Model } from 'redux-orm';
export default class BaseModel extends Model {
// eslint-disable-next-line no-underscore-dangle, class-methods-use-this
_onDelete() {}
}
+15 -5
View File
@@ -1,13 +1,13 @@
import { Model, attr, fk, many } from 'redux-orm'; import { attr, fk, many } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
export default class extends Model { export default class extends BaseModel {
static modelName = 'Board'; static modelName = 'Board';
static fields = { static fields = {
id: attr(), id: attr(),
type: attr(),
position: attr(), position: attr(),
name: attr(), name: attr(),
isFetching: attr({ isFetching: attr({
@@ -175,11 +175,15 @@ export default class extends Model {
return this.memberships.orderBy('id'); return this.memberships.orderBy('id');
} }
getOrderedLabelsQuerySet() {
return this.labels.orderBy('position');
}
getOrderedListsQuerySet() { getOrderedListsQuerySet() {
return this.lists.orderBy('position'); return this.lists.orderBy('position');
} }
getMembershipModel(userId) { getMembershipModelForUser(userId) {
return this.memberships return this.memberships
.filter({ .filter({
userId, userId,
@@ -187,7 +191,7 @@ export default class extends Model {
.first(); .first();
} }
hasMemberUser(userId) { hasMembershipForUser(userId) {
return this.memberships return this.memberships
.filter({ .filter({
userId, userId,
@@ -195,6 +199,12 @@ export default class extends Model {
.exists(); .exists();
} }
isAvailableForUser(userId) {
return (
this.project && (this.project.hasManagerForUser(userId) || this.hasMembershipForUser(userId))
);
}
deleteRelated(exceptMemberUserId) { deleteRelated(exceptMemberUserId) {
this.memberships.toModelArray().forEach((boardMembershipModel) => { this.memberships.toModelArray().forEach((boardMembershipModel) => {
if (boardMembershipModel.userId !== exceptMemberUserId) { if (boardMembershipModel.userId !== exceptMemberUserId) {
+3 -2
View File
@@ -1,8 +1,9 @@
import { Model, attr, fk } from 'redux-orm'; import { attr, fk } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
export default class extends Model { export default class extends BaseModel {
static modelName = 'BoardMembership'; static modelName = 'BoardMembership';
static fields = { static fields = {
+38 -14
View File
@@ -1,10 +1,11 @@
import { Model, attr, fk, many, oneToOne } from 'redux-orm'; import { attr, fk, many, oneToOne } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
import Config from '../constants/Config'; import Config from '../constants/Config';
import { ActivityTypes } from '../constants/Enums'; import { ActivityTypes } from '../constants/Enums';
export default class extends Model { export default class extends BaseModel {
static modelName = 'Card'; static modelName = 'Card';
static fields = { static fields = {
@@ -74,7 +75,11 @@ export default class extends Model {
break; break;
case ActionTypes.SOCKET_RECONNECT_HANDLE: case ActionTypes.SOCKET_RECONNECT_HANDLE:
Card.all().delete(); Card.all()
.toModelArray()
.forEach((cardModel) => {
cardModel.deleteWithClearable();
});
if (payload.cards) { if (payload.cards) {
payload.cards.forEach((card) => { payload.cards.forEach((card) => {
@@ -176,7 +181,7 @@ export default class extends Model {
break; break;
case ActionTypes.CARD_DELETE: case ActionTypes.CARD_DELETE:
Card.withId(payload.id).delete(); Card.withId(payload.id).deleteWithRelated();
break; break;
case ActionTypes.CARD_DELETE__SUCCESS: case ActionTypes.CARD_DELETE__SUCCESS:
@@ -220,15 +225,7 @@ export default class extends Model {
isActivitiesDetailsFetching: false, isActivitiesDetailsFetching: false,
}); });
cardModel.activities.toModelArray().forEach((activityModel) => { cardModel.deleteActivities();
if (activityModel.notification) {
activityModel.update({
isInCard: false,
});
} else {
activityModel.delete();
}
});
break; break;
} }
@@ -268,10 +265,37 @@ export default class extends Model {
}); });
} }
isAvailableForUser(userId) {
return this.board && this.board.isAvailableForUser(userId);
}
deleteClearable() {
this.users.clear();
this.labels.clear();
}
deleteActivities() {
this.activities.toModelArray().forEach((activityModel) => {
if (activityModel.notification) {
activityModel.update({
isInCard: false,
});
} else {
activityModel.delete();
}
});
}
deleteRelated() { deleteRelated() {
this.deleteClearable();
this.tasks.delete(); this.tasks.delete();
this.attachments.delete(); this.attachments.delete();
this.activities.delete(); this.deleteActivities();
}
deleteWithClearable() {
this.deleteClearable();
this.delete();
} }
deleteWithRelated() { deleteWithRelated() {
+4 -2
View File
@@ -1,12 +1,14 @@
import { Model, attr, fk } from 'redux-orm'; import { attr, fk } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
export default class extends Model { export default class extends BaseModel {
static modelName = 'Label'; static modelName = 'Label';
static fields = { static fields = {
id: attr(), id: attr(),
position: attr(),
name: attr(), name: attr(),
color: attr(), color: attr(),
boardId: fk({ boardId: fk({
+3 -2
View File
@@ -1,8 +1,9 @@
import { Model, attr, fk } from 'redux-orm'; import { attr, fk } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
export default class extends Model { export default class extends BaseModel {
static modelName = 'List'; static modelName = 'List';
static fields = { static fields = {
+3 -2
View File
@@ -1,8 +1,9 @@
import { Model, attr, fk, oneToOne } from 'redux-orm'; import { attr, fk, oneToOne } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
export default class extends Model { export default class extends BaseModel {
static modelName = 'Notification'; static modelName = 'Notification';
static fields = { static fields = {
+15 -10
View File
@@ -1,9 +1,10 @@
import { Model, attr, many } from 'redux-orm'; import { attr, many } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
import { ProjectBackgroundTypes } from '../constants/Enums'; import { ProjectBackgroundTypes } from '../constants/Enums';
export default class extends Model { export default class extends BaseModel {
static modelName = 'Project'; static modelName = 'Project';
static fields = { static fields = {
@@ -143,21 +144,21 @@ export default class extends Model {
return this.boards.orderBy('position'); return this.boards.orderBy('position');
} }
getOrderedMemberBoardsModelArray(userId) { getOrderedBoardsModelArrayForUser(userId) {
return this.getOrderedBoardsQuerySet() return this.getOrderedBoardsQuerySet()
.toModelArray() .toModelArray()
.filter((boardModel) => boardModel.hasMemberUser(userId)); .filter((boardModel) => boardModel.hasMembershipForUser(userId));
} }
getOrderedAvailableBoardsModelArray(userId) { getOrderedBoardsModelArrayAvailableForUser(userId) {
if (this.hasManagerUser(userId)) { if (this.hasManagerForUser(userId)) {
return this.getOrderedBoardsQuerySet().toModelArray(); return this.getOrderedBoardsQuerySet().toModelArray();
} }
return this.getOrderedMemberBoardsModelArray(userId); return this.getOrderedBoardsModelArrayForUser(userId);
} }
hasManagerUser(userId) { hasManagerForUser(userId) {
return this.managers return this.managers
.filter({ .filter({
userId, userId,
@@ -165,8 +166,12 @@ export default class extends Model {
.exists(); .exists();
} }
hasMemberUserForAnyBoard(userId) { hasMembershipInAnyBoardForUser(userId) {
return this.boards.toModelArray().some((boardModel) => boardModel.hasMemberUser(userId)); return this.boards.toModelArray().some((boardModel) => boardModel.hasMembershipForUser(userId));
}
isAvailableForUser(userId) {
return this.hasManagerForUser(userId) || this.hasMembershipInAnyBoardForUser(userId);
} }
deleteRelated() { deleteRelated() {
+3 -2
View File
@@ -1,8 +1,9 @@
import { Model, attr, fk } from 'redux-orm'; import { attr, fk } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
export default class extends Model { export default class extends BaseModel {
static modelName = 'ProjectManager'; static modelName = 'ProjectManager';
static fields = { static fields = {
+3 -2
View File
@@ -1,8 +1,9 @@
import { Model, attr, fk } from 'redux-orm'; import { attr, fk } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
export default class extends Model { export default class extends BaseModel {
static modelName = 'Task'; static modelName = 'Task';
static fields = { static fields = {
+3 -2
View File
@@ -1,5 +1,6 @@
import { Model, attr } from 'redux-orm'; import { attr } from 'redux-orm';
import BaseModel from './BaseModel';
import ActionTypes from '../constants/ActionTypes'; import ActionTypes from '../constants/ActionTypes';
const DEFAULT_EMAIL_UPDATE_FORM = { const DEFAULT_EMAIL_UPDATE_FORM = {
@@ -29,7 +30,7 @@ const DEFAULT_USERNAME_UPDATE_FORM = {
error: null, error: null,
}; };
export default class extends Model { export default class extends BaseModel {
static modelName = 'User'; static modelName = 'User';
static fields = { static fields = {
+1 -1
View File
@@ -47,7 +47,7 @@ export function* fetchBoardByCurrentPath() {
tasks, tasks,
attachments, attachments,
}, },
} = yield call(request, api.getBoard, boardId)); } = yield call(request, api.getBoard, boardId, true));
} }
} }
+1 -1
View File
@@ -6,7 +6,7 @@ import api from '../../../api';
import mergeRecords from '../../../utils/merge-records'; import mergeRecords from '../../../utils/merge-records';
export function* fetchCore() { export function* fetchCore() {
const { item: user } = yield call(request, api.getCurrentUser); const { item: user } = yield call(request, api.getCurrentUser, true);
const { items: users1 } = yield call(request, api.getUsers); const { items: users1 } = yield call(request, api.getUsers);
const { const {
@@ -62,7 +62,7 @@ export function* handleBoardMembershipCreate(boardMembership) {
if (isCurrentUser) { if (isCurrentUser) {
let board2; let board2;
try { try {
({ item: board2 } = yield call(request, api.getBoard, boardMembership.boardId)); ({ item: board2 } = yield call(request, api.getBoard, boardMembership.boardId, false));
} catch { } catch {
return; return;
} }
+1 -1
View File
@@ -96,7 +96,7 @@ export function* fetchBoard(id) {
tasks, tasks,
attachments, attachments,
}, },
} = yield call(request, api.getBoard, id)); } = yield call(request, api.getBoard, id, true));
} catch (error) { } catch (error) {
yield put(actions.fetchBoard.failure(id, error)); yield put(actions.fetchBoard.failure(id, error));
return; return;
+10 -5
View File
@@ -1,18 +1,17 @@
import { call, put, select } from 'redux-saga/effects'; import { call, put, select } from 'redux-saga/effects';
import { goToBoard } from './router'; import { goToBoard, goToCard } from './router';
import request from '../request'; import request from '../request';
import selectors from '../../../selectors'; import selectors from '../../../selectors';
import actions from '../../../actions'; import actions from '../../../actions';
import api from '../../../api'; import api from '../../../api';
import { createLocalId } from '../../../utils/local-id'; import { createLocalId } from '../../../utils/local-id';
export function* createCard(listId, data) { export function* createCard(listId, data, autoOpen) {
const { boardId } = yield select(selectors.selectListById, listId); const { boardId } = yield select(selectors.selectListById, listId);
const nextData = { const nextData = {
...data, ...data,
listId,
position: yield select(selectors.selectNextCardPosition, listId), position: yield select(selectors.selectNextCardPosition, listId),
}; };
@@ -22,19 +21,24 @@ export function* createCard(listId, data) {
actions.createCard({ actions.createCard({
...nextData, ...nextData,
boardId, boardId,
listId,
id: localId, id: localId,
}), }),
); );
let card; let card;
try { try {
({ item: card } = yield call(request, api.createCard, boardId, nextData)); ({ item: card } = yield call(request, api.createCard, listId, nextData));
} catch (error) { } catch (error) {
yield put(actions.createCard.failure(localId, error)); yield put(actions.createCard.failure(localId, error));
return; return;
} }
yield put(actions.createCard.success(localId, card)); yield put(actions.createCard.success(localId, card));
if (autoOpen) {
yield call(goToCard, card.id);
}
} }
export function* handleCardCreate(card) { export function* handleCardCreate(card) {
@@ -61,8 +65,9 @@ export function* updateCurrentCard(data) {
yield call(updateCard, cardId, data); yield call(updateCard, cardId, data);
} }
// TODO: handle card transfer
export function* handleCardUpdate(card) { export function* handleCardUpdate(card) {
yield put(actions.handleCardUpdate(card)); // TODO: handle card transfer yield put(actions.handleCardUpdate(card));
} }
export function* moveCard(id, listId, index) { export function* moveCard(id, listId, index) {
+17 -2
View File
@@ -7,11 +7,16 @@ import api from '../../../api';
import { createLocalId } from '../../../utils/local-id'; import { createLocalId } from '../../../utils/local-id';
export function* createLabel(boardId, data) { export function* createLabel(boardId, data) {
const nextData = {
...data,
position: yield select(selectors.selectNextLabelPosition, boardId),
};
const localId = yield call(createLocalId); const localId = yield call(createLocalId);
yield put( yield put(
actions.createLabel({ actions.createLabel({
...data, ...nextData,
boardId, boardId,
id: localId, id: localId,
}), }),
@@ -19,7 +24,7 @@ export function* createLabel(boardId, data) {
let label; let label;
try { try {
({ item: label } = yield call(request, api.createLabel, boardId, data)); ({ item: label } = yield call(request, api.createLabel, boardId, nextData));
} catch (error) { } catch (error) {
yield put(actions.createLabel.failure(localId, error)); yield put(actions.createLabel.failure(localId, error));
return; return;
@@ -56,6 +61,15 @@ export function* handleLabelUpdate(label) {
yield put(actions.handleLabelUpdate(label)); yield put(actions.handleLabelUpdate(label));
} }
export function* moveLabel(id, index) {
const { boardId } = yield select(selectors.selectLabelById, id);
const position = yield select(selectors.selectNextLabelPosition, boardId, index, id);
yield call(updateLabel, id, {
position,
});
}
export function* deleteLabel(id) { export function* deleteLabel(id) {
yield put(actions.deleteLabel(id)); yield put(actions.deleteLabel(id));
@@ -150,6 +164,7 @@ export default {
handleLabelCreate, handleLabelCreate,
updateLabel, updateLabel,
handleLabelUpdate, handleLabelUpdate,
moveLabel,
deleteLabel, deleteLabel,
handleLabelDelete, handleLabelDelete,
addLabelToCard, addLabelToCard,
+6 -6
View File
@@ -39,8 +39,8 @@ export function* createListInCurrentBoard(data) {
yield call(createList, boardId, data); yield call(createList, boardId, data);
} }
export function* handleListCreate(label) { export function* handleListCreate(list) {
yield put(actions.handleListCreate(label)); yield put(actions.handleListCreate(list));
} }
export function* updateList(id, data) { export function* updateList(id, data) {
@@ -57,8 +57,8 @@ export function* updateList(id, data) {
yield put(actions.updateList.success(list)); yield put(actions.updateList.success(list));
} }
export function* handleListUpdate(label) { export function* handleListUpdate(list) {
yield put(actions.handleListUpdate(label)); yield put(actions.handleListUpdate(list));
} }
export function* moveList(id, index) { export function* moveList(id, index) {
@@ -84,8 +84,8 @@ export function* deleteList(id) {
yield put(actions.deleteList.success(list)); yield put(actions.deleteList.success(list));
} }
export function* handleListDelete(label) { export function* handleListDelete(list) {
yield put(actions.handleListDelete(label)); yield put(actions.handleListDelete(list));
} }
export default { export default {
@@ -24,6 +24,7 @@ export function* createProjectManager(projectId, data) {
({ item: projectManager } = yield call(request, api.createProjectManager, projectId, data)); ({ item: projectManager } = yield call(request, api.createProjectManager, projectId, data));
} catch (error) { } catch (error) {
yield put(actions.createProjectManager.failure(localId, error)); yield put(actions.createProjectManager.failure(localId, error));
return;
} }
yield put(actions.createProjectManager.success(localId, projectManager)); yield put(actions.createProjectManager.success(localId, projectManager));
@@ -53,6 +53,7 @@ export function* updateProject(id, data) {
({ item: project } = yield call(request, api.updateProject, id, data)); ({ item: project } = yield call(request, api.updateProject, id, data));
} catch (error) { } catch (error) {
yield put(actions.updateProject.failure(id, error)); yield put(actions.updateProject.failure(id, error));
return;
} }
yield put(actions.updateProject.success(project)); yield put(actions.updateProject.success(project));
@@ -76,6 +77,7 @@ export function* updateProjectBackgroundImage(id, data) {
({ item: project } = yield call(request, api.updateProjectBackgroundImage, id, data)); ({ item: project } = yield call(request, api.updateProjectBackgroundImage, id, data));
} catch (error) { } catch (error) {
yield put(actions.updateProjectBackgroundImage.failure(id, error)); yield put(actions.updateProjectBackgroundImage.failure(id, error));
return;
} }
yield put(actions.updateProjectBackgroundImage.success(project)); yield put(actions.updateProjectBackgroundImage.success(project));
@@ -101,6 +103,7 @@ export function* deleteProject(id) {
({ item: project } = yield call(request, api.deleteProject, id)); ({ item: project } = yield call(request, api.deleteProject, id));
} catch (error) { } catch (error) {
yield put(actions.deleteProject.failure(id, error)); yield put(actions.deleteProject.failure(id, error));
return;
} }
yield put(actions.deleteProject.success(project)); yield put(actions.deleteProject.success(project));
+1 -1
View File
@@ -81,7 +81,7 @@ export function* handleLocationChange() {
tasks, tasks,
attachments, attachments,
}, },
} = yield call(request, api.getBoard, currentBoard.id)); } = yield call(request, api.getBoard, currentBoard.id, true));
} catch (error) {} // eslint-disable-line no-empty } catch (error) {} // eslint-disable-line no-empty
} }
+2 -2
View File
@@ -5,8 +5,8 @@ import EntryActionTypes from '../../../constants/EntryActionTypes';
export default function* cardsWatchers() { export default function* cardsWatchers() {
yield all([ yield all([
takeEvery(EntryActionTypes.CARD_CREATE, ({ payload: { listId, data } }) => takeEvery(EntryActionTypes.CARD_CREATE, ({ payload: { listId, data, autoOpen } }) =>
services.createCard(listId, data), services.createCard(listId, data, autoOpen),
), ),
takeEvery(EntryActionTypes.CARD_CREATE_HANDLE, ({ payload: { card } }) => takeEvery(EntryActionTypes.CARD_CREATE_HANDLE, ({ payload: { card } }) =>
services.handleCardCreate(card), services.handleCardCreate(card),
+3
View File
@@ -17,6 +17,9 @@ export default function* labelsWatchers() {
takeEvery(EntryActionTypes.LABEL_UPDATE_HANDLE, ({ payload: { label } }) => takeEvery(EntryActionTypes.LABEL_UPDATE_HANDLE, ({ payload: { label } }) =>
services.handleLabelUpdate(label), services.handleLabelUpdate(label),
), ),
takeEvery(EntryActionTypes.LABEL_MOVE, ({ payload: { id, index } }) =>
services.moveLabel(id, index),
),
takeEvery(EntryActionTypes.LABEL_DELETE, ({ payload: { id } }) => services.deleteLabel(id)), takeEvery(EntryActionTypes.LABEL_DELETE, ({ payload: { id } }) => services.deleteLabel(id)),
takeEvery(EntryActionTypes.LABEL_DELETE_HANDLE, ({ payload: { label } }) => takeEvery(EntryActionTypes.LABEL_DELETE_HANDLE, ({ payload: { label } }) =>
services.handleLabelDelete(label), services.handleLabelDelete(label),
+33 -30
View File
@@ -69,6 +69,31 @@ export const selectMembershipsForCurrentBoard = createSelector(
}, },
); );
export const selectCurrentUserMembershipForCurrentBoard = createSelector(
orm,
(state) => selectPath(state).boardId,
(state) => selectCurrentUserId(state),
({ Board }, id, currentUserId) => {
if (!id) {
return id;
}
const boardModel = Board.withId(id);
if (!boardModel) {
return boardModel;
}
const boardMembershipModel = boardModel.getMembershipModelForUser(currentUserId);
if (!boardMembershipModel) {
return boardMembershipModel;
}
return boardMembershipModel.ref;
},
);
export const selectLabelsForCurrentBoard = createSelector( export const selectLabelsForCurrentBoard = createSelector(
orm, orm,
(state) => selectPath(state).boardId, (state) => selectPath(state).boardId,
@@ -83,10 +108,13 @@ export const selectLabelsForCurrentBoard = createSelector(
return boardModel; return boardModel;
} }
return boardModel.labels.toRefArray().map((label) => ({ return boardModel
...label, .getOrderedLabelsQuerySet()
isPersisted: !isLocalId(label.id), .toRefArray()
})); .map((label) => ({
...label,
isPersisted: !isLocalId(label.id),
}));
}, },
); );
@@ -147,31 +175,6 @@ export const selectFilterLabelsForCurrentBoard = createSelector(
}, },
); );
export const selectCurrentUserMembershipForCurrentBoard = createSelector(
orm,
(state) => selectPath(state).boardId,
(state) => selectCurrentUserId(state),
({ Board }, id, currentUserId) => {
if (!id) {
return id;
}
const boardModel = Board.withId(id);
if (!boardModel) {
return boardModel;
}
const boardMembershipModel = boardModel.getMembershipModel(currentUserId);
if (!boardMembershipModel) {
return boardMembershipModel;
}
return boardMembershipModel.ref;
},
);
export const selectIsBoardWithIdExists = createSelector( export const selectIsBoardWithIdExists = createSelector(
orm, orm,
(_, id) => id, (_, id) => id,
@@ -183,10 +186,10 @@ export default {
selectBoardById, selectBoardById,
selectCurrentBoard, selectCurrentBoard,
selectMembershipsForCurrentBoard, selectMembershipsForCurrentBoard,
selectCurrentUserMembershipForCurrentBoard,
selectLabelsForCurrentBoard, selectLabelsForCurrentBoard,
selectListIdsForCurrentBoard, selectListIdsForCurrentBoard,
selectFilterUsersForCurrentBoard, selectFilterUsersForCurrentBoard,
selectFilterLabelsForCurrentBoard, selectFilterLabelsForCurrentBoard,
selectCurrentUserMembershipForCurrentBoard,
selectIsBoardWithIdExists, selectIsBoardWithIdExists,
}; };
+17
View File
@@ -49,6 +49,22 @@ export const selectNextBoardPosition = createSelector(
}, },
); );
export const selectNextLabelPosition = createSelector(
orm,
(_, boardId) => boardId,
(_, __, index) => index,
(_, __, ___, excludedId) => excludedId,
({ Board }, boardId, index, excludedId) => {
const boardModel = Board.withId(boardId);
if (!boardModel) {
return boardModel;
}
return nextPosition(boardModel.getOrderedLabelsQuerySet().toRefArray(), index, excludedId);
},
);
export const selectNextListPosition = createSelector( export const selectNextListPosition = createSelector(
orm, orm,
(_, boardId) => boardId, (_, boardId) => boardId,
@@ -102,6 +118,7 @@ export default {
selectIsCoreInitializing, selectIsCoreInitializing,
selectIsLogouting, selectIsLogouting,
selectNextBoardPosition, selectNextBoardPosition,
selectNextLabelPosition,
selectNextListPosition, selectNextListPosition,
selectNextCardPosition, selectNextCardPosition,
selectNextTaskPosition, selectNextTaskPosition,

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