From 31cc5acbe1ddd7b0eb0f1de67aa299aa523489f3 Mon Sep 17 00:00:00 2001 From: M1kola Date: Mon, 27 Feb 2023 16:50:32 +0300 Subject: [PATCH] partner-personal-area --- src/App.js | 5 +- src/components/AuthBox/AuthBox.js | 1 + src/components/Calendar/Calendar.js | 5 +- src/components/Candidate/Candidate.js | 5 +- .../ProfileBreadcrumbs/ProfileBreadcrumbs.js | 16 ++++++ .../profileBreadcrumbs.scss | 50 ++++++++++++++++++ .../ProfileCalendar/ProfileCalendar.js | 7 ++- src/components/ProfileHeader/ProfileHeader.js | 2 +- src/components/ReportForm/ReportForm.js | 11 +++- src/images/BreadcrumbsArrow.png | Bin 0 -> 187 bytes src/pages/FormPage/FormPage.js | 5 +- src/pages/Home/Home.js | 4 ++ .../PartnerAddRequest/PartnerAddRequest.js | 11 ++++ src/pages/PartnerBid/PartnerBid.js | 16 ++++-- src/pages/PartnerRequests/PartnerRequests.js | 11 +++- src/pages/Profile/Profile.js | 4 +- src/pages/Summary/Summary.js | 10 ++++ src/pages/ViewReport/ViewReport.js | 10 +++- 18 files changed, 157 insertions(+), 16 deletions(-) create mode 100644 src/components/ProfileBreadcrumbs/ProfileBreadcrumbs.js create mode 100644 src/components/ProfileBreadcrumbs/profileBreadcrumbs.scss create mode 100644 src/images/BreadcrumbsArrow.png diff --git a/src/App.js b/src/App.js index cbd1e31b..75176d24 100644 --- a/src/App.js +++ b/src/App.js @@ -39,8 +39,6 @@ const App = () => { - }/> - }/> }/> @@ -61,6 +59,7 @@ const App = () => { }/> + }/> }/> }/> }/> @@ -72,7 +71,7 @@ const App = () => { }/> - }/> + }/> diff --git a/src/components/AuthBox/AuthBox.js b/src/components/AuthBox/AuthBox.js index 40011dfb..d07661e4 100644 --- a/src/components/AuthBox/AuthBox.js +++ b/src/components/AuthBox/AuthBox.js @@ -77,6 +77,7 @@ export const AuthBox = ({title, altTitle, roleChangeLink}) => { localStorage.setItem('auth_token', res.access_token); localStorage.setItem('id', res.id); localStorage.setItem('cardId', res.card_id); + localStorage.setItem('role_status', res.status); localStorage.setItem( 'access_token_expired_at', res.access_token_expired_at diff --git a/src/components/Calendar/Calendar.js b/src/components/Calendar/Calendar.js index 09d26c94..9b35e7be 100644 --- a/src/components/Calendar/Calendar.js +++ b/src/components/Calendar/Calendar.js @@ -1,6 +1,6 @@ import React, {useEffect, useState} from 'react' import {useSelector} from 'react-redux' -import {Link, useNavigate} from 'react-router-dom' +import {Link, Navigate, useNavigate} from 'react-router-dom' import CalendarComponent from './CalendarComponent' import {currentMonth} from './calendarHelper' @@ -16,6 +16,9 @@ import {urlForLocal} from "../../helper"; const Calendar = () => { + if(localStorage.getItem('role_status') !== '18') { + return + } const candidateForCalendar = useSelector(selectCurrentCandidate); diff --git a/src/components/Candidate/Candidate.js b/src/components/Candidate/Candidate.js index 4dbdd427..f0c31be6 100644 --- a/src/components/Candidate/Candidate.js +++ b/src/components/Candidate/Candidate.js @@ -1,5 +1,5 @@ import React, {useEffect, useState} from 'react' -import {useParams, Link, useNavigate} from 'react-router-dom' +import {useParams, Link, useNavigate, Navigate} from 'react-router-dom' import {useSelector, useDispatch} from 'react-redux' import SkillSection from '../SkillSection/SkillSection' @@ -23,6 +23,9 @@ import {Header} from "../Header/Header"; const Candidate = () => { + if(localStorage.getItem('role_status') !== '18') { + return + } const {id: candidateId} = useParams(); const navigate = useNavigate(); diff --git a/src/components/ProfileBreadcrumbs/ProfileBreadcrumbs.js b/src/components/ProfileBreadcrumbs/ProfileBreadcrumbs.js new file mode 100644 index 00000000..7ef5f280 --- /dev/null +++ b/src/components/ProfileBreadcrumbs/ProfileBreadcrumbs.js @@ -0,0 +1,16 @@ +import React from 'react' +import {Link} from "react-router-dom"; + +import './profileBreadcrumbs.scss' + +export const ProfileBreadcrumbs = ({ links }) => { + return ( +
+ {links.map((link, index) => { + return {link.name} + }) + + } +
+ ) +} diff --git a/src/components/ProfileBreadcrumbs/profileBreadcrumbs.scss b/src/components/ProfileBreadcrumbs/profileBreadcrumbs.scss new file mode 100644 index 00000000..9992152d --- /dev/null +++ b/src/components/ProfileBreadcrumbs/profileBreadcrumbs.scss @@ -0,0 +1,50 @@ +.profileBreadcrumbs { + display: flex; + margin-bottom: 12px; + + @media (max-width: 570px) { + margin-top: 15px; + } + + a { + color: #5B6871; + font-weight: 400; + font-size: 12px; + line-height: 16px; + transition: 0.3s all ease; + position: relative; + margin-right: 20px; + display: flex; + align-items: center; + + @media (max-width: 525px) { + font-size: 10px; + } + + @media (max-width: 455px) { + font-size: 9px; + } + + &:hover { + text-decoration: none; + color: #000000; + } + + &:after { + content: ''; + background-image: url("../../images/BreadcrumbsArrow.png"); + background-repeat: no-repeat; + width: 7px; + height:10px; + position: absolute; + right: -14px; + } + + &:last-child { + margin-right: 0; + &:after { + background: none; + } + } + } +} diff --git a/src/components/ProfileCalendar/ProfileCalendar.js b/src/components/ProfileCalendar/ProfileCalendar.js index 6fd2dcbe..a81a2325 100644 --- a/src/components/ProfileCalendar/ProfileCalendar.js +++ b/src/components/ProfileCalendar/ProfileCalendar.js @@ -2,12 +2,13 @@ import React, { useEffect, useState } from 'react' import {useDispatch, useSelector} from 'react-redux' import {getReports} from '../Calendar/calendarHelper' -import { Link } from 'react-router-dom' +import {Link, Navigate} from 'react-router-dom' import moment from "moment"; import {ProfileCalendarComponent} from "./ProfileCalendarComponent"; import {Loader} from "../Loader/Loader"; import {ProfileHeader} from "../ProfileHeader/ProfileHeader"; +import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs" import { Footer } from '../Footer/Footer' import {urlForLocal} from "../../helper"; @@ -21,6 +22,9 @@ import './profileCalendar.scss' export const ProfileCalendar = () => { + if(localStorage.getItem('role_status') === '18') { + return + } const dispatch = useDispatch(); const profileInfo = useSelector(getProfileInfo) const requestDates = useSelector(getRequestDates) @@ -62,6 +66,7 @@ export const ProfileCalendar = () => {
+

Ваши отчеты

diff --git a/src/components/ProfileHeader/ProfileHeader.js b/src/components/ProfileHeader/ProfileHeader.js index ae91b927..845b284a 100644 --- a/src/components/ProfileHeader/ProfileHeader.js +++ b/src/components/ProfileHeader/ProfileHeader.js @@ -21,7 +21,7 @@ export const ProfileHeader = () => { const userRole = useSelector(getRole); const profileInfo = useSelector(getProfileInfo); - const [user] = useState('partner') + const [user] = useState(localStorage.getItem('role_status') === '18' ? 'partner' : 'developer') const [navInfo] = useState({ developer: [ { diff --git a/src/components/ReportForm/ReportForm.js b/src/components/ReportForm/ReportForm.js index 77163999..02dc26cd 100644 --- a/src/components/ReportForm/ReportForm.js +++ b/src/components/ReportForm/ReportForm.js @@ -1,15 +1,15 @@ import React, {useState, useEffect} from 'react' import {useSelector} from 'react-redux' -import {Link, useNavigate} from 'react-router-dom' +import {Link, Navigate, useNavigate} from 'react-router-dom' import DatePicker, { registerLocale } from "react-datepicker" import {getCorrectDate, getCreatedDate} from '../Calendar/calendarHelper' import ru from "date-fns/locale/ru" registerLocale("ru", ru); import {Loader} from '../Loader/Loader' -import {currentMonthAndDay} from '../Calendar/calendarHelper' import {Footer} from "../Footer/Footer"; import {ProfileHeader} from "../ProfileHeader/ProfileHeader"; +import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs" import {apiRequest} from "../../api/request"; @@ -25,6 +25,9 @@ import './reportForm.scss' import "react-datepicker/dist/react-datepicker.css"; const ReportForm = () => { + if(localStorage.getItem('role_status') === '18') { + return + } const navigate= useNavigate(); const reportDate = useSelector(getReportDate); @@ -96,6 +99,10 @@ const ReportForm = () => {
+

Ваши отчеты - добавить отчет

diff --git a/src/images/BreadcrumbsArrow.png b/src/images/BreadcrumbsArrow.png new file mode 100644 index 0000000000000000000000000000000000000000..a518b4edb969aad9739a8c700c2f22a60ae6525a GIT binary patch literal 187 zcmeAS@N?(olHy`uVBq!ia0vp^>_E)L!3HEN&baUbDb50q$YKTtZeb8+WSBKa0w~B> z9OUlAu$e073tP2 emevnhTbU-jHoX5-pe6xmHiM_DpUXO@geCxmJvkWw literal 0 HcmV?d00001 diff --git a/src/pages/FormPage/FormPage.js b/src/pages/FormPage/FormPage.js index 8d3e757f..6675cc81 100644 --- a/src/pages/FormPage/FormPage.js +++ b/src/pages/FormPage/FormPage.js @@ -1,6 +1,6 @@ import React, {useEffect} from 'react' import {useDispatch, useSelector} from 'react-redux' -import {useParams, useNavigate} from 'react-router-dom' +import {useParams, useNavigate, Navigate} from 'react-router-dom' import SVG from 'react-inlinesvg' import Form from '../../components/Form/Form' @@ -22,6 +22,9 @@ import {urlForLocal} from "../../helper"; import './formPage.scss' const FormPage = () => { + if(localStorage.getItem('role_status') !== '18') { + return + } const params = useParams(); const navigate = useNavigate(); const dispatch = useDispatch(); diff --git a/src/pages/Home/Home.js b/src/pages/Home/Home.js index 0ae31db8..905b5543 100644 --- a/src/pages/Home/Home.js +++ b/src/pages/Home/Home.js @@ -9,9 +9,13 @@ import {profiles, tags} from '../../redux/outstaffingSlice' import {Header} from "../../components/Header/Header"; import {apiRequest} from "../../api/request"; +import {Navigate} from "react-router-dom"; const Home = () => { + if(localStorage.getItem('role_status') !== '18') { + return + } const [isLoadingMore, setIsLoadingMore] = useState(false); const [index, setIndex] = useState(4); diff --git a/src/pages/PartnerAddRequest/PartnerAddRequest.js b/src/pages/PartnerAddRequest/PartnerAddRequest.js index 3ea3ad4a..a81d9dfd 100644 --- a/src/pages/PartnerAddRequest/PartnerAddRequest.js +++ b/src/pages/PartnerAddRequest/PartnerAddRequest.js @@ -1,17 +1,28 @@ import React from 'react'; import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader"; +import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs" import {Footer} from "../../components/Footer/Footer"; import arrowDown from "../../images/selectArrow.png" import './partnerAddRequest.scss' +import {Navigate} from "react-router-dom"; export const PartnerAddRequest = () => { + if(localStorage.getItem('role_status') !== '18') { + return + } return (
+

Страница добавления заявки

diff --git a/src/pages/PartnerBid/PartnerBid.js b/src/pages/PartnerBid/PartnerBid.js index dbd75cf9..9b1326bb 100644 --- a/src/pages/PartnerBid/PartnerBid.js +++ b/src/pages/PartnerBid/PartnerBid.js @@ -1,7 +1,8 @@ import React, {useState} from 'react'; -import {Link} from "react-router-dom"; +import {Link, Navigate} from "react-router-dom"; import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader"; +import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs" import {Footer} from "../../components/Footer/Footer"; import arrowSwitchDate from "../../images/arrowViewReport.png"; @@ -12,6 +13,9 @@ import personImg from "../../images/mokPerson.png" import './partnerBid.scss' export const PartnerBid = () => { + if(localStorage.getItem('role_status') !== '18') { + return + } const [mokPersons] = useState([ { name: 'Дмитрий, PHP Back end - разработчик, Middle', @@ -33,6 +37,12 @@ export const PartnerBid = () => {
+

Страница заявки

PHP разработчик

@@ -97,8 +107,8 @@ export const PartnerBid = () => {

Подходящие сотрудники по запросу

- {mokPersons.map((person) => { - return
+ {mokPersons.map((person, index) => { + return
avatar

{person.name}

diff --git a/src/pages/PartnerRequests/PartnerRequests.js b/src/pages/PartnerRequests/PartnerRequests.js index 4ff96d3e..01e3b15b 100644 --- a/src/pages/PartnerRequests/PartnerRequests.js +++ b/src/pages/PartnerRequests/PartnerRequests.js @@ -1,12 +1,16 @@ import React, {useState} from 'react'; -import {Link} from "react-router-dom"; +import {Link, Navigate} from "react-router-dom"; import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader"; +import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs" import {Footer} from "../../components/Footer/Footer"; import './partnerRequests.scss' export const PartnerRequests = () => { + if(localStorage.getItem('role_status') !== '18') { + return + } const [items] = useState([ { name: 'PHP разработчик ', @@ -29,6 +33,11 @@ export const PartnerRequests = () => {
+

Запросы

diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js index 44d329f8..8b96cca2 100644 --- a/src/pages/Profile/Profile.js +++ b/src/pages/Profile/Profile.js @@ -3,6 +3,7 @@ import {useSelector} from "react-redux"; import {Link} from "react-router-dom"; import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader"; +import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs" import {Footer} from "../../components/Footer/Footer"; import {getProfileInfo} from "../../redux/outstaffingSlice"; @@ -22,7 +23,7 @@ import './profile.scss' export const Profile = () => { const profileInfo = useSelector(getProfileInfo); - const [user] = useState('partner') + const [user] = useState(localStorage.getItem('role_status') === '18' ? 'partner' : 'developer') const [profileItemsInfo] = useState({ developer: [ { @@ -94,6 +95,7 @@ export const Profile = () => {
+

{user === 'developer' ?

Добрый день, 

{profileInfo.fio}
diff --git a/src/pages/Summary/Summary.js b/src/pages/Summary/Summary.js index 48bf6294..c496e028 100644 --- a/src/pages/Summary/Summary.js +++ b/src/pages/Summary/Summary.js @@ -2,6 +2,7 @@ import React, {useEffect, useState} from 'react'; import {useSelector} from "react-redux"; import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader"; import {getProfileInfo} from "../../redux/outstaffingSlice"; +import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs" import {Footer} from '../../components/Footer/Footer' import {transformHtml, urlForLocal} from "../../helper"; @@ -11,8 +12,12 @@ import gitImgItem from "../../images/gitItemImg.png" import './summary.scss' import {apiRequest} from "../../api/request"; +import {Navigate} from "react-router-dom"; export const Summary = () => { + if(localStorage.getItem('role_status') === '18') { + return + } const profileInfo = useSelector(getProfileInfo); const [openGit, setOpenGit] = useState(false); const [gitInfo, setGitInfo] = useState([]); @@ -26,6 +31,11 @@ export const Summary = () => {
+

Ваше резюме {openGit && - Git}

{openGit &&
setOpenGit(false)}> arrow diff --git a/src/pages/ViewReport/ViewReport.js b/src/pages/ViewReport/ViewReport.js index 99833f7f..4c6fbed6 100644 --- a/src/pages/ViewReport/ViewReport.js +++ b/src/pages/ViewReport/ViewReport.js @@ -1,11 +1,12 @@ import React, {useEffect, useState} from 'react' -import {Link} from "react-router-dom"; +import {Link, Navigate} from "react-router-dom"; import {useSelector} from "react-redux"; import {getReportDate} from "../../redux/reportSlice"; import {Loader} from "../../components/Loader/Loader" import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader"; +import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs" import {Footer} from "../../components/Footer/Footer"; import arrow from "../../images/right-arrow.png"; @@ -16,6 +17,9 @@ import {getCorrectDate, getCreatedDate} from '../../components/Calendar/calendar import './viewReport.scss' export const ViewReport = () => { + if(localStorage.getItem('role_status') === '18') { + return + } const reportDate = useSelector(getReportDate); const [taskText, setTaskText] = useState([]); @@ -76,6 +80,10 @@ export const ViewReport = () => {
+

Ваши отчеты - просмотр отчета за день

arrow

Вернуться