guild_front/src/components/CandidateSidebar/CandidateSidebar.js

66 lines
2.0 KiB
JavaScript
Raw Normal View History

2021-09-15 17:07:28 +03:00
import React from 'react'
import { Link } from 'react-router-dom'
import { Achievement } from '../Achievement/Achievement'
2021-11-30 17:00:58 +03:00
import { LEVELS, SKILLS } from '../constants/constants'
2021-09-15 17:07:28 +03:00
import maleBig from '../../images/medium_male_big.png'
2021-11-30 17:00:58 +03:00
import './candidateSidebar.scss'
2021-05-27 17:44:11 +03:00
2021-08-11 17:42:56 +03:00
const getYearsString = (years) => {
2021-09-15 17:07:28 +03:00
let yearsString
if (years % 10 === 1) {
yearsString = 'год'
2021-08-11 17:42:56 +03:00
} else if (years === 11 || years === 12 || years === 13 || years === 14) {
2021-09-15 17:07:28 +03:00
yearsString = 'лет'
} else if (years % 10 === 2 || years % 10 === 3 || years % 10 === 4) {
yearsString = 'года'
2021-08-17 17:15:04 +03:00
} else {
2021-09-15 17:07:28 +03:00
yearsString = 'лет'
2021-08-11 17:42:56 +03:00
}
2021-09-15 17:07:28 +03:00
return `${years} ${yearsString}`
2021-08-11 17:42:56 +03:00
}
2021-11-30 17:00:58 +03:00
const CandidateSidebar = ({ candidate, position }) => {
2021-05-27 17:44:11 +03:00
return (
2021-11-30 17:00:58 +03:00
<div className='candidate-sidebar'>
<div className='candidate-sidebar__info'>
<div className='candidate-sidebar__position'>
<h2>
{candidate.specification} {SKILLS[candidate.position_id]},{' '}
{LEVELS[candidate.level]}{' '}
</h2>
</div>
2021-09-15 17:07:28 +03:00
<img src={candidate.photo} alt='' />
{candidate && candidate.years_of_exp && (
<>
2021-11-30 17:00:58 +03:00
<p className='candidate-sidebar__experience-title'>Опыт работы</p>
<p className='candidate-sidebar__experience'>
2021-09-15 17:07:28 +03:00
{getYearsString(candidate.years_of_exp)}
</p>
</>
)}
<Link to={`/candidate/${candidate.id}/form`}>
2021-11-30 17:00:58 +03:00
<button className='candidate-sidebar__select'>
2021-09-15 17:07:28 +03:00
Выбрать к собеседованию
</button>
2021-06-18 17:16:08 +03:00
</Link>
2021-12-07 10:58:19 +03:00
<Link to={`/${candidate.id}/calendar`}>
<button className='candidate-sidebar__select'>
Отчёты
</button>
</Link>
2021-11-30 17:00:58 +03:00
<div className='candidate-sidebar__achievements'>
2021-09-15 17:07:28 +03:00
{candidate &&
candidate.achievements &&
candidate.achievements.map((item) => {
return <Achievement achievement={item.achievement} />
})}
</div>
2021-05-27 17:44:11 +03:00
</div>
</div>
2021-09-15 17:07:28 +03:00
)
}
2021-05-27 17:44:11 +03:00
2021-11-30 17:00:58 +03:00
export default CandidateSidebar