Fixed report page

This commit is contained in:
MaxOvs19 2023-05-12 12:44:28 +03:00
parent fb0ce999f6
commit 21fe443d05
4 changed files with 17 additions and 10 deletions

View File

@ -132,6 +132,8 @@
text-align: center;
}
}
margin-bottom: 60px;
}
&__form {

View File

@ -27,8 +27,8 @@ export const ProfileCalendarComponent = React.memo(
const [currentDay] = useState(moment());
const [calendar, setCalendar] = useState([]);
const [month, setMonth] = useState("");
const [dayReport, setDayReport] = useState("");
const [shortReport, setShortReport] = useState(false);
const [dayTest, setDayTest] = useState("");
useEffect(() => {
setCalendar(calendarHelper(value));
@ -148,7 +148,7 @@ export const ProfileCalendarComponent = React.memo(
dispatch(setReportDate(day));
dispatch(setSendRequest(true));
setShortReport(true);
setDayTest(day);
setDayReport(day);
}}
key={day}
className={dayStyles(day)}
@ -171,9 +171,13 @@ export const ProfileCalendarComponent = React.memo(
)}
</div>
</div>
<Link to={correctRoute(dayTest)}>
{shortReport && (
<Link to={correctRoute(dayReport)}>
<button className="calendar__btn">Посмотреть подробнее</button>
</Link>
)}
{shortReport && <ShortReport />}
</div>
);

View File

@ -18,7 +18,7 @@ import "./shortReport.scss";
export const ShortReport = ({}) => {
const reportDate = useSelector(getReportDate);
const sendTest = useSelector(getSendRequest);
const sendReport = useSelector(getSendRequest);
const dispatch = useDispatch();
const [taskText, setTaskText] = useState([]);
@ -26,7 +26,6 @@ export const ShortReport = ({}) => {
const [tomorrowTask, setTomorrowTask] = useState([]);
const [totalHours, setTotalHours] = useState(0);
const [loader, setLoader] = useState(false);
const [reportDay] = useState(new Date(getCreatedDate(reportDate)));
function getReportFromDate(day) {
setLoader(true);
@ -39,7 +38,6 @@ export const ShortReport = ({}) => {
"cardId"
)}&date=${day}`
).then((res) => {
console.log(res);
let spendTime = 0;
for (const item of res) {
if (item.difficulties) {
@ -66,14 +64,14 @@ export const ShortReport = ({}) => {
});
}
if (sendTest) {
if (sendReport) {
dispatch(setSendRequest(false));
getReportFromDate(getCreatedDate(reportDate));
}
return (
<div>
<div className="viewReport__info">
<div className="viewReport__info short-report">
<h2 className="viewReport__title">
Ваши отчеты - <span>просмотр отчета за день</span>
</h2>

View File

@ -0,0 +1,3 @@
.short-report {
margin-bottom: 30px;
}