import React, { useEffect, useState } from 'react'; import style from './Description.module.css'; import male from '../../images/medium_male.png'; import rectangle from '../../images/rectangle_secondPage.png'; import { Link, useHistory } from 'react-router-dom'; import { LEVELS, SKILLS } from '../constants/constants'; import { selectProfiles, selectFilteredCandidates, selectItems } from '../../redux/outstaffingSlice'; import { useSelector } from 'react-redux'; import { fetchProfile } from '../../server/server'; import { Loader } from '../Loader/Loader'; import { getRole } from '../../redux/roleSlice'; const Description = ({ onLoadMore, isLoadingMore }) => { const [isLoaded, setIsLoaded] = useState(false); const history = useHistory(); const role = useSelector(getRole) const candidatesListArr = useSelector(selectProfiles); const itemsArr = useSelector(selectItems); const filteredListArr = useSelector(selectFilteredCandidates); const [allCandidates, getAllCandidates] = useState([]); useEffect(() => { fetchProfile({ link: `${process.env.REACT_APP_API_URL}/api/profile?limit=`, index: 1000, history, role }).then((p) => { getAllCandidates(p); setIsLoaded(true); }); }, []); if(!filteredListArr) { return (
{ candidatesListArr.length > 0 ? candidatesListArr.map((el) => (

{el.specification} {SKILLS[el.position_id]}, {LEVELS[el.level]}

{el.vc_text_short ? (
{el.vc_text_short}
) : (

Описание отсутствует...

)}
    {el.skillValues.map((e) => (
  • {e.skill.name}
  • ))}
)) :
{ isLoaded ? 'В данный момент в категории нет свободных специалистов' : 'Загрузка...' }
}
); } return (
{filteredListArr && filteredListArr.length > 0 ? filteredListArr.map((el) => (

{el.specification} {SKILLS[el.position_id]}, {LEVELS[el.level]}

{el.vc_text_short ? (
{el.vc_text_short}
) : (

Описание отсутствует...

)}
    {el.skillValues.map((e) => (
  • {e.skill.name}
  • ))}
)) :
В данный момент в категории нет свободных специалистов
}
{(candidatesListArr.length !== allCandidates.length && filteredListArr.length > 0) || filteredListArr===null ? ( ) : null}
); }; export default Description;