import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import { CKEditor } from "@ckeditor/ckeditor5-react";
import React, { useEffect, useState } from "react";
import { useSelector } from "react-redux";
import { Navigate } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice";
import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request";
import { Footer } from "@components/Common/Footer/Footer";
import { Navigation } from "@components/Navigation/Navigation";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import rightArrow from "assets/icons/arrows/arrowRight.svg";
import arrow from "assets/icons/arrows/left-arrow.png";
import arrowDown from "assets/icons/arrows/selectArrow.png";
import deleteIcon from "assets/icons/closeProjectPersons.svg";
import gitImgItem from "assets/icons/gitItemImg.svg";
import avatarMok from "assets/images/avatarMok.png";
import "./summary.scss";
export const Summary = () => {
if (localStorage.getItem("role_status") === "18") {
return ;
}
const profileInfo = useSelector(getProfileInfo);
const [openGit, setOpenGit] = useState(false);
const [gitInfo, setGitInfo] = useState([]);
const [editSummeryOpen, setEditSummeryOpen] = useState(false);
const [editSkills, setEditSkills] = useState(false);
const [summery, setSummery] = useState("");
const [selectedSkills, setSelectedSkills] = useState([]);
const [selectSkillsOpen, setSelectSkillsOpen] = useState(false);
const [skillsList, seSkillsList] = useState([]);
useEffect(() => {
apiRequest(
`/profile/portfolio-projects?card_id=${localStorage.getItem("cardId")}`
).then((responseGit) => setGitInfo(responseGit));
}, []);
useEffect(() => {
setSummery(profileInfo.vc_text);
setSelectedSkills(profileInfo.skillValues);
}, [profileInfo]);
useEffect(() => {
apiRequest(`/skills/get-skills-list`).then((el) => {
seSkillsList(el);
});
}, []);
function setSkills() {
apiRequest("/resume/edit-skills", {
method: "PUT",
data: {
UserCard: {
skill: selectedSkills.map((item) => item.skill_id)
}
}
}).then(() => {});
}
function editSummery() {
apiRequest("/resume/edit-text", {
method: "PUT",
data: {
resume: summery
}
}).then(() => {});
}
return (
Ваше резюме {openGit && - Git}
{openGit && (
setOpenGit(false)}>
Вернуться
)}
{profileInfo?.fio ? profileInfo?.fio : profileInfo?.username},{" "}
{profileInfo.specification} разработчик
{!openGit && (
)}
{!openGit && (
Основной стек
{editSkills ? (
{selectedSkills &&
selectedSkills.map((skill) => {
return (
{skill.skill.name}
setSelectedSkills((prevValue) =>
prevValue.filter(
(item) => item.skill_id !== skill.skill_id
)
)
}
/>
);
})}
setSelectSkillsOpen(!selectSkillsOpen)}
>
Выберите скилл
{selectSkillsOpen && (
{skillsList.map((skill) => {
return (
setSelectedSkills((prevValue) => [
...prevValue,
{ skill: skill, skill_id: skill.id }
])
}
key={skill.id}
className="select-skills__item"
>
{skill.name}
);
})}
)}
) : (
{selectedSkills &&
selectedSkills.map((skill, index) => (
{skill.skill.name}
{selectedSkills.length > index + 1 && ","}
))}
)}
)}
{profileInfo.vc_text && !openGit && (
Опыт работы
{editSummeryOpen ? (
{
const data = editor.getData();
setSummery(data);
}}
/>
) : (
)}
)}
{openGit && (
Ваши репозитории
)}
);
};