From 72766efa3971c54e4c86ce0d4a2bf41ea45e7482 Mon Sep 17 00:00:00 2001 From: Victor Batischev Date: Fri, 22 Dec 2023 14:47:55 +0300 Subject: [PATCH] remove short report, refactor range days --- src/components/Common/Footer/Footer.jsx | 2 +- .../ProfileCalendarComponent.jsx | 43 +++++-------------- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/src/components/Common/Footer/Footer.jsx b/src/components/Common/Footer/Footer.jsx index 1dac338c..5df51745 100644 --- a/src/components/Common/Footer/Footer.jsx +++ b/src/components/Common/Footer/Footer.jsx @@ -34,7 +34,7 @@ export const Footer = () => { tg -

Войти в команду

+

Присоединиться к команде

diff --git a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx index 33c4f85f..b1f468cd 100644 --- a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx +++ b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx @@ -24,7 +24,6 @@ import { hourOfNum } from "@components/Calendar/calendarHelper"; import BaseButton from "@components/Common/BaseButton/BaseButton"; -import ShortReport from "@components/ShortReport/ShortReport"; import arrow from "assets/icons/arrows/arrowCalendar.png"; import calendarIcon from "assets/icons/calendar.svg"; @@ -46,7 +45,6 @@ export const ProfileCalendarComponent = React.memo( const [calendar, setCalendar] = useState([]); const [month, setMonth] = useState(""); - const [shortReport, setShortReport] = useState(false); const [endDate, setEndDate] = useState(null); const [totalRangeHours, setTotalRangeHours] = useState(0); const [selectedRangeDays, setSelectedRangeDays] = useState({}); @@ -96,7 +94,7 @@ export const ProfileCalendarComponent = React.memo( new Date(day).getMonth() + 1 )}-${correctDay(new Date(day).getDate())}` === date.created_at ) { - return "#"; + return `../view/${date.created_at}`; } } return "../../report"; @@ -142,29 +140,12 @@ export const ProfileCalendarComponent = React.memo( function onMouseRangeDays(day) { let selectRange = {}; - for (let curDay in selectedRangeDays) { - if (day > startDate) { - if ( - day > startDate && - new Date(curDay) > startDate && - new Date(curDay) < day - ) { - selectRange[curDay] = true; - } else { - selectRange[curDay] = false; - } - } else { - if ( - day < startDate && - new Date(curDay) < startDate && - new Date(curDay) > day - ) { - selectRange[curDay] = true; - } else { - selectRange[curDay] = false; - } - } - } + for (let curDay in selectedRangeDays) + selectRange[curDay] = + day > startDate + ? new Date(curDay) > startDate && new Date(curDay) < day + : new Date(curDay) < startDate && new Date(curDay) > day; + setSelectedRangeDays(selectRange); } @@ -239,18 +220,15 @@ export const ProfileCalendarComponent = React.memo( week.map((day) => (
- {shortReport && }
); }