From 78f2b3481013aa3f2fb5f3369ff12a81417e9c5d Mon Sep 17 00:00:00 2001 From: Mikola Date: Fri, 15 Mar 2024 18:19:48 +0300 Subject: [PATCH] guardian routes --- src/App.jsx | 4 +- .../ProfileHeader/ProfileHeader.jsx | 2 +- src/pages/MainPage/MainPage.jsx | 23 +++++----- .../PartnerСategories/PartnerСategories.jsx | 5 +-- src/pages/roles/DeveloperPage.jsx | 44 ++++++++----------- src/pages/roles/GuestPage.jsx | 38 ++++++++-------- src/pages/roles/PartnerPage.jsx | 42 ++++++++---------- 7 files changed, 72 insertions(+), 86 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 8ff100d6..df7a76e4 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -9,9 +9,11 @@ import { } from "react-router-dom"; import { getNotification } from "@redux/outstaffingSlice"; -import { Notification } from "@components/Notification/Notification"; + import { MainPage } from "@pages/MainPage/MainPage"; +import { Notification } from "@components/Notification/Notification"; + import "assets/fonts/stylesheet.css"; import "assets/global.scss"; diff --git a/src/components/ProfileHeader/ProfileHeader.jsx b/src/components/ProfileHeader/ProfileHeader.jsx index b143939b..9ed70487 100644 --- a/src/components/ProfileHeader/ProfileHeader.jsx +++ b/src/components/ProfileHeader/ProfileHeader.jsx @@ -92,7 +92,7 @@ export const ProfileHeader = () => { }, []); const handler = (e) => { - e.preventDefault() + e.preventDefault(); localStorage.clear(); dispatch(auth(false)); navigate("/auth"); diff --git a/src/pages/MainPage/MainPage.jsx b/src/pages/MainPage/MainPage.jsx index 870b818d..566c1921 100644 --- a/src/pages/MainPage/MainPage.jsx +++ b/src/pages/MainPage/MainPage.jsx @@ -1,23 +1,22 @@ import React from "react"; import { useMemo } from "react"; -import { PartnerPage } from "@pages/roles/PartnerPage"; -import { DeveloperPage } from "@pages/roles/DeveloperPage"; -import { GuestPage } from "@pages/roles/GuestPage"; import { useSelector } from "react-redux"; + import { selectAuth } from "@redux/outstaffingSlice"; +import { DeveloperPage } from "@pages/roles/DeveloperPage"; +import { GuestPage } from "@pages/roles/GuestPage"; +import { PartnerPage } from "@pages/roles/PartnerPage"; + export const MainPage = () => { - const roleId = localStorage.getItem("role_status") + const roleId = localStorage.getItem("role_status"); const isAuth = useSelector(selectAuth); const user_roles = { developer: 4, partner: 18 - } + }; - const CurrentRolePage = useMemo( - () => getRolePage(Number(roleId)), - [isAuth] - ); + const CurrentRolePage = useMemo(() => getRolePage(Number(roleId)), [isAuth]); function getRolePage(roleId) { switch (roleId) { @@ -30,7 +29,5 @@ export const MainPage = () => { } } - return( - - ) -} + return ; +}; diff --git a/src/pages/PartnerСategories/PartnerСategories.jsx b/src/pages/PartnerСategories/PartnerСategories.jsx index d69da8cf..8266df93 100644 --- a/src/pages/PartnerСategories/PartnerСategories.jsx +++ b/src/pages/PartnerСategories/PartnerСategories.jsx @@ -65,10 +65,7 @@ export const PartnerCategories = () => { { label: "Резюме", renderCell: (item) => ( - + Резюме ) diff --git a/src/pages/roles/DeveloperPage.jsx b/src/pages/roles/DeveloperPage.jsx index a66c0d90..b083f7c0 100644 --- a/src/pages/roles/DeveloperPage.jsx +++ b/src/pages/roles/DeveloperPage.jsx @@ -1,44 +1,38 @@ import React from "react"; -import { Navigate, Route, Routes } from "react-router-dom";; +import { Navigate, Route, Routes } from "react-router-dom"; + +import { PartnerSettings } from "@pages/PartnerSettings/PartnerSettings"; +import { PartnerTreaties } from "@pages/PartnerTreaties/PartnerTreaties"; +import { Payouts } from "@pages/Payouts/Payouts"; import { Profile } from "@pages/Profile/Profile"; -import { ProfileCalendar } from "@components/ProfileCalendar/ProfileCalendar"; -import { ReportForm } from "@components/ReportForm/ReportForm"; -import { ViewReport } from "@pages/ViewReport/ViewReport"; +import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker"; +import { PassingTests } from "@pages/Quiz/PassingTests"; +import { QuizPage } from "@pages/Quiz/QuizPage"; +import { QuizReportPage } from "@pages/Quiz/QuizReportPage"; +import Statistics from "@pages/Statistics/Statistics"; import { Summary } from "@pages/Summary/Summary"; import { Tracker } from "@pages/Tracker/Tracker"; -import Statistics from "@pages/Statistics/Statistics"; -import { Payouts } from "@pages/Payouts/Payouts"; -import { PartnerTreaties } from "@pages/PartnerTreaties/PartnerTreaties"; -import { QuizPage } from "@pages/Quiz/QuizPage"; -import { PassingTests } from "@pages/Quiz/PassingTests"; -import { QuizReportPage } from "@pages/Quiz/QuizReportPage"; -import { PartnerSettings } from "@pages/PartnerSettings/PartnerSettings"; -import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker"; +import { ViewReport } from "@pages/ViewReport/ViewReport"; + import { TicketFullScreen } from "@components/Modal/Tracker/TicketFullScreen/TicketFullScreen"; +import { ProfileCalendar } from "@components/ProfileCalendar/ProfileCalendar"; +import { ReportForm } from "@components/ReportForm/ReportForm"; export const DeveloperPage = () => { - return( + return ( } > - } - /> + } /> } /> } /> } /> - } - /> + } /> } /> } /> } /> @@ -53,5 +47,5 @@ export const DeveloperPage = () => { } /> - ) -} + ); +}; diff --git a/src/pages/roles/GuestPage.jsx b/src/pages/roles/GuestPage.jsx index 8b783bab..359dddab 100644 --- a/src/pages/roles/GuestPage.jsx +++ b/src/pages/roles/GuestPage.jsx @@ -1,25 +1,27 @@ import React from "react"; import { Navigate, Route, Routes } from "react-router-dom"; -import { TrackerIntro } from "@pages/TrackerIntro/TrackerIntro"; -import { TrackerAuth } from "@pages/TrackerAuth/TrackerAuth"; -import { Forms } from "@pages/Forms/Forms"; -import { TrackerRegistration } from "@pages/TrackerRegistration/TrackerRegistration"; -import { CompanyInfo } from "@pages/CompanyInfo/CompanyInfo"; -import { RegistrationSetting } from "@pages/RegistrationSetting/RegistrationSetting"; -import CatalogSpecialists from "@pages/CatalogSpecialists/CatalogSpecialists"; -import { FreeDevelopers } from "@components/FreeDevelopers/FreeDevelopers"; -import { AuthForCandidate } from "@pages/AuthForCandidate/AuthForCandidate"; -import { RegistrationForCandidate } from "@pages/RegistrationForCandidate/RegistrationForCandidate"; -import { FrequentlyAskedQuestions } from "@pages/FrequentlyAskedQuestions/FrequentlyAskedQuestions"; -import { Blog } from "@pages/Blog/Blog"; + import { Article } from "@pages/Article/Article"; -import { FrequentlyAskedQuestion } from "@pages/FrequentlyAskedQuestion/FrequentlyAskedQuestion"; -import { SingleReportPage } from "@pages/SingleReportPage/SingleReportPage"; -import { ProfileCandidate } from "@pages/ProfileCandidate/ProfileCandidate"; import { Auth } from "@pages/Auth/Auth"; +import { AuthForCandidate } from "@pages/AuthForCandidate/AuthForCandidate"; +import { Blog } from "@pages/Blog/Blog"; +import CatalogSpecialists from "@pages/CatalogSpecialists/CatalogSpecialists"; +import { CompanyInfo } from "@pages/CompanyInfo/CompanyInfo"; +import { Forms } from "@pages/Forms/Forms"; +import { FrequentlyAskedQuestion } from "@pages/FrequentlyAskedQuestion/FrequentlyAskedQuestion"; +import { FrequentlyAskedQuestions } from "@pages/FrequentlyAskedQuestions/FrequentlyAskedQuestions"; +import { ProfileCandidate } from "@pages/ProfileCandidate/ProfileCandidate"; +import { RegistrationForCandidate } from "@pages/RegistrationForCandidate/RegistrationForCandidate"; +import { RegistrationSetting } from "@pages/RegistrationSetting/RegistrationSetting"; +import { SingleReportPage } from "@pages/SingleReportPage/SingleReportPage"; +import { TrackerAuth } from "@pages/TrackerAuth/TrackerAuth"; +import { TrackerIntro } from "@pages/TrackerIntro/TrackerIntro"; +import { TrackerRegistration } from "@pages/TrackerRegistration/TrackerRegistration"; + +import { FreeDevelopers } from "@components/FreeDevelopers/FreeDevelopers"; export const GuestPage = () => { - return( + return ( } /> } /> @@ -68,5 +70,5 @@ export const GuestPage = () => { } /> - ) -} + ); +}; diff --git a/src/pages/roles/PartnerPage.jsx b/src/pages/roles/PartnerPage.jsx index 2626d60b..a94d9f5c 100644 --- a/src/pages/roles/PartnerPage.jsx +++ b/src/pages/roles/PartnerPage.jsx @@ -1,26 +1,28 @@ import React from "react"; import { Navigate, Route, Routes } from "react-router-dom"; -import { Candidate } from "@components/Candidate/Candidate"; + import { FormPage } from "@pages/FormPage/FormPage"; -import { Calendar } from "@components/Calendar/Calendar"; -import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker"; -import { TicketFullScreen } from "@components/Modal/Tracker/TicketFullScreen/TicketFullScreen"; -import { Profile } from "@pages/Profile/Profile"; import { Home } from "@pages/Home/Home"; -import { ViewReport } from "@pages/ViewReport/ViewReport"; -import { Tracker } from "@pages/Tracker/Tracker"; -import Statistics from "@pages/Statistics/Statistics"; -import { PartnerRequests } from "@pages/PartnerRequests/PartnerRequests"; import { PartnerAddRequest } from "@pages/PartnerAddRequest/PartnerAddRequest"; import { PartnerBid } from "@pages/PartnerBid/PartnerBid"; -import { PartnerCategories } from "@pages/PartnerСategories/PartnerСategories"; import { PartnerEmployeeReport } from "@pages/PartnerEmployeeReport/PartnerEmployeeReport"; -import { PartnerTreaties } from "@pages/PartnerTreaties/PartnerTreaties"; import { PartnerEmployees } from "@pages/PartnerEmployees/PartnerEmployees"; +import { PartnerRequests } from "@pages/PartnerRequests/PartnerRequests"; import { PartnerSettings } from "@pages/PartnerSettings/PartnerSettings"; +import { PartnerTreaties } from "@pages/PartnerTreaties/PartnerTreaties"; +import { PartnerCategories } from "@pages/PartnerСategories/PartnerСategories"; +import { Profile } from "@pages/Profile/Profile"; +import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker"; +import Statistics from "@pages/Statistics/Statistics"; +import { Tracker } from "@pages/Tracker/Tracker"; +import { ViewReport } from "@pages/ViewReport/ViewReport"; + +import { Calendar } from "@components/Calendar/Calendar"; +import { Candidate } from "@components/Candidate/Candidate"; +import { TicketFullScreen } from "@components/Modal/Tracker/TicketFullScreen/TicketFullScreen"; export const PartnerPage = () => { - return( + return ( } /> } /> @@ -31,20 +33,12 @@ export const PartnerPage = () => { path="/tracker/task/:id" element={} > - } - /> + } /> } /> } /> - } - /> + } /> } /> } /> } /> @@ -67,5 +61,5 @@ export const PartnerPage = () => { } /> - ) -} + ); +};