From 34be4eec32f2d1cc7db5ca3f21770701e99bfbe3 Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Tue, 16 May 2023 19:20:37 +0300 Subject: [PATCH] Fixed button in report --- .../Calendar/calendarComponent.scss | 4 ++ .../ProfileCalendarComponent.js | 38 +++++++++++-------- src/components/ShortReport/ShortReport.jsx | 14 +++++-- src/components/ShortReport/shortReport.scss | 12 ++++++ 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/src/components/Calendar/calendarComponent.scss b/src/components/Calendar/calendarComponent.scss index 5552dd04..5ae4d7ce 100644 --- a/src/components/Calendar/calendarComponent.scss +++ b/src/components/Calendar/calendarComponent.scss @@ -158,6 +158,10 @@ line-height: normal; text-align: center; + a { + color: black; + } + img { width: 16px; height: 16px; diff --git a/src/components/ProfileCalendar/ProfileCalendarComponent.js b/src/components/ProfileCalendar/ProfileCalendarComponent.js index 3fba3ecc..7fbdd769 100644 --- a/src/components/ProfileCalendar/ProfileCalendarComponent.js +++ b/src/components/ProfileCalendar/ProfileCalendarComponent.js @@ -65,6 +65,19 @@ export const ProfileCalendarComponent = React.memo( return "pass"; } + // function correctRoute(day) { + // for (const date of reports) { + // if ( + // `${new Date(day).getFullYear()}-${correctDay( + // new Date(day).getMonth() + 1 + // )}-${correctDay(new Date(day).getDate())}` === date.created_at + // ) { + // return `../view/${day}`; + // } + // } + // return "../../report"; + // } + function correctRoute(day) { for (const date of reports) { if ( @@ -72,7 +85,7 @@ export const ProfileCalendarComponent = React.memo( new Date(day).getMonth() + 1 )}-${correctDay(new Date(day).getDate())}` === date.created_at ) { - return `../view/${day}`; + return; } } return "../../report"; @@ -146,38 +159,33 @@ export const ProfileCalendarComponent = React.memo( )) )} - {shortReport && ( - - - - )} - {shortReport && } ); diff --git a/src/components/ShortReport/ShortReport.jsx b/src/components/ShortReport/ShortReport.jsx index b4b3ee6b..39562f50 100644 --- a/src/components/ShortReport/ShortReport.jsx +++ b/src/components/ShortReport/ShortReport.jsx @@ -12,6 +12,7 @@ import { setSendRequest, } from "../../redux/reportSlice"; import { useDispatch, useSelector } from "react-redux"; +import { Link } from "react-router-dom"; import "./shortReport.scss"; @@ -32,7 +33,6 @@ export const ShortReport = ({}) => { setTaskText([]); setDifficulties([]); setTomorrowTask([]); - apiRequest( `reports/find-by-date?user_card_id=${localStorage.getItem( "cardId" @@ -72,9 +72,15 @@ export const ShortReport = ({}) => { return (
-

- Ваши отчеты - просмотр отчета за день -

+
+

+ Ваши отчеты - просмотр отчета за день +

+ + Посмотреть подробнее об отчете + +
+

{getCorrectDate(reportDate)} diff --git a/src/components/ShortReport/shortReport.scss b/src/components/ShortReport/shortReport.scss index 3dc557ed..e1afef85 100644 --- a/src/components/ShortReport/shortReport.scss +++ b/src/components/ShortReport/shortReport.scss @@ -1,3 +1,15 @@ .short-report { margin-bottom: 30px; } + +.viewReport { + &__title-box { + display: flex; + align-items: center; + justify-content: space-between; + + a { + font-size: 16px; + } + } +}