fixs, Убрал стейты для формы авторизации, переписал на форм дату

This commit is contained in:
Дмитрий Савенко 2023-01-25 17:17:57 +03:00
parent 80316d3ba8
commit a26693f94a
5 changed files with 170 additions and 180 deletions

View File

@ -1,11 +0,0 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { WithLogout } from '../hoc/withLogout';
import Calendar from '../components/Calendar/Calendar';
const CalendarPage = () => {
return <WithLogout><Calendar onSelect={} /></WithLogout>;
};
export default CalendarPage;

View File

@ -18,6 +18,7 @@ import {currentCandidate, selectCurrentCandidate} from '../../redux/outstaffingS
import './formPage.scss' import './formPage.scss'
import {apiRequest} from "../../api/request"; import {apiRequest} from "../../api/request";
import {LogoutButton} from "../../components/LogoutButton/LogoutButton";
@ -42,7 +43,9 @@ const FormPage = () => {
} }
return ( return (
<WithLogout> <div className='container'>
<div className='form-page'> <div className='form-page'>
<div className='form-page__back'> <div className='form-page__back'>
<div className='form-page__arrow' onClick={goBack}> <div className='form-page__arrow' onClick={goBack}>
@ -53,6 +56,7 @@ const FormPage = () => {
<span>Вернуться к кандидату</span> <span>Вернуться к кандидату</span>
</div> </div>
</div> </div>
<LogoutButton />
</div> </div>
<div className='form-page__candidate'> <div className='form-page__candidate'>
<div className='form-page__avatar'> <div className='form-page__avatar'>
@ -92,7 +96,7 @@ const FormPage = () => {
</div> </div>
<Footer/> <Footer/>
</div> </div>
</WithLogout> </div>
) )
}; };

View File

