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

View File

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

View File

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