2023-01-16 19:57:55 +03:00
|
|
|
import React, {useEffect, useState} from 'react'
|
2023-02-27 16:50:32 +03:00
|
|
|
import {useParams, Link, useNavigate, Navigate} from 'react-router-dom'
|
2022-11-22 16:43:17 +03:00
|
|
|
import {useSelector, useDispatch} from 'react-redux'
|
2023-01-16 19:57:55 +03:00
|
|
|
|
|
|
|
import SkillSection from '../SkillSection/SkillSection'
|
|
|
|
import Sidebar from '../CandidateSidebar/CandidateSidebar'
|
2023-04-05 19:38:38 +03:00
|
|
|
import {ProfileHeader} from "../ProfileHeader/ProfileHeader";
|
|
|
|
import {ProfileBreadcrumbs} from "../ProfileBreadcrumbs/ProfileBreadcrumbs";
|
2023-01-16 19:57:55 +03:00
|
|
|
import {Footer} from '../Footer/Footer'
|
|
|
|
|
|
|
|
import {currentCandidate, selectCurrentCandidate,} from '../../redux/outstaffingSlice'
|
|
|
|
|
2023-01-20 16:20:06 +03:00
|
|
|
import {apiRequest} from "../../api/request";
|
2022-12-28 09:45:26 +03:00
|
|
|
import {createMarkup} from "../../helper";
|
2023-01-16 19:57:55 +03:00
|
|
|
|
2023-04-05 19:38:38 +03:00
|
|
|
import gitImgItem from "../../images/gitItemImg.png"
|
2021-11-30 17:00:58 +03:00
|
|
|
import rectangle from '../../images/rectangle_secondPage.png'
|
2023-01-23 14:59:48 +03:00
|
|
|
import front from '../Outstaffing/images/front_end.png'
|
|
|
|
import back from '../Outstaffing/images/back_end.png'
|
|
|
|
import design from '../Outstaffing/images/design.png'
|
2023-04-05 19:38:38 +03:00
|
|
|
import rightArrow from "../../images/arrowRight.png"
|
|
|
|
|
|
|
|
import {LEVELS, SKILLS} from '../../constants/constants'
|
2023-01-16 15:24:08 +03:00
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
import './candidate.scss'
|
2023-01-16 19:57:55 +03:00
|
|
|
|
2021-08-18 15:56:24 +03:00
|
|
|
|
2021-07-02 16:02:47 +03:00
|
|
|
const Candidate = () => {
|
2023-02-27 16:50:32 +03:00
|
|
|
if(localStorage.getItem('role_status') !== '18') {
|
|
|
|
return <Navigate to="/profile" replace/>
|
|
|
|
}
|
2022-11-22 16:43:17 +03:00
|
|
|
const {id: candidateId} = useParams();
|
2023-01-18 17:37:52 +03:00
|
|
|
|
2023-01-13 13:02:48 +03:00
|
|
|
const navigate = useNavigate();
|
2023-01-18 17:37:52 +03:00
|
|
|
|
2022-11-22 16:43:17 +03:00
|
|
|
const dispatch = useDispatch();
|
2023-01-16 19:57:55 +03:00
|
|
|
|
2023-01-18 17:37:52 +03:00
|
|
|
const currentCandidateObj = useSelector(selectCurrentCandidate);
|
|
|
|
|
2022-11-22 16:43:17 +03:00
|
|
|
const [activeSnippet, setActiveSnippet] = useState(true);
|
2021-07-02 16:02:47 +03:00
|
|
|
|
2023-01-20 16:20:06 +03:00
|
|
|
|
2023-01-16 15:24:08 +03:00
|
|
|
|
2021-08-18 15:56:24 +03:00
|
|
|
useEffect(() => {
|
|
|
|
window.scrollTo(0, 0)
|
2022-11-22 16:43:17 +03:00
|
|
|
}, []);
|
2021-08-18 15:56:24 +03:00
|
|
|
|
2021-07-09 14:01:11 +03:00
|
|
|
useEffect(() => {
|
2023-01-16 19:57:55 +03:00
|
|
|
apiRequest(`/profile/${candidateId}`, {
|
2021-11-30 17:00:58 +03:00
|
|
|
params: Number(candidateId),
|
|
|
|
}).then((el) => dispatch(currentCandidate(el)))
|
2022-11-22 16:43:17 +03:00
|
|
|
}, [dispatch, candidateId]);
|
2021-07-05 12:33:24 +03:00
|
|
|
|
2022-11-22 16:43:17 +03:00
|
|
|
const {position_id, skillValues, vc_text: text} = currentCandidateObj;
|
2021-06-09 13:12:01 +03:00
|
|
|
|
2021-07-09 14:01:11 +03:00
|
|
|
const setStyles = () => {
|
|
|
|
const styles = {
|
|
|
|
classes: '',
|
|
|
|
header: '',
|
2021-11-30 17:00:58 +03:00
|
|
|
img: ''
|
2022-11-22 16:43:17 +03:00
|
|
|
};
|
2021-06-09 13:12:01 +03:00
|
|
|
|
2021-07-09 14:01:11 +03:00
|
|
|
switch (Number(position_id)) {
|
|
|
|
case 1: {
|
2022-11-22 16:43:17 +03:00
|
|
|
styles.classes = 'back';
|
|
|
|
styles.header = 'Backend';
|
|
|
|
styles.img = back;
|
2021-07-09 14:01:11 +03:00
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
break
|
2021-07-09 14:01:11 +03:00
|
|
|
}
|
|
|
|
case 2: {
|
2022-11-22 16:43:17 +03:00
|
|
|
styles.classes = 'des';
|
|
|
|
styles.header = 'Frontend';
|
|
|
|
styles.img = front;
|
2021-11-30 17:00:58 +03:00
|
|
|
break
|
2021-07-09 14:01:11 +03:00
|
|
|
}
|
|
|
|
case 3: {
|
2022-11-22 16:43:17 +03:00
|
|
|
styles.classes = 'front';
|
|
|
|
styles.header = 'Design';
|
|
|
|
styles.img = design;
|
2021-11-30 17:00:58 +03:00
|
|
|
break
|
2021-07-09 14:01:11 +03:00
|
|
|
}
|
|
|
|
default:
|
2021-11-30 17:00:58 +03:00
|
|
|
break
|
2021-07-09 14:01:11 +03:00
|
|
|
}
|
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
return styles
|
2022-11-22 16:43:17 +03:00
|
|
|
};
|
2021-05-26 13:35:57 +03:00
|
|
|
|
2022-11-22 16:43:17 +03:00
|
|
|
const {header, img, classes} = setStyles();
|
|
|
|
|
2021-05-26 13:35:57 +03:00
|
|
|
return (
|
2023-04-05 19:38:38 +03:00
|
|
|
<div className='candidate__wrapper'>
|
|
|
|
<ProfileHeader/>
|
2023-01-18 17:37:52 +03:00
|
|
|
<div className='container candidate'>
|
2023-04-05 19:38:38 +03:00
|
|
|
<ProfileBreadcrumbs links={[
|
|
|
|
{name: 'Главная', link: '/profile'},
|
|
|
|
{name: 'Каталог свободных специалистов', link: '/profile/catalog'},
|
|
|
|
{name: `${currentCandidateObj.specification} ${SKILLS[currentCandidateObj.position_id]}, ${LEVELS[currentCandidateObj.level]}`, link: `/candidate/${currentCandidateObj.id}`}
|
|
|
|
]}
|
|
|
|
/>
|
2021-11-30 17:00:58 +03:00
|
|
|
|
2023-01-18 17:37:52 +03:00
|
|
|
<div className='row'>
|
|
|
|
<div className='col-12 candidate__header'>
|
|
|
|
|
2023-04-05 19:38:38 +03:00
|
|
|
<div className='candidate__header__left'>
|
2023-04-10 18:12:36 +03:00
|
|
|
<h3>{currentCandidateObj.specification} {SKILLS[currentCandidateObj.position_id]} {LEVELS[currentCandidateObj.level]}</h3>
|
2023-04-05 19:38:38 +03:00
|
|
|
<div className='candidate__arrow' onClick={() => navigate('/profile/catalog')}>
|
|
|
|
<div className='candidate__arrow-img'>
|
|
|
|
<img src={rightArrow} alt=''/>
|
|
|
|
</div>
|
|
|
|
<div className='candidate__arrow-sp'>
|
|
|
|
<span>Вернуться к списку</span>
|
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
</div>
|
2021-05-26 17:41:11 +03:00
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
|
|
|
|
<div className='candidate__icon'>
|
|
|
|
<h3>{header}</h3>
|
|
|
|
<img className={classes} src={img} alt=''/>
|
2021-05-26 17:41:11 +03:00
|
|
|
</div>
|
2021-11-30 17:00:58 +03:00
|
|
|
|
|
|
|
</div>
|
2021-05-26 17:41:11 +03:00
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
<div className='candidate__main'>
|
|
|
|
<div className='row'>
|
|
|
|
<div className='col-12 col-xl-4'>
|
|
|
|
<Sidebar candidate={currentCandidateObj} position activeSnippet={activeSnippet}
|
|
|
|
setActiveSnippet={setActiveSnippet}/>
|
|
|
|
</div>
|
|
|
|
{
|
|
|
|
activeSnippet ?
|
|
|
|
(
|
|
|
|
<div className='col-12 col-xl-8'>
|
|
|
|
<div className='candidate__main-description'>
|
|
|
|
<img src={rectangle} alt=''/>
|
|
|
|
<p className='candidate__hashtag'># Описание опыта</p>
|
|
|
|
{text ? (
|
|
|
|
<div
|
|
|
|
className='candidate__text'
|
|
|
|
dangerouslySetInnerHTML={createMarkup(text)}
|
|
|
|
></div>
|
|
|
|
) : (
|
|
|
|
<p className='candidate__text-secondary'>
|
|
|
|
{currentCandidateObj.vc_text
|
|
|
|
? currentCandidateObj.vc_text
|
|
|
|
: 'Описание отсутствует...'}
|
|
|
|
</p>
|
|
|
|
)}
|
|
|
|
|
|
|
|
<SkillSection skillsArr={skillValues}/>
|
2022-11-22 16:43:17 +03:00
|
|
|
|
2023-01-18 17:37:52 +03:00
|
|
|
</div>
|
2022-11-22 16:43:17 +03:00
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
) :
|
|
|
|
(
|
|
|
|
<div className="col-12 col-xl-8">
|
|
|
|
<div className="candidate__works works">
|
|
|
|
<div className="works__body">
|
2023-04-05 19:38:38 +03:00
|
|
|
<div className="works__body__info">
|
|
|
|
<p>Страница портфолио кода разработчика</p>
|
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
<div className="works__item item-works">
|
2023-04-10 18:55:37 +03:00
|
|
|
<Link to='/' className="item-works__body">
|
2023-04-05 19:38:38 +03:00
|
|
|
<div className='item-works__body__head'>
|
|
|
|
<div className='item-works__body__info'>
|
|
|
|
<img src={gitImgItem} alt='img' />
|
|
|
|
<div className='item-works__body__project'>
|
|
|
|
<h5>cybershop-api</h5>
|
|
|
|
<p>Реактивная социальная сеть</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='item-works__body__head__arrow'>
|
|
|
|
<img src={rightArrow} alt='arrow' />
|
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
</div>
|
2023-04-05 19:38:38 +03:00
|
|
|
<span>JavaScript </span>
|
|
|
|
</Link>
|
2022-11-22 16:43:17 +03:00
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
<div className="works__item item-works">
|
2023-04-10 18:55:37 +03:00
|
|
|
<Link to='/' className="item-works__body">
|
2023-04-05 19:38:38 +03:00
|
|
|
<div className='item-works__body__head'>
|
|
|
|
<div className='item-works__body__info'>
|
|
|
|
<img src={gitImgItem} alt='img' />
|
|
|
|
<div className='item-works__body__project'>
|
|
|
|
<h5>cybershop-api</h5>
|
|
|
|
<p>Реактивная социальная сеть</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='item-works__body__head__arrow'>
|
|
|
|
<img src={rightArrow} alt='arrow' />
|
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
</div>
|
2023-04-05 19:38:38 +03:00
|
|
|
<span>JavaScript </span>
|
|
|
|
</Link>
|
2022-11-22 16:43:17 +03:00
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
<div className="works__item item-works">
|
2023-04-10 18:55:37 +03:00
|
|
|
<Link to='/' className="item-works__body">
|
2023-04-05 19:38:38 +03:00
|
|
|
<div className='item-works__body__head'>
|
|
|
|
<div className='item-works__body__info'>
|
|
|
|
<img src={gitImgItem} alt='img' />
|
|
|
|
<div className='item-works__body__project'>
|
|
|
|
<h5>cybershop-api</h5>
|
|
|
|
<p>Реактивная социальная сеть</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='item-works__body__head__arrow'>
|
|
|
|
<img src={rightArrow} alt='arrow' />
|
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
</div>
|
2023-04-05 19:38:38 +03:00
|
|
|
<span>JavaScript </span>
|
|
|
|
</Link>
|
2022-11-22 16:43:17 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
)
|
|
|
|
}
|
2022-11-22 16:43:17 +03:00
|
|
|
|
2023-01-18 17:37:52 +03:00
|
|
|
</div>
|
2021-05-26 17:41:11 +03:00
|
|
|
</div>
|
2023-01-18 17:37:52 +03:00
|
|
|
<Footer/>
|
2021-05-26 17:41:11 +03:00
|
|
|
</div>
|
2023-04-05 19:38:38 +03:00
|
|
|
</div>
|
2021-11-30 17:00:58 +03:00
|
|
|
)
|
2022-11-22 16:43:17 +03:00
|
|
|
};
|
2021-05-26 13:35:57 +03:00
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
export default Candidate
|