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, getValueModalType,
setProject, setProject,
setProjectBoardFetch, setProjectBoardFetch,
editProjectName editProjectName,
} from "../../../redux/projectsTrackerSlice"; } from "../../../redux/projectsTrackerSlice";
import "./trackerModal.scss"; import "./trackerModal.scss";
@ -18,7 +18,8 @@ export const TrackerModal = ({
selectedTab, selectedTab,
defautlInput, defautlInput,
titleProject, titleProject,
projectId projectId,
titleColumn,
}) => { }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const projectBoard = useSelector(getProjectBoard); const projectBoard = useSelector(getProjectBoard);
@ -30,6 +31,8 @@ export const TrackerModal = ({
const [valueColumn, setValueColumn] = useState(""); const [valueColumn, setValueColumn] = useState("");
const [nameProject, setNameProject] = useState(""); const [nameProject, setNameProject] = useState("");
// const [editTitleColumn, setEditTitleColumn] = useState(titleColumn);
const [valueTiket, setValueTiket] = useState(""); const [valueTiket, setValueTiket] = useState("");
const [descriptionTicket, setDescriptionTicket] = useState(""); const [descriptionTicket, setDescriptionTicket] = useState("");
@ -80,11 +83,11 @@ export const TrackerModal = ({
method: "PUT", method: "PUT",
data: { data: {
project_id: projectId, project_id: projectId,
name: projectName name: projectName,
}, },
}).then((res) => { }).then((res) => {
setActive(false) setActive(false);
dispatch(editProjectName({id: projectId, name: projectName})) dispatch(editProjectName({ id: projectId, name: projectName }));
}); });
} }
@ -232,7 +235,6 @@ export const TrackerModal = ({
</button> </button>
</div> </div>
)} )}
{/* TODO: fix state */}
{modalType === "editColumn" && ( {modalType === "editColumn" && (
<div> <div>
<div className="title-project"> <div className="title-project">
@ -240,8 +242,8 @@ export const TrackerModal = ({
<div className="input-container"> <div className="input-container">
<input <input
className="name-project" className="name-project"
value={defautlInput} value={titleColumn}
onChange={(e) => setValueTiket(e.target.value)} onChange={(e) => setEditTitleColumn(e.target.value)}
/> />
</div> </div>
</div> </div>

View File

@ -42,6 +42,7 @@ export const ProjectTracker = () => {
const [modalAdd, setModalAdd] = useState(false); const [modalAdd, setModalAdd] = useState(false);
const [modalActiveTicket, setModalActiveTicket] = useState(false); const [modalActiveTicket, setModalActiveTicket] = useState(false);
const [selectedTicket, setSelectedTicket] = useState({}); const [selectedTicket, setSelectedTicket] = useState({});
const [titleEditColumn, setTitleEditColumn] = useState("");
const startWrapperIndexTest = useRef({}); const startWrapperIndexTest = useRef({});
const projectBoard = useSelector(getProjectBoard); const projectBoard = useSelector(getProjectBoard);
@ -202,7 +203,8 @@ export const ProjectTracker = () => {
active={modalAdd} active={modalAdd}
setActive={setModalAdd} setActive={setModalAdd}
selectedTab={selectedTab} selectedTab={selectedTab}
></TrackerModal> titleColumn={titleEditColumn}
/>
<div className="tasks__head__add"> <div className="tasks__head__add">
<span <span
@ -302,6 +304,7 @@ export const ProjectTracker = () => {
[column.id]: false, [column.id]: false,
})); }));
dispatch(modalToggle("editColumn")); dispatch(modalToggle("editColumn"));
setTitleEditColumn(column.title);
setModalAdd(true); setModalAdd(true);
}} }}
> >