2023-11-21 17:46:57 +03:00
|
|
|
|
import moment from "moment";
|
2023-11-21 17:31:22 +03:00
|
|
|
|
import React, { useEffect, useState } from "react";
|
2023-05-31 08:36:15 +03:00
|
|
|
|
import { useSelector } from "react-redux";
|
2023-11-21 17:31:22 +03:00
|
|
|
|
import { Link, useNavigate, useParams } from "react-router-dom";
|
2023-11-21 17:46:57 +03:00
|
|
|
|
import { useTimer } from "react-timer-hook";
|
|
|
|
|
|
2023-05-31 11:24:46 +03:00
|
|
|
|
import { completedTestSelector } from "@redux/quizSlice";
|
2023-11-21 17:46:57 +03:00
|
|
|
|
|
2023-05-31 08:36:15 +03:00
|
|
|
|
import { Footer } from "@components/Common/Footer/Footer";
|
2023-12-12 11:23:06 +03:00
|
|
|
|
import { Navigation } from "@components/Navigation/Navigation";
|
2023-05-31 08:36:15 +03:00
|
|
|
|
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
|
|
|
|
|
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
|
2023-12-12 11:22:53 +03:00
|
|
|
|
// import { HeadBottom } from "@components/features/Candidate-lk/HeadBottom";
|
2023-05-31 08:36:15 +03:00
|
|
|
|
import { BlockCompletedTest } from "@components/features/quiz/BlockCompletedTest";
|
|
|
|
|
import { CardIntroduction } from "@components/features/quiz/Card-introduction";
|
|
|
|
|
import { QuizPassingInformation } from "@components/features/quiz/Quiz-passing-information";
|
|
|
|
|
import { TaskQuiz } from "@components/features/quiz/Task";
|
|
|
|
|
|
|
|
|
|
export const PassingTests = () => {
|
|
|
|
|
const [startTest, setStartTest] = useState(false);
|
2023-11-21 17:46:57 +03:00
|
|
|
|
const navigate = useNavigate();
|
2023-05-31 08:36:15 +03:00
|
|
|
|
const completedTest = useSelector(completedTestSelector);
|
2023-11-21 17:46:57 +03:00
|
|
|
|
const { uuid } = useParams();
|
2023-11-21 17:31:22 +03:00
|
|
|
|
|
|
|
|
|
const timer = useTimer({
|
|
|
|
|
expiryTimestamp: moment(),
|
|
|
|
|
autoStart: false,
|
|
|
|
|
onExpire: () => {
|
2024-02-01 23:32:02 +03:00
|
|
|
|
navigate("/Quiz");
|
2023-12-19 17:36:30 +03:00
|
|
|
|
}
|
2023-11-21 17:31:22 +03:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const onCloseWindow = (e) => {
|
|
|
|
|
e.preventDefault();
|
2023-11-21 17:46:57 +03:00
|
|
|
|
if (startTest) {
|
|
|
|
|
let confirmationMessage = "o/";
|
2023-11-21 17:31:22 +03:00
|
|
|
|
(e || window.e).returnValue = confirmationMessage;
|
|
|
|
|
return confirmationMessage;
|
|
|
|
|
}
|
2023-11-21 17:46:57 +03:00
|
|
|
|
};
|
2023-05-31 08:36:15 +03:00
|
|
|
|
|
|
|
|
|
const introduction = [
|
|
|
|
|
{
|
|
|
|
|
title: "Зачем?",
|
|
|
|
|
description:
|
2023-12-19 17:36:30 +03:00
|
|
|
|
"Тесты itguild предназначены для того, чтобы подтверждать навыки, которые вы указали у себя."
|
2023-05-31 08:36:15 +03:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Почему именно тестирование?",
|
|
|
|
|
description:
|
2023-12-19 17:36:30 +03:00
|
|
|
|
"Тесты itguild заменяют первое техническое собеседование по любой вакансии."
|
2023-05-31 08:36:15 +03:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Какие тесты нужно проходить?",
|
|
|
|
|
description:
|
2023-12-19 17:36:30 +03:00
|
|
|
|
"Здесь все довольно просто — следует проходить тесты по инструментам и навыкам, которыми вы владеете."
|
|
|
|
|
}
|
2023-05-31 08:36:15 +03:00
|
|
|
|
];
|
|
|
|
|
|
2023-11-21 17:31:22 +03:00
|
|
|
|
function onSwitchTab(e) {
|
2023-11-21 17:46:57 +03:00
|
|
|
|
console.log(e, document.visibilityState);
|
2023-11-21 17:31:22 +03:00
|
|
|
|
if (document.visibilityState === "hidden" && startTest) {
|
2023-11-21 17:46:57 +03:00
|
|
|
|
alert(
|
|
|
|
|
"Убедительная просьба не покидать страницу и не переключаться. Рассчитывайте только на свои знания и умения!!!"
|
|
|
|
|
);
|
2023-11-21 17:31:22 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-21 17:46:57 +03:00
|
|
|
|
useEffect(() => {
|
2023-11-21 17:31:22 +03:00
|
|
|
|
window.addEventListener("beforeunload", onCloseWindow);
|
|
|
|
|
window.addEventListener("visibilitychange", onSwitchTab);
|
2023-11-21 17:46:57 +03:00
|
|
|
|
window.onblur = onSwitchTab;
|
2023-11-21 17:31:22 +03:00
|
|
|
|
return () => {
|
|
|
|
|
window.removeEventListener("beforeunload", onCloseWindow);
|
|
|
|
|
window.removeEventListener("visibilitychange", onSwitchTab);
|
2023-11-21 17:46:57 +03:00
|
|
|
|
};
|
|
|
|
|
}, [startTest]);
|
2023-11-21 17:31:22 +03:00
|
|
|
|
|
2023-05-31 08:36:15 +03:00
|
|
|
|
return (
|
|
|
|
|
<div className="passing-tests-page">
|
|
|
|
|
<ProfileHeader />
|
2023-12-12 11:22:53 +03:00
|
|
|
|
<Navigation />
|
|
|
|
|
{/*<HeadBottom />*/}
|
2023-05-31 08:36:15 +03:00
|
|
|
|
<div className="passing-tests-page__container">
|
|
|
|
|
<ProfileBreadcrumbs
|
|
|
|
|
links={[
|
|
|
|
|
{ name: "Главная", link: "/profile-candidate" },
|
2024-02-01 23:32:02 +03:00
|
|
|
|
{ name: "Тестирование", link: "/Quiz" },
|
|
|
|
|
{ name: "Прохождение тестов", link: "/Quiz/test" }
|
2023-05-31 08:36:15 +03:00
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
<div className="passing-tests-page__title main-title">
|
2023-11-21 17:31:22 +03:00
|
|
|
|
Тестирование в позиции Junior разработчик
|
2023-05-31 08:36:15 +03:00
|
|
|
|
</div>
|
|
|
|
|
<div className="passing-tests-page__passing-information">
|
|
|
|
|
<QuizPassingInformation
|
2023-11-21 17:31:22 +03:00
|
|
|
|
timer={timer}
|
2023-05-31 08:36:15 +03:00
|
|
|
|
setStartTest={setStartTest}
|
2023-11-21 17:31:22 +03:00
|
|
|
|
uuid={uuid}
|
2023-05-31 08:36:15 +03:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{!completedTest && (
|
|
|
|
|
<>
|
|
|
|
|
{startTest && (
|
|
|
|
|
<div className="passing-tests-page__block-green">
|
|
|
|
|
Тестирование началось
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{startTest ? (
|
2023-11-21 17:46:57 +03:00
|
|
|
|
<TaskQuiz timer={timer} />
|
2023-05-31 08:36:15 +03:00
|
|
|
|
) : (
|
|
|
|
|
<div className="passing-tests-page__introduction">
|
|
|
|
|
{introduction.map((item, i) => (
|
|
|
|
|
<CardIntroduction
|
|
|
|
|
description={item.description}
|
|
|
|
|
title={item.title}
|
|
|
|
|
key={i}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{!startTest && (
|
|
|
|
|
<div className="passing-tests-page__block-text block-text">
|
2023-12-20 19:55:37 +03:00
|
|
|
|
ИЛИ <Link to={""}>выполните тестовое задание</Link>, без
|
2023-05-31 08:36:15 +03:00
|
|
|
|
прохождения тестов
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
{completedTest && (
|
|
|
|
|
<>
|
|
|
|
|
<div className="passing-tests-page__block-green">
|
|
|
|
|
Тестирование завершено
|
|
|
|
|
</div>
|
|
|
|
|
<BlockCompletedTest />
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
<Footer />
|
2023-11-21 17:31:22 +03:00
|
|
|
|
{/*<Prompt*/}
|
|
|
|
|
{/* when={showPrompt}*/}
|
|
|
|
|
{/* message="Unsaved changes detected, continue?"*/}
|
|
|
|
|
{/* beforeUnload={true}*/}
|
|
|
|
|
{/*/>*/}
|
2023-05-31 08:36:15 +03:00
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|