From 549e0eac743668ad5444e847e01a359c5e5cfcbc Mon Sep 17 00:00:00 2001 From: Z1chi Date: Mon, 16 Jan 2023 19:57:55 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D1=8B=D0=B2=D0=B0=D1=8E=20=D1=81=D0=BF=D0=BE=D1=80=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20=D1=80=D0=B5=D1=88=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Achievement/Achievement.js | 2 +- src/components/Candidate/Candidate.js | 36 ++++++-------- src/components/Description/Description.js | 48 +++++-------------- src/components/Home/Home.js | 10 ++-- src/components/Outstaffing/Outstaffing.js | 11 ++--- .../ProfileCalendar/ProfileCalendar.js | 15 +++--- src/components/ReportForm/ReportForm.js | 3 +- .../features/quiz/ProgressbarQuiz.js | 5 +- src/components/features/quiz/Results.js | 4 +- src/components/features/quiz/Task.js | 2 +- src/pages/Summary/Summary.js | 2 +- 11 files changed, 51 insertions(+), 87 deletions(-) diff --git a/src/components/Achievement/Achievement.js b/src/components/Achievement/Achievement.js index fbcfc336..2e89f3d6 100644 --- a/src/components/Achievement/Achievement.js +++ b/src/components/Achievement/Achievement.js @@ -6,7 +6,7 @@ export const Achievement = ({ achievement }) => { return (
- + achievement
{achievement.title}
diff --git a/src/components/Candidate/Candidate.js b/src/components/Candidate/Candidate.js index bfe552e6..c0f01974 100644 --- a/src/components/Candidate/Candidate.js +++ b/src/components/Candidate/Candidate.js @@ -1,31 +1,30 @@ -import React, {useEffect} from 'react' +import React, {useEffect, useState} from 'react' import {useParams, Link, useNavigate} from 'react-router-dom' import {useSelector, useDispatch} from 'react-redux' -import { - currentCandidate, - selectCurrentCandidate, -} from '../../redux/outstaffingSlice' -import {getRole} from '../../redux/roleSlice' -import {useState} from 'react' + +import SkillSection from '../SkillSection/SkillSection' +import Sidebar from '../CandidateSidebar/CandidateSidebar' +import {Footer} from '../Footer/Footer' + +import {currentCandidate, selectCurrentCandidate,} from '../../redux/outstaffingSlice' + +import {useRequest} from "../../hooks/useRequest"; import {createMarkup} from "../../helper"; + import arrow from '../../images/right-arrow.png' import rectangle from '../../images/rectangle_secondPage.png' -import Sidebar from '../CandidateSidebar/CandidateSidebar' -import SkillSection from '../SkillSection/SkillSection' import front from '../../images/front_end.png' import back from '../../images/back_end.png' import design from '../../images/design.png' -import {Footer} from '../Footer/Footer' - import './candidate.scss' -import {useRequest} from "../../hooks/useRequest"; + const Candidate = () => { const {id: candidateId} = useParams(); const navigate = useNavigate(); const dispatch = useDispatch(); - const role = useSelector(getRole); + const [activeSnippet, setActiveSnippet] = useState(true); const {apiRequest} = useRequest(); @@ -35,7 +34,7 @@ const Candidate = () => { }, []); useEffect(() => { - apiRequest(`/profile/${candidateId}`,{ + apiRequest(`/profile/${candidateId}`, { params: Number(candidateId), }).then((el) => dispatch(currentCandidate(el))) }, [dispatch, candidateId]); @@ -136,20 +135,13 @@ const Candidate = () => { : 'Описание отсутствует...'}

)} - {/* - - */} +
) : ( - //
- // - //
diff --git a/src/components/Description/Description.js b/src/components/Description/Description.js index f671a3bf..78ae6e65 100644 --- a/src/components/Description/Description.js +++ b/src/components/Description/Description.js @@ -1,42 +1,21 @@ -import React, { useEffect, useState } from 'react' +import React from 'react' +import {useSelector} from 'react-redux' +import {Link} from 'react-router-dom' + +import {Loader} from '../Loader/Loader' + +import {LEVELS, SKILLS} from '../../constants/constants' +import {selectProfiles, selectFilteredCandidates,} from '../../redux/outstaffingSlice' + import male from '../../images/medium_male.png' import rectangle from '../../images/rectangle_secondPage.png' -import { Link } from 'react-router-dom' -import { LEVELS, SKILLS } from '../../constants/constants' -import { - selectProfiles, - selectFilteredCandidates, - selectItems, -} from '../../redux/outstaffingSlice' -import { useSelector, useDispatch } from 'react-redux' - -import { Loader } from '../Loader/Loader' -import { getRole } from '../../redux/roleSlice' import './description.scss' -import {useRequest} from "../../hooks/useRequest"; const Description = ({ onLoadMore, isLoadingMore }) => { - const dispatch = useDispatch(); - const {apiRequest} = useRequest(); - const [isLoaded, setIsLoaded] = useState(false); - const role = useSelector(getRole); - const candidatesListArr = useSelector(selectProfiles); - const itemsArr = useSelector(selectItems); - const filteredListArr = useSelector(selectFilteredCandidates); - const [allCandidates, getAllCandidates] = useState([]); - // useEffect(() => { - // apiRequest('/profile?limit=',{ - // params: 1000, - // - // role, - // logout: () => dispatch(auth(false)) - // }).then((p) => { - // getAllCandidates(p); - // setIsLoaded(true) - // }) - // }, []); + const candidatesListArr = useSelector(selectProfiles); + const filteredListArr = useSelector(selectFilteredCandidates); if (!filteredListArr) { return ( @@ -94,7 +73,7 @@ const Description = ({ onLoadMore, isLoadingMore }) => { )) ) : (
- {isLoaded + {isLoadingMore ? 'В данный момент в категории нет свободных специалистов' : 'Загрузка...'}
@@ -228,9 +207,8 @@ const Description = ({ onLoadMore, isLoadingMore }) => {
- {allCandidates && + { candidatesListArr && - candidatesListArr.length !== allCandidates.length && filteredListArr.length === 0 ? ( ) : null} diff --git a/src/components/Home/Home.js b/src/components/Home/Home.js index ef0e5bfc..47bab85d 100644 --- a/src/components/Home/Home.js +++ b/src/components/Home/Home.js @@ -1,18 +1,15 @@ import React, {useState, useEffect} from 'react' -import {useDispatch, useSelector} from 'react-redux' +import {useDispatch} from 'react-redux' import Outstaffing from '../Outstaffing/Outstaffing' import Description from '../Description/Description' import {Footer} from '../Footer/Footer' - -import {profiles, tags, auth} from '../../redux/outstaffingSlice' -import {getRole} from '../../redux/roleSlice' +import {profiles, tags} from '../../redux/outstaffingSlice' import {useRequest} from "../../hooks/useRequest"; - const Home = () => { const [isLoadingMore, setIsLoadingMore] = useState(false); @@ -48,7 +45,8 @@ const Home = () => { ); dispatch(tags(tempTags)) }) - }, [dispatch, index]); + console.log(1) + }, [index]); const loadMore = (count) => { setIndex((prev) => prev + count) diff --git a/src/components/Outstaffing/Outstaffing.js b/src/components/Outstaffing/Outstaffing.js index 418b6dde..c50a581c 100644 --- a/src/components/Outstaffing/Outstaffing.js +++ b/src/components/Outstaffing/Outstaffing.js @@ -1,12 +1,11 @@ -import React, { useState } from 'react' +import React from 'react' import { useSelector, useDispatch } from 'react-redux' + import OutstaffingBlock from '../OutstaffingBlock/OutstaffingBlock' import TagSelect from '../Select/TagSelect' -import { - selectTags, - getPositionId, - setPositionId -} from '../../redux/outstaffingSlice' + +import { selectTags, getPositionId, setPositionId} from '../../redux/outstaffingSlice' + import front from '../../images/front_end.png' import back from '../../images/back_end.png' import design from '../../images/design.png' diff --git a/src/components/ProfileCalendar/ProfileCalendar.js b/src/components/ProfileCalendar/ProfileCalendar.js index c726e4e6..5a66c9ec 100644 --- a/src/components/ProfileCalendar/ProfileCalendar.js +++ b/src/components/ProfileCalendar/ProfileCalendar.js @@ -1,20 +1,19 @@ import React, { useEffect, useState } from 'react' -import {useDispatch, useSelector} from 'react-redux' -import { getProfileInfo } from '../../redux/outstaffingSlice' -import { setReportDate } from '../../redux/reportSlice'; -import arrow from "../../images/right-arrow.png"; +import {useSelector} from 'react-redux' + import { Link } from 'react-router-dom' import moment from "moment"; -import rectangle from '../../images/rectangle_secondPage.png' + import {currentMonth, getReports} from '../Calendar/calendarHelper' import {ProfileCalendarComponent} from "./ProfileCalendarComponent"; -import { ProfileHeader } from "../Profile/ProfileHeader"; import { Footer } from '../Footer/Footer' +import {ProfileHeader} from "../ProfileHeader/ProfileHeader"; + +import {useRequest} from "../../hooks/useRequest"; +import { getProfileInfo } from '../../redux/outstaffingSlice' import './profileCalendar.scss' -import {useRequest} from "../../hooks/useRequest"; export const ProfileCalendar = () => { - const dispatch = useDispatch(); const profileInfo = useSelector(getProfileInfo); const [month, setMonth] = useState(''); const [reports, setReports] = useState([]); diff --git a/src/components/ReportForm/ReportForm.js b/src/components/ReportForm/ReportForm.js index 28bbf4d0..cb136026 100644 --- a/src/components/ReportForm/ReportForm.js +++ b/src/components/ReportForm/ReportForm.js @@ -8,12 +8,11 @@ import ellipse from '../../images/ellipse.png' import remove from '../../images/remove.png' import addIcon from '../../images/addIcon.png' import {currentMonthAndDay} from '../Calendar/calendarHelper' -import {currentMonthAndDay, getReports} from '../Calendar/calendarHelper' -import {ProfileHeader} from "../Profile/ProfileHeader"; import {Footer} from "../Footer/Footer"; import './reportForm.scss' import arrow from "../../images/right-arrow.png"; import {useRequest} from "../../hooks/useRequest"; +import {ProfileHeader} from "../ProfileHeader/ProfileHeader"; const getCreatedDate = (day) => { if (day) { diff --git a/src/components/features/quiz/ProgressbarQuiz.js b/src/components/features/quiz/ProgressbarQuiz.js index 3516698c..037773f1 100644 --- a/src/components/features/quiz/ProgressbarQuiz.js +++ b/src/components/features/quiz/ProgressbarQuiz.js @@ -1,5 +1,4 @@ -import { Link } from 'react-router-dom' -import avatar from './../../../images/medium_male.png' +import React from 'react' import './quiz.scss' export const Progressbar = ({indexQuestion, width}) => { @@ -15,4 +14,4 @@ export const Progressbar = ({indexQuestion, width}) => {
) -} \ No newline at end of file +}; \ No newline at end of file diff --git a/src/components/features/quiz/Results.js b/src/components/features/quiz/Results.js index d475fd05..090dd927 100644 --- a/src/components/features/quiz/Results.js +++ b/src/components/features/quiz/Results.js @@ -11,12 +11,12 @@ export const Results = () => { const dispatch = useDispatch(); const {apiRequest} = useRequest(); - useEffect(async () => { + useEffect(() => { dispatch(fetchResultTest(test.uuid)); apiRequest(`/user-questionnaire/get-points-number?user_questionnaire_uuid=${test.uuid}`) .then((res) => setMaxScore(res.sum_point)); - }, []); + }, [apiRequest, dispatch, test]); return (
diff --git a/src/components/features/quiz/Task.js b/src/components/features/quiz/Task.js index d41551b8..115810bd 100644 --- a/src/components/features/quiz/Task.js +++ b/src/components/features/quiz/Task.js @@ -38,7 +38,7 @@ export const TaskQuiz = () => { dispatch(fetchGetAnswers(response[0].id)); setStripValue((+index + 1) * 100 / response.length) }) - }, [dispatch, apiRequest]); + }, [dispatch]); const nextQuestion = async (e) => { e.preventDefault(); diff --git a/src/pages/Summary/Summary.js b/src/pages/Summary/Summary.js index 537df491..b202f607 100644 --- a/src/pages/Summary/Summary.js +++ b/src/pages/Summary/Summary.js @@ -22,7 +22,7 @@ export const Summary = () => { useEffect(() => { apiRequest(`/profile/portfolio-projects?card_id=${localStorage.getItem('cardId')}`) .then(responseGit => setGitInfo(responseGit)) - }, [apiRequest]); + }, []); return (