Fixed modal edit clumn

This commit is contained in:
MaxOvs19 2023-05-08 16:57:35 +03:00
parent e145e6084c
commit 776c53cbbd
2 changed files with 14 additions and 9 deletions

View File

@ -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 = ({
</button>
</div>
)}
{/* TODO: fix state */}
{modalType === "editColumn" && (
<div>
<div className="title-project">
@ -240,8 +242,8 @@ export const TrackerModal = ({
<div className="input-container">
<input
className="name-project"
value={defautlInput}
onChange={(e) => setValueTiket(e.target.value)}
value={titleColumn}
onChange={(e) => setEditTitleColumn(e.target.value)}
/>
</div>
</div>

View File

@ -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}
></TrackerModal>
titleColumn={titleEditColumn}
/>
<div className="tasks__head__add">
<span
@ -302,6 +304,7 @@ export const ProjectTracker = () => {
[column.id]: false,
}));
dispatch(modalToggle("editColumn"));
setTitleEditColumn(column.title);
setModalAdd(true);
}}
>