import React from 'react'; import { useHistory, useParams } from 'react-router-dom'; import { useSelector, useDispatch } from 'react-redux'; import { currentCandidate, selectCurrentCandidate, selectProfiles, selectFilteredCandidates, } from '../../redux/outstaffingSlice'; import style from './Candidate.module.css'; import arrow from '../../images/right-arrow.png'; import rectangle from '../../images/rectangle_secondPage.png'; import Sidebar from '../Sidebar/Sidebar'; import SectionSkills from './SectionSkills'; import front from '../../images/front_end.png'; import back from '../../images/back_end.png'; import design from '../../images/design.png'; const Candidate = () => { const history = useHistory(); const { id: candidateId } = useParams(); const dispatch = useDispatch(); const candidatesArr = useSelector(selectProfiles); const filteredCandidates = useSelector(selectFilteredCandidates); dispatch( currentCandidate( filteredCandidates.length > 0 ? filteredCandidates.find((el) => Number(el.id) === Number(candidateId)) : candidatesArr.find((el) => Number(el.id) === Number(candidateId)) ) ); const currentCandidateObj = useSelector(selectCurrentCandidate); const { position_id, skillValues, vc_text: text } = currentCandidateObj; let classes; let header; let img; if (Number(position_id) === 1) { classes = style.back; header = 'Backend'; img = back; } else if (Number(position_id) === 2) { classes = style.des; header = 'Frontend'; img = front; } else if (Number(position_id) === 3) { classes = style.front; header = 'Design'; img = design; } function createMarkup(text) { return { __html: text.split('
').join('') }; } return (# Описание опыта
{text ? ( ) : (Описание отсутствует...
)}