@ -1,10 +1,10 @@
.form-page { .form-page {
font-family: "GT Eesti Pro Display", sans-serif;
&__arrow { &__arrow {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
margin-top: 80px;
margin-left: -32px;
cursor: pointer; cursor: pointer;
&-img { &-img {
@ -18,26 +18,32 @@
display: flex; display: flex;
} }
&__back-to-candidate { &__back {
margin-top: 80px;
padding: 0 20px;
display: flex;
justify-content: space-between;
&-to-candidate {
margin-left: 40px; margin-left: 40px;
margin-right: 120px; margin-right: 120px;
font-family: 'GT Eesti Pro Display';
font-size: 1.8em; font-size: 1.8em;
font-weight: 100; font-weight: 100;
line-height: 36px; line-height: 36px;
} }
}
&__avatar { &__avatar {
img { img {
width: 61px; width: 61px;
height: 61px; height: 61px;
} }
margin-right: 16px; margin-right: 16px;
} }
&__position { &__position {
color: #000000; color: #000000;
font-family: "GT Eesti Pro Display";
font-size: 22px; font-size: 22px;
font-weight: 700; font-weight: 700;
line-height: 36px; line-height: 36px;
@ -46,7 +52,6 @@
&__selected { &__selected {
span { span {
color: #000000; color: #000000;
font-family: "GT Eesti Pro Display";
font-size: 10px; font-size: 10px;
font-weight: 300; font-weight: 300;
line-height: 22.38px; line-height: 22.38px;
@ -85,15 +90,11 @@
&__option { &__option {
color: #000000; color: #000000;
font-family: "GT Eesti Pro Display";
font-size: 18px; font-size: 18px;
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
letter-spacing: normal; letter-spacing: normal;
line-height: 36px;
text-align: center; text-align: center;
font-style: normal;
letter-spacing: normal;
line-height: normal; line-height: normal;
} }
@ -107,22 +108,19 @@
&-text { &-text {
width: 225px; width: 225px;
color: #000000; color: #000000;
font-family: "GT Eesti Pro Display";
font-size: 18px; font-size: 18px;
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
letter-spacing: normal; letter-spacing: normal;
line-height: 33px; line-height: 33px;
text-align: center; text-align: center;
font-style: normal;
letter-spacing: normal;
margin-bottom: 29px; margin-bottom: 29px;
} }
} }
} }
.form-page + .logout-button { .form-page + .logout-button {
top: 0px !important; top: 0 !important;
right: 2.5rem; right: 2.5rem;
} }

View File

@ -1,9 +1,8 @@
import React, {useEffect, useState} from 'react' import React, {useEffect, useState} from 'react'
import {Link} from "react-router-dom"; import {Link} from "react-router-dom";
import {useRequest} from "../../hooks/useRequest";
import {useSelector} from "react-redux"; import {useSelector} from "react-redux";
import {getReportDate} from "../../redux/reportSlice"; import {getReportDate} from "../../redux/reportSlice";
import SVG from 'react-inlinesvg'
import {Loader} from "../../components/Loader/Loader" import {Loader} from "../../components/Loader/Loader"
import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader"; import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader";
@ -13,6 +12,7 @@ import arrow from "../../images/right-arrow.png";
import arrowSwitchDate from "../../images/arrowViewReport.png"; import arrowSwitchDate from "../../images/arrowViewReport.png";
import './viewReport.scss' import './viewReport.scss'
import {apiRequest} from "../../api/request";
export const ViewReport = () => { export const ViewReport = () => {
const getCreatedDate = (day) => { const getCreatedDate = (day) => {
@ -26,25 +26,24 @@ export const ViewReport = () => {
return `${yyyy}-${mm}-${dd}` return `${yyyy}-${mm}-${dd}`
} }
}; };
const {apiRequest} = useRequest();
const reportDate = useSelector(getReportDate); const reportDate = useSelector(getReportDate);
const [taskText, setTaskText] = useState([]); const [taskText, setTaskText] = useState([]);
const [difficulties, setDifficulties] = useState([]) const [difficulties, setDifficulties] = useState([]);
const [tomorrowTask, setTomorrowTask] = useState([]) const [tomorrowTask, setTomorrowTask] = useState([]);
const [totalHours, setTotalHours] = useState(0); const [totalHours, setTotalHours] = useState(0);
const [reportDay] = useState(new Date (getCreatedDate(reportDate))) const [reportDay] = useState(new Date (getCreatedDate(reportDate)));
const [currentDay] = useState(new Date ()) const [currentDay] = useState(new Date ());
const [loader, setLoader] = useState(false) const [loader, setLoader] = useState(false);
function getReportFromDate(day) { function getReportFromDate(day) {
setLoader(true) setLoader(true);
setTaskText([]) setTaskText([]);
setDifficulties([]) setDifficulties([]);
setTomorrowTask([]) setTomorrowTask([]);
apiRequest(`reports/find-by-date?user_card_id=${localStorage.getItem('cardId')}&date=${day}`) apiRequest(`reports/find-by-date?user_card_id=${localStorage.getItem('cardId')}&date=${day}`)
.then(res => { .then(res => {
let spendTime = 0 let spendTime = 0;
for (const item of res) { for (const item of res) {
if(item.difficulties) { if(item.difficulties) {
setDifficulties(prevArray => [...prevArray, item.difficulties]) setDifficulties(prevArray => [...prevArray, item.difficulties])
@ -57,14 +56,14 @@ export const ViewReport = () => {
hours: task.hours_spent, hours: task.hours_spent,
task: task.task, task: task.task,
id: task.id id: task.id
} };
if(task.hours_spent) { if(task.hours_spent) {
spendTime += Number(task.hours_spent) spendTime += Number(task.hours_spent)
} }
setTaskText(prevArray => [...prevArray, taskInfo]) setTaskText(prevArray => [...prevArray, taskInfo])
}) })
} }
setTotalHours(spendTime) setTotalHours(spendTime);
setLoader(false) setLoader(false)
}) })
} }