guild_front/src/pages/AuthForCandidate/AuthForCandidate.jsx

186 lines
6.5 KiB
React
Raw Normal View History

2023-05-24 13:49:09 +03:00
import React, { useEffect, useRef, useState } from "react";
2023-05-25 10:57:57 +03:00
import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
2023-05-30 10:54:47 +03:00
import { loading, selectIsLoading } from "@redux/loaderSlice";
import { auth, selectAuth, setUserInfo } from "@redux/outstaffingSlice";
import { setRole } from "@redux/roleSlice";
2023-04-04 19:07:19 +03:00
2023-05-31 08:36:15 +03:00
import { apiRequest } from "@api/request";
2023-07-07 01:21:07 +03:00
import AuthBlock from "@components/AuthBlock/AuthBlock";
2023-05-31 08:36:15 +03:00
import CategoriesItem from "@components/CategoriesItem/CategoriesItem";
2023-05-30 10:54:47 +03:00
import AuthHeader from "@components/Common/AuthHeader/AuthHeader";
2023-05-31 08:36:15 +03:00
import { Footer } from "@components/Common/Footer/Footer";
2023-05-30 10:54:47 +03:00
import SideBar from "@components/SideBar/SideBar";
import StepsForCandidate from "@components/StepsForCandidate/StepsForCandidate";
2023-04-04 19:07:19 +03:00
2023-05-31 08:36:15 +03:00
import arrowBtn from "assets/icons/arrows/arrowRight.svg";
import AdminImg from "assets/images/partnerProfile/PersonalAdmin.svg";
2023-05-30 10:54:47 +03:00
import ArchitectureImg from "assets/images/partnerProfile/PersonalArchitecture.svg";
2023-05-31 08:36:15 +03:00
import CopyImg from "assets/images/partnerProfile/PersonalCopy.svg";
2023-05-30 10:54:47 +03:00
import DesignImg from "assets/images/partnerProfile/PersonalDesign.svg";
2023-05-31 08:36:15 +03:00
import FrontendImg from "assets/images/partnerProfile/PersonalFrontend.svg";
2023-05-30 10:54:47 +03:00
import ManageImg from "assets/images/partnerProfile/PersonalMng.svg";
import SmmImg from "assets/images/partnerProfile/PersonalSMM.svg";
2023-05-31 08:36:15 +03:00
import TestImg from "assets/images/partnerProfile/PersonalTesters.svg";
2023-05-30 10:54:47 +03:00
import authImg from "assets/images/partnerProfile/authCandidateFormImg.png";
2023-05-31 08:36:15 +03:00
import BackEndImg from "assets/images/partnerProfile/personalBackEnd.svg";
2023-04-04 19:07:19 +03:00
2023-05-24 13:49:09 +03:00
import "./authForCandidate.scss";
2023-04-04 19:07:19 +03:00
export const AuthForCandidate = () => {
2023-05-24 13:49:09 +03:00
const isLoading = useSelector(selectIsLoading);
const ref = useRef();
const dispatch = useDispatch();
const isAuth = useSelector(selectAuth);
let navigate = useNavigate();
const getToken = localStorage.getItem("auth_token");
2023-04-04 19:07:19 +03:00
2023-05-24 13:49:09 +03:00
const [personalInfoItems] = useState([
{
title: "Backend разработчики",
link: "/registration-candidate",
description:
"Java PHP Python C# React Vue.js NodeJs Golang Ruby JavaScript",
available: true,
img: BackEndImg,
},
{
title: "Frontend разработчики",
link: "/registration-candidate",
description:
"Java PHP Python C# React Vue.js NodeJs Golang Ruby JavaScript",
available: true,
img: FrontendImg,
},
{
title: "Архитектура проектов",
link: "/registration-candidate",
description: "Потоки данных ER ERP CRM CQRS UML BPMN",
available: true,
img: ArchitectureImg,
},
{
title: "Дизайн проектов",
link: "/registration-candidate",
description:
"Java PHP Python C# React Vue.js NodeJs Golang Ruby JavaScript",
available: true,
img: DesignImg,
},
{
title: "Тестирование проектов",
link: "/registration-candidate",
description: "SQL Postman TestRail Kibana Ручное тестирование",
available: false,
img: TestImg,
},
{
title: "Администрирование проектов",
link: "/registration-candidate",
description: "DevOps ELK Kubernetes Docker Bash Apache Oracle Git",
available: false,
img: AdminImg,
},
{
title: "Управление проектом",
link: "/registration-candidate",
description: "Scrum Kanban Agile Miro CustDev",
available: false,
img: ManageImg,
},
{
title: "Копирайтинг проектов",
link: "/registration-candidate",
description: "Теги Заголовок H1 Дескриптор Абзац Сценарий",
available: false,
img: CopyImg,
},
{
title: "Реклама и SMM",
link: "/registration-candidate",
description:
"Java PHP Python C# React Vue.js NodeJs Golang Ruby JavaScript",
available: false,
img: SmmImg,
},
]);
2023-04-04 19:07:19 +03:00
2023-05-24 13:49:09 +03:00
useEffect(() => {
if (isAuth || getToken) {
navigate("/profile");
}
}, [getToken]);
2023-04-04 19:07:19 +03:00
2023-07-07 01:20:57 +03:00
// const submitHandler = () => {
// let formData = new FormData(ref.current);
// if (!isLoading) {
// dispatch(loading(true));
// apiRequest("/user/login", {
// method: "POST",
// data: formData,
// }).then((res) => {
// if (!res.access_token) {
// dispatch(loading(false));
// } else {
// localStorage.setItem("auth_token", res.access_token);
// localStorage.setItem("id", res.id);
// localStorage.setItem("cardId", res.card_id);
// localStorage.setItem("role_status", res.status);
// localStorage.setItem(
// "access_token_expired_at",
// res.access_token_expired_at
// );
// dispatch(auth(true));
// dispatch(setUserInfo(res));
// dispatch(loading(false));
// dispatch(setRole("ROLE_PARTNER"));
// }
// });
// }
// };
2023-04-04 19:07:19 +03:00
2023-05-24 13:49:09 +03:00
return (
<div className="auth-candidate">
<AuthHeader />
<div className="container">
2023-07-07 01:21:07 +03:00
<AuthBlock
title="Войти, уже есть доступ"
description="если вы получили доступ пройдя
2023-07-07 01:20:57 +03:00
2 шага для входа или хотите узнать
2023-07-07 01:21:07 +03:00
свои результаты в кабинете"
/>
2023-05-24 13:49:09 +03:00
<div className="auth-candidate__start">
<h2 className="auth-candidate__start__title">
Хочу в команду <span>Айти специалистов</span>
</h2>
<div className="change-mode__arrow">
<img src={arrowBtn} alt="#"></img>
</div>
<p className="auth-candidate__start__description">
Для нас не имеет значение Ваша локация.
</p>
<div className="auth-candidate__start__categoriesWrapper">
<StepsForCandidate step="шаг 1 - выбери специализацтию" />
{personalInfoItems.map((item, index) => {
return (
<CategoriesItem
link={item.link}
key={index}
title={item.title}
img={item.img}
skills={item.description}
available={item.available}
/>
);
})}
</div>
2023-04-04 19:07:19 +03:00
</div>
2023-05-24 13:49:09 +03:00
</div>
<SideBar />
<Footer />
</div>
);
2023-04-04 19:07:19 +03:00
};