active links in nav, delete report, loaders in report, changes routes

This commit is contained in:
Mikola
2024-02-07 18:54:55 +03:00
parent b75b846335
commit 1fd6a73652
6 changed files with 51 additions and 30 deletions

View File

@ -9,7 +9,6 @@ import { urlForLocal } from "@utils/helper";
import avatarMok from "assets/images/avatarMok.png";
export const Navigation = () => {
const profileInfo = useSelector(getProfileInfo);
const currentPath = window.location.pathname;
const [user] = useState(
@ -81,7 +80,7 @@ export const Navigation = () => {
key={index}
end
to={link.path === "/Quiz" ? link.path : `/profile${link.path}`}
className={currentPath. includes(link.path) ? 'active' : ''}
className={currentPath.includes(link.path) ? "active" : ""}
>
{link.name}
</NavLink>

View File

@ -98,7 +98,9 @@ export const ProfileCalendarComponent = React.memo(
if (userId) {
return `/profile/calendar/view/${date.created_at}/${userId}`;
}
return `/profile/calendar/view/${date.created_at}/${localStorage.getItem("id")}`;
return `/profile/calendar/view/${
date.created_at
}/${localStorage.getItem("id")}`;
}
}
@ -282,15 +284,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

@ -87,12 +87,12 @@ const ReportForm = () => {
};
const handler = () => {
setIsFetching(true)
setIsFetching(true);
for (let input of inputs) {
if (!input.task || !input.hours_spent) {
setReportSuccess("Заполните задачи");
setTimeout(() => setReportSuccess(""), 2000);
setIsFetching(false)
setIsFetching(false);
return;
}
}
@ -294,15 +294,16 @@ const ReportForm = () => {
<div className="row">
<div className="col-12">
<div className="report-form__footer">
{isFetching ?
<Loader style={'green'} /> :
{isFetching ? (
<Loader style={"green"} />
) : (
<button
className="report-form__footer-btn"
onClick={() => handler()}
>
Отпаравить
</button>
}
)}
<p className="report-form__footer-text">
Всего за день:{" "}
<span>

View File

@ -80,7 +80,9 @@ export const ShortReport = () => {
<h2 className="viewReport__title">
Ваши отчеты - <span>просмотр отчета за день</span>
</h2>
<Link to={`/profile/calendar/view/${dateCreate}`}>Посмотреть подробный отчет</Link>
<Link to={`/profile/calendar/view/${dateCreate}`}>
Посмотреть подробный отчет
</Link>
</div>
<div className="viewReport__bar">

View File

@ -9,7 +9,11 @@ export const CardAvailableTest = ({ title, description, path, status }) => {
return (
<div className="card-available-test">
<Link
to={status === 2 ? `/profile/quiz/report/${path}` : `/profile/quiz/test/${path}`}
to={
status === 2
? `/profile/quiz/report/${path}`
: `/profile/quiz/test/${path}`
}
aria-disabled={true}
className="card-available-test__container"
style={