sort fixes
This commit is contained in:
parent
1ff6ada311
commit
596c54b002
@ -4,12 +4,13 @@ import male from '../../images/medium_male.png';
|
|||||||
import rectangle from '../../images/rectangle_secondPage.png';
|
import rectangle from '../../images/rectangle_secondPage.png';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { LEVELS, SKILLS } from '../constants/constants';
|
import { LEVELS, SKILLS } from '../constants/constants';
|
||||||
import { selectProfiles, selectFilteredCandidates } from '../../redux/outstaffingSlice';
|
import { selectProfiles, selectFilteredCandidates, selectItems } from '../../redux/outstaffingSlice';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { fetchProfile } from '../../server/server';
|
import { fetchProfile } from '../../server/server';
|
||||||
|
|
||||||
const Description = ({ onLoadMore }) => {
|
const Description = ({ onLoadMore }) => {
|
||||||
const candidatesListArr = useSelector(selectProfiles);
|
const candidatesListArr = useSelector(selectProfiles);
|
||||||
|
const itemsArr = useSelector(selectItems);
|
||||||
const filteredListArr = useSelector(selectFilteredCandidates);
|
const filteredListArr = useSelector(selectFilteredCandidates);
|
||||||
const [allCandidates, getAllCandidates] = useState([]);
|
const [allCandidates, getAllCandidates] = useState([]);
|
||||||
|
|
||||||
@ -17,23 +18,69 @@ const Description = ({ onLoadMore }) => {
|
|||||||
fetchProfile(`${process.env.REACT_APP_API_URL}/api/profile?limit=`, 1000).then((p) => getAllCandidates(p));
|
fetchProfile(`${process.env.REACT_APP_API_URL}/api/profile?limit=`, 1000).then((p) => getAllCandidates(p));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
console.log('render',filteredListArr, itemsArr)
|
||||||
|
|
||||||
|
if(!filteredListArr) {
|
||||||
|
return (
|
||||||
|
<section className={style.description}>
|
||||||
|
<div className="container">
|
||||||
|
<div className={style.description__wrapper}>
|
||||||
|
{
|
||||||
|
candidatesListArr.map((el) => (
|
||||||
|
<div className="row" key={el.id}>
|
||||||
|
<div className="col-2">
|
||||||
|
<img className={style.description__img} src={male} alt="" />
|
||||||
|
</div>
|
||||||
|
<div className="col-12 col-xl-6">
|
||||||
|
<h3 className={style.description__title}>
|
||||||
|
{SKILLS[el.position_id]}, {LEVELS[el.level]}
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
{el.vc_text_short ? (
|
||||||
|
<div className={style.description__text}>{el.vc_text_short}</div>
|
||||||
|
) : (
|
||||||
|
<p className={style.description__textSecondary}>Описание отсутствует...</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="col-12 col-xl-4">
|
||||||
|
<Link to={`/candidate/${el.id}`}>
|
||||||
|
<button className={style.description__button}>Подробное резюме</button>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
<div className="col-xl-2"></div>
|
||||||
|
<div className="col-12 col-xl-6">
|
||||||
|
<ul className={style.description__list}>
|
||||||
|
{el.skillValues.map((e) => (
|
||||||
|
<li key={e.id} className={style.description__list__item}>
|
||||||
|
{e.skill.name}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
<img className={style.description__rectangle} src={rectangle} alt="" />
|
||||||
|
</div>
|
||||||
|
<div className="col-xl-4"></div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={style.description}>
|
<section className={style.description}>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<div className={style.description__wrapper}>
|
<div className={style.description__wrapper}>
|
||||||
{filteredListArr
|
{filteredListArr
|
||||||
? (filteredListArr.length > 0
|
? filteredListArr.map((el) => (
|
||||||
? <></>
|
|
||||||
: filteredListArr.map((el) => (
|
|
||||||
<div className="row" key={el.id}>
|
<div className="row" key={el.id}>
|
||||||
<div className="col-2">
|
<div className="col-2">
|
||||||
<img className={style.description__img} src={male} alt="" />
|
<img className={style.description__img} src={male} alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div className="col-12 col-xl-6">
|
<div className="col-12 col-xl-6">
|
||||||
<h3 className={style.description__title}>
|
<h3 className={style.description__title}>
|
||||||
<Link to={`/candidate/${el.id}`}>
|
|
||||||
{SKILLS[el.position_id]}, {LEVELS[el.level]}
|
{SKILLS[el.position_id]}, {LEVELS[el.level]}
|
||||||
</Link>
|
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
{el.vc_text_short ? (
|
{el.vc_text_short ? (
|
||||||
@ -60,51 +107,15 @@ const Description = ({ onLoadMore }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="col-xl-4"></div>
|
<div className="col-xl-4"></div>
|
||||||
</div>
|
</div>
|
||||||
)))
|
))
|
||||||
: candidatesListArr.map((el) => (
|
: filteredListArr.length && filteredListArr.length === 0 && <></> }
|
||||||
<div className="row" key={el.id}>
|
|
||||||
<div className="col-2">
|
|
||||||
<img className={style.description__img} src={male} alt="" />
|
|
||||||
</div>
|
|
||||||
<div className="col-12 col-xl-6">
|
|
||||||
<h3 className={style.description__title}>
|
|
||||||
<Link to={`/candidate/${el.id}`}>
|
|
||||||
{SKILLS[el.position_id]}, {LEVELS[el.level]}
|
|
||||||
</Link>
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
{el.vc_text_short ? (
|
|
||||||
<div className={style.description__text}>{el.vc_text_short}</div>
|
|
||||||
) : (
|
|
||||||
<p className={style.description__textSecondary}>Описание отсутствует...</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="col-12 col-xl-4">
|
|
||||||
<Link to={`/candidate/${el.id}`}>
|
|
||||||
<button className={style.description__button}>Подробное резюме</button>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
<div className="col-xl-2"></div>
|
|
||||||
<div className="col-12 col-xl-6">
|
|
||||||
<ul className={style.description__list}>
|
|
||||||
{el.skillValues.map((e) => (
|
|
||||||
<li key={e.id} className={style.description__list__item}>
|
|
||||||
{e.skill.name}
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
<img className={style.description__rectangle} src={rectangle} alt="" />
|
|
||||||
</div>
|
|
||||||
<div className="col-xl-4"></div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<div className={style.description__footer}>
|
<div className={style.description__footer}>
|
||||||
<div className={style.description__footer__btn}>
|
<div className={style.description__footer__btn}>
|
||||||
{candidatesListArr.length !== allCandidates.length && filteredListArr.length === 0 ? (
|
{(candidatesListArr.length !== allCandidates.length && filteredListArr.length > 0) || filteredListArr===null ? (
|
||||||
<button onClick={() => onLoadMore(2)}>Загрузить еще</button>
|
<button onClick={() => onLoadMore(2)}>Загрузить еще</button>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,7 +3,7 @@ import { createSlice } from '@reduxjs/toolkit';
|
|||||||
const initialState = {
|
const initialState = {
|
||||||
tags: [],
|
tags: [],
|
||||||
profiles: [],
|
profiles: [],
|
||||||
filteredCandidates: [],
|
filteredCandidates:null,
|
||||||
selectedItems: [],
|
selectedItems: [],
|
||||||
currentCandidate: {},
|
currentCandidate: {},
|
||||||
auth: false,
|
auth: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user