summary-skills #1
@ -17,10 +17,10 @@ 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 deleteIcon from "assets/icons/closeProjectPersons.svg";
|
||||
import arrowDown from "assets/icons/arrows/selectArrow.png";
|
||||
|
||||
import "./summary.scss";
|
||||
|
||||
@ -32,10 +32,10 @@ export const Summary = () => {
|
||||
const [openGit, setOpenGit] = useState(false);
|
||||
const [gitInfo, setGitInfo] = useState([]);
|
||||
const [editSummeryOpen, setEditSummeryOpen] = useState(false);
|
||||
const [editSkills, setEditSkills] = useState(false)
|
||||
const [editSkills, setEditSkills] = useState(false);
|
||||
const [summery, setSummery] = useState("");
|
||||
const [selectedSkills, setSelectedSkills] = useState([])
|
||||
const [selectSkillsOpen, setSelectSkillsOpen] = useState(false)
|
||||
const [selectedSkills, setSelectedSkills] = useState([]);
|
||||
const [selectSkillsOpen, setSelectSkillsOpen] = useState(false);
|
||||
const [skillsList, seSkillsList] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
@ -46,23 +46,22 @@ export const Summary = () => {
|
||||
|
||||
useEffect(() => {
|
||||
setSummery(profileInfo.vc_text);
|
||||
setSelectedSkills(profileInfo.skillValues)
|
||||
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)
|
||||
}
|
||||
UserCard: {
|
||||
skill: selectedSkills.map((item) => item.skill_id),
|
||||
},
|
||||
},
|
||||
}).then(() => {});
|
||||
}
|
||||
@ -127,63 +126,80 @@ export const Summary = () => {
|
||||
className={editSkills ? "edit" : ""}
|
||||
onClick={() => {
|
||||
if (editSkills) {
|
||||
setSkills()
|
||||
setSkills();
|
||||
}
|
||||
setEditSkills(!editSkills)
|
||||
setEditSkills(!editSkills);
|
||||
}}
|
||||
>
|
||||
{editSkills ? "Сохранить" : "Редактировать"}
|
||||
</button>
|
||||
</div>
|
||||
<div className="skills__section__items">
|
||||
{editSkills ?
|
||||
<div className='editSkills'>
|
||||
{editSkills ? (
|
||||
<div className="editSkills">
|
||||
{selectedSkills &&
|
||||
selectedSkills.map((skill) => {
|
||||
return <span key={skill.skill_id}>
|
||||
{skill.skill.name}
|
||||
<img
|
||||
src={deleteIcon}
|
||||
alt='deleteIcon'
|
||||
onClick={() => setSelectedSkills((prevValue) => prevValue.filter((item) => item.skill_id !== skill.skill_id))}
|
||||
/>
|
||||
</span>
|
||||
})
|
||||
}
|
||||
<div className='selectSkills'>
|
||||
<div className='selectSkills__name' onClick={() => setSelectSkillsOpen(!selectSkillsOpen)}>
|
||||
return (
|
||||
<span key={skill.skill_id}>
|
||||
{skill.skill.name}
|
||||
<img
|
||||
src={deleteIcon}
|
||||
alt="deleteIcon"
|
||||
onClick={() =>
|
||||
setSelectedSkills((prevValue) =>
|
||||
prevValue.filter(
|
||||
(item) => item.skill_id !== skill.skill_id
|
||||
)
|
||||
)
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
<div className="selectSkills">
|
||||
<div
|
||||
className="selectSkills__name"
|
||||
onClick={() => setSelectSkillsOpen(!selectSkillsOpen)}
|
||||
>
|
||||
Выберите скилл
|
||||
<img
|
||||
className={selectSkillsOpen ? "open" : ""}
|
||||
src={arrowDown}
|
||||
/>
|
||||
/>
|
||||
</div>
|
||||
{selectSkillsOpen &&
|
||||
<div className='selectSkills__dropDown'>
|
||||
{selectSkillsOpen && (
|
||||
<div className="selectSkills__dropDown">
|
||||
{skillsList.map((skill) => {
|
||||
return <p
|
||||
onClick={() => setSelectedSkills((prevValue) => [...prevValue, {'skill': skill, 'skill_id': skill.id}])}
|
||||
key={skill.id}
|
||||
className='selectSkills__item'>
|
||||
{skill.name}
|
||||
</p>
|
||||
})
|
||||
}
|
||||
return (
|
||||
<p
|
||||
onClick={() =>
|
||||
setSelectedSkills((prevValue) => [
|
||||
...prevValue,
|
||||
{ skill: skill, skill_id: skill.id },
|
||||
])
|
||||
}
|
||||
key={skill.id}
|
||||
className="selectSkills__item"
|
||||
>
|
||||
{skill.name}
|
||||
</p>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
) : (
|
||||
<div className="skills__section__items__wrapper">
|
||||
{selectedSkills &&
|
||||
selectedSkills.map((skill, index) => (
|
||||
<span key={skill.id} className="skill_item">
|
||||
{skill.skill.name}
|
||||
{skill.skill.name}
|
||||
{selectedSkills.length > index + 1 && ","}
|
||||
</span>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user