footer layout

This commit is contained in:
Victor Batischev
2024-02-15 14:29:00 +03:00
parent 42cae241f2
commit 26b27129fd
36 changed files with 183 additions and 140 deletions

View File

@ -1,6 +1,6 @@
import React from "react";
import { getCorrectDate } from "@components/Calendar/calendarHelper";
import { getCorrectDate } from "@utils/calendarHelper";
import "./archiveTasksItem.scss";

View File

@ -13,7 +13,7 @@ import rectangle from "assets/images/rectangle_secondPage.png";
import CalendarComponent from "./CalendarComponent";
import "./calendar.scss";
import { currentMonth } from "./calendarHelper";
import { currentMonth } from "../../utils/calendarHelper";
const Calendar = () => {
if (localStorage.getItem("role_status") !== "18") {

View File

@ -7,7 +7,7 @@ import ellipse from "assets/icons/ellipse.png";
import rectangle from "assets/images/rectangle__calendar.png";
import "./calendarComponent.scss";
import { calendarHelper, currentMonthAndDay } from "./calendarHelper";
import { calendarHelper, currentMonthAndDay } from "../../utils/calendarHelper";
const CalendarComponent = ({ onSelect }) => {
const [value, setValue] = useState(moment());

View File

@ -1,104 +0,0 @@
import moment from "moment";
import "moment/locale/ru";
export function calendarHelper(value) {
const startDay = value
.clone()
.startOf("month")
.startOf("week")
.startOf("day");
const endDay = value.clone().endOf("month").endOf("week");
const day = startDay.clone().subtract(1, "day");
const calendar = [];
while (day.isBefore(endDay, "day")) {
calendar.push(
Array(1)
.fill(0)
.map(() => day.add(1, "day").clone())
);
}
return calendar;
}
export function getReports(value) {
// получение отчетов с видимой области
const startDay = value
.clone()
.startOf("month")
.startOf("week")
.startOf("day");
const reportsStart = `${new Date(startDay).getFullYear()}-${
new Date(startDay).getMonth() + 1
}-${new Date(startDay).getDate()}`;
const endDay = value.clone().endOf("month").endOf("week");
const reportsEnd = `${new Date(endDay).getFullYear()}-${
new Date(endDay).getMonth() + 1
}-${new Date(endDay).getDate()}`;
const getReports = `fromDate=${reportsStart}&toDate=${reportsEnd}`;
return getReports;
}
export function getCreatedDate(day) {
if (day) {
return `${new Date(day).getFullYear()}-${correctDay(
new Date(day).getMonth() + 1
)}-${correctDay(new Date(day).getDate())}`;
} else {
const date = new Date();
const dd = String(date.getDate()).padStart(2, "0");
const mm = String(date.getMonth() + 1).padStart(2, "0");
const yyyy = date.getFullYear();
return `${yyyy}-${mm}-${dd}`;
}
}
export const correctDay = (day) => (day < 10 ? `0${day}` : day);
export function currentMonth() {
const currentMonth = moment().format("MMMM");
return currentMonth.charAt(0).toUpperCase() + currentMonth.slice(1);
}
export function currentMonthAndDay(day) {
return day.format("D MMMM");
}
export function getCorrectDate(day) {
const months = [
"января",
"февраля",
"марта",
"апреля",
"мая",
"июня",
"июля",
"августа",
"сентября",
"октября",
"ноября",
"декабря"
];
return `${new Date(day).getDate()} ${
months[new Date(day).getMonth()]
} ${new Date(day).getFullYear()} года`;
}
export function currentMonthAndDayReportPage() {
return moment().format("D MMMM");
}
export function hourOfNum(number) {
const hours = [" час", " часа", " часов"];
const cases = [2, 0, 1, 1, 1, 2];
return hours[
number % 100 > 4 && number % 100 < 20
? 2
: cases[number % 10 < 5 ? number % 10 : 5]
];
}

View File

@ -43,7 +43,7 @@ import send from "assets/icons/send.svg";
import watch from "assets/icons/watch.svg";
import avatarMok from "assets/images/avatarMok.png";
import { getCorrectDate } from "../../../Calendar/calendarHelper";
import { getCorrectDate } from "../../../../utils/calendarHelper";
import "./modalTicket.scss";
registerLocale("ru", ru);

View File

@ -21,7 +21,7 @@ import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { getCorrectDate } from "@components/Calendar/calendarHelper";
import { getCorrectDate } from "@utils/calendarHelper";
import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader";
import FileTracker from "@components/FileTracker/FileTracker";

View File

@ -28,7 +28,7 @@ import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { getCorrectDate } from "@components/Calendar/calendarHelper";
import { getCorrectDate } from "@utils/calendarHelper";
import BaseButton from "@components/Common/BaseButton/BaseButton";
import { Loader } from "@components/Common/Loader/Loader";
import ModalLayout from "@components/Common/ModalLayout/ModalLayout";

View File

@ -16,7 +16,7 @@ import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request";
import { getReports } from "@components/Calendar/calendarHelper";
import { getReports } from "@utils/calendarHelper";
import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader";
import { Navigation } from "@components/Navigation/Navigation";

View File

@ -23,7 +23,7 @@ import {
getCorrectDate,
getReports,
hourOfNum
} from "@components/Calendar/calendarHelper";
} from "@utils/calendarHelper";
import BaseButton from "@components/Common/BaseButton/BaseButton";
import arrow from "assets/icons/arrows/arrowCalendar.png";
@ -286,15 +286,15 @@ export const ProfileCalendarComponent = React.memo(
? `${getCorrectDate(startDate)} - ${getCorrectDate(endDate)}`
: `${getCorrectDate(endDate)} - ${getCorrectDate(startDate)}`
: activePeriod
? "Выберите диапазон на календаре"
: "Выбрать диапазон"}
? "Выберите диапазон на календаре"
: "Выбрать диапазон"}
</span>
<span>
{totalRangeHours
? `${totalRangeHours} ${hourOfNum(totalRangeHours)}`
: endDate
? "0 часов"
: ""}
? "0 часов"
: ""}
</span>
{endDate && (
<BaseButton

View File

@ -26,7 +26,7 @@ import {
getCorrectDate,
getCreatedDate,
hourOfNum
} from "../Calendar/calendarHelper";
} from "../../utils/calendarHelper";
import "./reportForm.scss";
registerLocale("ru", ru);

View File

@ -1,8 +1,13 @@
.report-form {
background: #f1f1f1;
min-height: 100vh;
display: flex;
flex-direction: column;
.container {
display: flex;
flex-direction: column;
flex: 1;
max-width: 1160px;
margin-top: 23px;

View File

@ -14,7 +14,7 @@ import {
getCorrectDate,
getCreatedDate,
hourOfNum
} from "@components/Calendar/calendarHelper";
} from "@utils/calendarHelper";
import { Loader } from "@components/Common/Loader/Loader";
import "./shortReport.scss";

View File

@ -6,7 +6,7 @@ import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request";
import { getCorrectDate } from "@components/Calendar/calendarHelper";
import { getCorrectDate } from "@utils/calendarHelper";
import TrackerTaskSubComment from "@components/TrackerTaskComment/TrackerTaskComment";
import del from "assets/icons/delete.svg";