remove short report, refactor range days
This commit is contained in:
		@@ -34,7 +34,7 @@ export const Footer = () => {
 | 
				
			|||||||
                  <img src={tg} alt="tg" width={24} />
 | 
					                  <img src={tg} alt="tg" width={24} />
 | 
				
			||||||
                </a>
 | 
					                </a>
 | 
				
			||||||
              </div>
 | 
					              </div>
 | 
				
			||||||
              <p>Войти в команду</p>
 | 
					              <p>Присоединиться к команде</p>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
            <div className="footer__info">
 | 
					            <div className="footer__info">
 | 
				
			||||||
              <div className="footer__mail">
 | 
					              <div className="footer__mail">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,6 @@ import {
 | 
				
			|||||||
  hourOfNum
 | 
					  hourOfNum
 | 
				
			||||||
} from "@components/Calendar/calendarHelper";
 | 
					} from "@components/Calendar/calendarHelper";
 | 
				
			||||||
import BaseButton from "@components/Common/BaseButton/BaseButton";
 | 
					import BaseButton from "@components/Common/BaseButton/BaseButton";
 | 
				
			||||||
import ShortReport from "@components/ShortReport/ShortReport";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import arrow from "assets/icons/arrows/arrowCalendar.png";
 | 
					import arrow from "assets/icons/arrows/arrowCalendar.png";
 | 
				
			||||||
import calendarIcon from "assets/icons/calendar.svg";
 | 
					import calendarIcon from "assets/icons/calendar.svg";
 | 
				
			||||||
@@ -46,7 +45,6 @@ export const ProfileCalendarComponent = React.memo(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const [calendar, setCalendar] = useState([]);
 | 
					    const [calendar, setCalendar] = useState([]);
 | 
				
			||||||
    const [month, setMonth] = useState("");
 | 
					    const [month, setMonth] = useState("");
 | 
				
			||||||
    const [shortReport, setShortReport] = useState(false);
 | 
					 | 
				
			||||||
    const [endDate, setEndDate] = useState(null);
 | 
					    const [endDate, setEndDate] = useState(null);
 | 
				
			||||||
    const [totalRangeHours, setTotalRangeHours] = useState(0);
 | 
					    const [totalRangeHours, setTotalRangeHours] = useState(0);
 | 
				
			||||||
    const [selectedRangeDays, setSelectedRangeDays] = useState({});
 | 
					    const [selectedRangeDays, setSelectedRangeDays] = useState({});
 | 
				
			||||||
@@ -96,7 +94,7 @@ export const ProfileCalendarComponent = React.memo(
 | 
				
			|||||||
            new Date(day).getMonth() + 1
 | 
					            new Date(day).getMonth() + 1
 | 
				
			||||||
          )}-${correctDay(new Date(day).getDate())}` === date.created_at
 | 
					          )}-${correctDay(new Date(day).getDate())}` === date.created_at
 | 
				
			||||||
        ) {
 | 
					        ) {
 | 
				
			||||||
          return "#";
 | 
					          return `../view/${date.created_at}`;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return "../../report";
 | 
					      return "../../report";
 | 
				
			||||||
@@ -142,29 +140,12 @@ export const ProfileCalendarComponent = React.memo(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    function onMouseRangeDays(day) {
 | 
					    function onMouseRangeDays(day) {
 | 
				
			||||||
      let selectRange = {};
 | 
					      let selectRange = {};
 | 
				
			||||||
      for (let curDay in selectedRangeDays) {
 | 
					      for (let curDay in selectedRangeDays)
 | 
				
			||||||
        if (day > startDate) {
 | 
					        selectRange[curDay] =
 | 
				
			||||||
          if (
 | 
					          day > startDate
 | 
				
			||||||
            day > startDate &&
 | 
					            ? new Date(curDay) > startDate && new Date(curDay) < day
 | 
				
			||||||
            new Date(curDay) > startDate &&
 | 
					            : new Date(curDay) < startDate && new Date(curDay) > day;
 | 
				
			||||||
            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;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      setSelectedRangeDays(selectRange);
 | 
					      setSelectedRangeDays(selectRange);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -239,18 +220,15 @@ export const ProfileCalendarComponent = React.memo(
 | 
				
			|||||||
              week.map((day) => (
 | 
					              week.map((day) => (
 | 
				
			||||||
                <button
 | 
					                <button
 | 
				
			||||||
                  onClick={() => {
 | 
					                  onClick={() => {
 | 
				
			||||||
                    if (startRangeDays) {
 | 
					                    if (startRangeDays) rangeDays(day);
 | 
				
			||||||
                      rangeDays(day);
 | 
					                    else {
 | 
				
			||||||
                    } else {
 | 
					 | 
				
			||||||
                      dispatch(setReportDate(day));
 | 
					                      dispatch(setReportDate(day));
 | 
				
			||||||
                      setShortReport(true);
 | 
					 | 
				
			||||||
                      dispatch(setSendRequest(true));
 | 
					                      dispatch(setSendRequest(true));
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                  }}
 | 
					                  }}
 | 
				
			||||||
                  onMouseEnter={() => {
 | 
					                  onMouseEnter={() => {
 | 
				
			||||||
                    if (startRangeDays && startDate && !endDate) {
 | 
					                    if (startRangeDays && startDate && !endDate)
 | 
				
			||||||
                      onMouseRangeDays(day);
 | 
					                      onMouseRangeDays(day);
 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                  }}
 | 
					                  }}
 | 
				
			||||||
                  key={day}
 | 
					                  key={day}
 | 
				
			||||||
                  className={
 | 
					                  className={
 | 
				
			||||||
@@ -318,7 +296,6 @@ export const ProfileCalendarComponent = React.memo(
 | 
				
			|||||||
            </BaseButton>
 | 
					            </BaseButton>
 | 
				
			||||||
          )}
 | 
					          )}
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        {shortReport && <ShortReport />}
 | 
					 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user