Bugs fixed

This commit is contained in:
MaxOvs19 2023-05-18 19:52:37 +03:00
parent 973f140451
commit c62ae06d20
3 changed files with 7 additions and 11 deletions

View File

@ -24,10 +24,10 @@ import "./../Calendar/calendarComponent.scss";
export const ProfileCalendarComponent = React.memo(
({ value, setValueHandler, reports, totalHours }) => {
const dispatch = useDispatch();
const [currentDay] = useState(moment());
const [calendar, setCalendar] = useState([]);
const [month, setMonth] = useState("");
const [dayReport, setDayReport] = useState("");
const [shortReport, setShortReport] = useState(false);
useEffect(() => {
@ -146,20 +146,15 @@ export const ProfileCalendarComponent = React.memo(
<button
onClick={() => {
dispatch(setReportDate(day));
setShortReport(true);
dispatch(setSendRequest(true));
}}
key={day}
className={dayStyles(day)}
name={day.format("dddd")}
id="btn"
>
<Link
to={correctRoute(day)}
onClick={() => {
setShortReport(true);
setDayReport(day);
dispatch(setSendRequest(true));
}}
>
<Link to={correctRoute(day)}>
<img
className={"calendar__icon"}
src={calendarIcon}

View File

@ -13,6 +13,7 @@ import {
} from "../../redux/reportSlice";
import { useDispatch, useSelector } from "react-redux";
import { Link } from "react-router-dom";
import { Loader } from "../Loader/Loader";
import "./shortReport.scss";
@ -34,6 +35,7 @@ export const ShortReport = ({}) => {
setTaskText([]);
setDifficulties([]);
setTomorrowTask([]);
setTotalHours(0);
apiRequest(
`reports/find-by-date?user_card_id=${localStorage.getItem(
"cardId"
@ -95,6 +97,7 @@ export const ShortReport = ({}) => {
</p>
</div>
</div>
{loader && <Loader style="green" />}
{Boolean(taskText.length) && (
<div className="viewReport__content">
<div className="table__container">

View File

@ -45,9 +45,7 @@ export const ViewReport = () => {
"cardId"
)}&date=${day}`
).then((res) => {
console.log(res);
let spendTime = 0;
for (const item of res) {
if (item.difficulties) {
setDifficulties((prevArray) => [...prevArray, item.difficulties]);