diff --git a/client/src/actions/lists.js b/client/src/actions/lists.js
index 59f944f..a7d409d 100644
--- a/client/src/actions/lists.js
+++ b/client/src/actions/lists.js
@@ -89,6 +89,36 @@ const handleListDelete = (list) => ({
},
});
+const sortList = (id, data) => ({
+ type: ActionTypes.LIST_SORT,
+ payload: {
+ id,
+ data,
+ },
+});
+
+sortList.success = (list) => ({
+ type: ActionTypes.LIST_SORT__SUCCESS,
+ payload: {
+ list,
+ },
+});
+
+sortList.failure = (id, error) => ({
+ type: ActionTypes.LIST_SORT__FAILURE,
+ payload: {
+ id,
+ error,
+ },
+});
+
+const handleListSort = (list) => ({
+ type: ActionTypes.LIST_SORT_HANDLE,
+ payload: {
+ list,
+ },
+});
+
export default {
createList,
handleListCreate,
@@ -96,4 +126,6 @@ export default {
handleListUpdate,
deleteList,
handleListDelete,
+ sortList,
+ handleListSort
};
diff --git a/client/src/api/lists.js b/client/src/api/lists.js
index 6c1ee6a..aa36f0a 100755
--- a/client/src/api/lists.js
+++ b/client/src/api/lists.js
@@ -7,10 +7,13 @@ const createList = (boardId, data, headers) =>
const updateList = (id, data, headers) => socket.patch(`/lists/${id}`, data, headers);
+const sortList = (id, data, headers) => socket.post(`/lists/${id}/sort`, data, headers);
+
const deleteList = (id, headers) => socket.delete(`/lists/${id}`, undefined, headers);
export default {
createList,
updateList,
+ sortList,
deleteList,
};
diff --git a/client/src/components/List/ActionsStep.jsx b/client/src/components/List/ActionsStep.jsx
index 1e94d5a..3bbc28d 100755
--- a/client/src/components/List/ActionsStep.jsx
+++ b/client/src/components/List/ActionsStep.jsx
@@ -8,12 +8,14 @@ import { useSteps } from '../../hooks';
import DeleteStep from '../DeleteStep';
import styles from './ActionsStep.module.scss';
+import SortStep from "../SortStep";
const StepTypes = {
DELETE: 'DELETE',
+ SORT: 'SORT',
};
-const ActionsStep = React.memo(({ onNameEdit, onCardAdd, onDelete, onClose }) => {
+const ActionsStep = React.memo(({ onNameEdit, onCardAdd, onDelete, onSort, onClose }) => {
const [t] = useTranslation();
const [step, openStep, handleBack] = useSteps();
@@ -31,16 +33,32 @@ const ActionsStep = React.memo(({ onNameEdit, onCardAdd, onDelete, onClose }) =>
openStep(StepTypes.DELETE);
}, [openStep]);
- if (step && step.type === StepTypes.DELETE) {
- return (
-
- );
+ const handleSortClick = useCallback(() => {
+ openStep(StepTypes.SORT);
+ }, [openStep]);
+
+ if (step && step.type) {
+ switch (step.type){
+ case StepTypes.DELETE:
+ return (
+
+ );
+ case StepTypes.SORT:
+ return (
+
+ );
+ default:
+ }
}
return (
@@ -52,6 +70,11 @@ const ActionsStep = React.memo(({ onNameEdit, onCardAdd, onDelete, onClose }) =>