active links in nav, delete report, loaders in report, changes routes
This commit is contained in:
@ -60,7 +60,7 @@ const Calendar = () => {
|
||||
<img className="calendar__title-img" src={rectangle} alt="img" />
|
||||
</div>
|
||||
<div>
|
||||
<Link to="/report">
|
||||
<Link to="/profile/calendar/report">
|
||||
<button className="calendar__btn">Заполнить отчет</button>
|
||||
</Link>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import React, { useState } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { NavLink } from "react-router-dom";
|
||||
|
||||
import { getProfileInfo } from "@redux/outstaffingSlice";
|
||||
@ -9,9 +9,9 @@ import { urlForLocal } from "@utils/helper";
|
||||
import avatarMok from "assets/images/avatarMok.png";
|
||||
|
||||
export const Navigation = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const profileInfo = useSelector(getProfileInfo);
|
||||
const currentPath = window.location.pathname;
|
||||
const [user] = useState(
|
||||
localStorage.getItem("role_status") === "18" ? "partner" : "developer"
|
||||
);
|
||||
@ -35,7 +35,7 @@ export const Navigation = () => {
|
||||
name: "Выплаты"
|
||||
},
|
||||
{
|
||||
path: "/Quiz",
|
||||
path: "/quiz",
|
||||
name: "Тесты"
|
||||
},
|
||||
{
|
||||
@ -81,6 +81,7 @@ export const Navigation = () => {
|
||||
key={index}
|
||||
end
|
||||
to={link.path === "/Quiz" ? link.path : `/profile${link.path}`}
|
||||
className={currentPath. includes(link.path) ? 'active' : ''}
|
||||
>
|
||||
{link.name}
|
||||
</NavLink>
|
||||
|
@ -98,7 +98,7 @@ export const ProfileCalendar = () => {
|
||||
{profileInfo.specification} разработчик
|
||||
</p>
|
||||
</div>
|
||||
<Link to="/report">
|
||||
<Link to="/profile/calendar/report">
|
||||
<button
|
||||
className="calendar__btn"
|
||||
onClick={() => dispatch(setReportDate(""))}
|
||||
|
@ -96,9 +96,9 @@ export const ProfileCalendarComponent = React.memo(
|
||||
)}-${correctDay(new Date(day).getDate())}` === date.created_at
|
||||
) {
|
||||
if (userId) {
|
||||
return `../view/${date.created_at}/${userId}`;
|
||||
return `/profile/calendar/view/${date.created_at}/${userId}`;
|
||||
}
|
||||
return `../view/${date.created_at}/${localStorage.getItem("id")}`;
|
||||
return `/profile/calendar/view/${date.created_at}/${localStorage.getItem("id")}`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ export const ProfileCalendarComponent = React.memo(
|
||||
return "#";
|
||||
}
|
||||
|
||||
return "../../report";
|
||||
return "/profile/calendar/report";
|
||||
}
|
||||
|
||||
const prevMonth = () => value.clone().subtract(1, "month");
|
||||
|
@ -87,10 +87,12 @@ const ReportForm = () => {
|
||||
};
|
||||
|
||||
const handler = () => {
|
||||
setIsFetching(true)
|
||||
for (let input of inputs) {
|
||||
if (!input.task || !input.hours_spent) {
|
||||
setReportSuccess("Заполните задачи");
|
||||
setTimeout(() => setReportSuccess(""), 2000);
|
||||
setIsFetching(false)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -292,12 +294,15 @@ const ReportForm = () => {
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
<div className="report-form__footer">
|
||||
<button
|
||||
className="report-form__footer-btn"
|
||||
onClick={() => handler()}
|
||||
>
|
||||
{isFetching ? <Loader /> : "Отправить"}
|
||||
</button>
|
||||
{isFetching ?
|
||||
<Loader style={'green'} /> :
|
||||
<button
|
||||
className="report-form__footer-btn"
|
||||
onClick={() => handler()}
|
||||
>
|
||||
Отпаравить
|
||||
</button>
|
||||
}
|
||||
<p className="report-form__footer-text">
|
||||
Всего за день:{" "}
|
||||
<span>
|
||||
|
@ -80,7 +80,7 @@ export const ShortReport = () => {
|
||||
<h2 className="viewReport__title">
|
||||
Ваши отчеты - <span>просмотр отчета за день</span>
|
||||
</h2>
|
||||
<Link to={`../view/${dateCreate}`}>Посмотреть подробный отчет</Link>
|
||||
<Link to={`/profile/calendar/view/${dateCreate}`}>Посмотреть подробный отчет</Link>
|
||||
</div>
|
||||
|
||||
<div className="viewReport__bar">
|
||||
|
@ -9,7 +9,7 @@ export const CardAvailableTest = ({ title, description, path, status }) => {
|
||||
return (
|
||||
<div className="card-available-test">
|
||||
<Link
|
||||
to={status === 2 ? `/quiz/report/${path}` : `/quiz/test/${path}`}
|
||||
to={status === 2 ? `/profile/quiz/report/${path}` : `/profile/quiz/test/${path}`}
|
||||
aria-disabled={true}
|
||||
className="card-available-test__container"
|
||||
style={
|
||||
@ -33,7 +33,7 @@ export const CardAvailableTest = ({ title, description, path, status }) => {
|
||||
{status === 2 && (
|
||||
<div className="card-available-test__finished">
|
||||
<p>Получить отчет по тестированию</p>
|
||||
<Link to={`/quiz/report/${path}`}>Отчет по тесту</Link>
|
||||
<Link to={`/profile/quiz/report/${path}`}>Отчет по тесту</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user