From 776c53cbbd12009aeed03a8879a2c6b07e8726cd Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Mon, 8 May 2023 16:57:35 +0300 Subject: [PATCH] Fixed modal edit clumn --- .../UI/TrackerModal/TrackerModal.jsx | 18 ++++++++++-------- src/pages/ProjectTracker/ProjectTracker.js | 5 ++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/UI/TrackerModal/TrackerModal.jsx b/src/components/UI/TrackerModal/TrackerModal.jsx index 026d1093..71a85d35 100644 --- a/src/components/UI/TrackerModal/TrackerModal.jsx +++ b/src/components/UI/TrackerModal/TrackerModal.jsx @@ -7,7 +7,7 @@ import { getValueModalType, setProject, setProjectBoardFetch, - editProjectName + editProjectName, } from "../../../redux/projectsTrackerSlice"; import "./trackerModal.scss"; @@ -18,7 +18,8 @@ export const TrackerModal = ({ selectedTab, defautlInput, titleProject, - projectId + projectId, + titleColumn, }) => { const dispatch = useDispatch(); const projectBoard = useSelector(getProjectBoard); @@ -30,6 +31,8 @@ export const TrackerModal = ({ const [valueColumn, setValueColumn] = useState(""); const [nameProject, setNameProject] = useState(""); + // const [editTitleColumn, setEditTitleColumn] = useState(titleColumn); + const [valueTiket, setValueTiket] = useState(""); const [descriptionTicket, setDescriptionTicket] = useState(""); @@ -80,11 +83,11 @@ export const TrackerModal = ({ method: "PUT", data: { project_id: projectId, - name: projectName + name: projectName, }, }).then((res) => { - setActive(false) - dispatch(editProjectName({id: projectId, name: projectName})) + setActive(false); + dispatch(editProjectName({ id: projectId, name: projectName })); }); } @@ -232,7 +235,6 @@ export const TrackerModal = ({ )} - {/* TODO: fix state */} {modalType === "editColumn" && (
@@ -240,8 +242,8 @@ export const TrackerModal = ({
setValueTiket(e.target.value)} + value={titleColumn} + onChange={(e) => setEditTitleColumn(e.target.value)} />
diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js index 59c3697d..584d42b2 100644 --- a/src/pages/ProjectTracker/ProjectTracker.js +++ b/src/pages/ProjectTracker/ProjectTracker.js @@ -42,6 +42,7 @@ export const ProjectTracker = () => { const [modalAdd, setModalAdd] = useState(false); const [modalActiveTicket, setModalActiveTicket] = useState(false); const [selectedTicket, setSelectedTicket] = useState({}); + const [titleEditColumn, setTitleEditColumn] = useState(""); const startWrapperIndexTest = useRef({}); const projectBoard = useSelector(getProjectBoard); @@ -202,7 +203,8 @@ export const ProjectTracker = () => { active={modalAdd} setActive={setModalAdd} selectedTab={selectedTab} - > + titleColumn={titleEditColumn} + />
{ [column.id]: false, })); dispatch(modalToggle("editColumn")); + setTitleEditColumn(column.title); setModalAdd(true); }} >