remove short report, refactor range days
This commit is contained in:
parent
78b5bdfac8
commit
72766efa39
@ -34,7 +34,7 @@ export const Footer = () => {
|
||||
<img src={tg} alt="tg" width={24} />
|
||||
</a>
|
||||
</div>
|
||||
<p>Войти в команду</p>
|
||||
<p>Присоединиться к команде</p>
|
||||
</div>
|
||||
<div className="footer__info">
|
||||
<div className="footer__mail">
|
||||
|
@ -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) => (
|
||||
<button
|
||||
onClick={() => {
|
||||
if (startRangeDays) {
|
||||
rangeDays(day);
|
||||
} else {
|
||||
if (startRangeDays) rangeDays(day);
|
||||
else {
|
||||
dispatch(setReportDate(day));
|
||||
setShortReport(true);
|
||||
dispatch(setSendRequest(true));
|
||||
}
|
||||
}}
|
||||
onMouseEnter={() => {
|
||||
if (startRangeDays && startDate && !endDate) {
|
||||
if (startRangeDays && startDate && !endDate)
|
||||
onMouseRangeDays(day);
|
||||
}
|
||||
}}
|
||||
key={day}
|
||||
className={
|
||||
@ -318,7 +296,6 @@ export const ProfileCalendarComponent = React.memo(
|
||||
</BaseButton>
|
||||
)}
|
||||
</div>
|
||||
{shortReport && <ShortReport />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user