From 9f5b1d964c7bc8479b7c85ed645140e87b7d8e9a Mon Sep 17 00:00:00 2001 From: PotapovaA Date: Mon, 10 Aug 2026 19:19:35 +0300 Subject: [PATCH] create project button in header switch --- .../components/HeaderMenu/HeaderSwitch.jsx | 22 +- .../components/common/NavigationToggle.jsx | 27 -- web/src/components/common/icons/icons.jsx | 244 +++++++++--------- web/src/pages/ProjectsPage/ProjectsPage.jsx | 2 - web/src/pages/TasksPage/TasksPage.jsx | 2 - 5 files changed, 148 insertions(+), 149 deletions(-) delete mode 100644 web/src/components/common/NavigationToggle.jsx diff --git a/web/src/components/HeaderMenu/HeaderSwitch.jsx b/web/src/components/HeaderMenu/HeaderSwitch.jsx index 6138ac9..a2c7e09 100644 --- a/web/src/components/HeaderMenu/HeaderSwitch.jsx +++ b/web/src/components/HeaderMenu/HeaderSwitch.jsx @@ -4,7 +4,7 @@ import { useLocation } from 'react-router-dom'; import { NavLink } from 'react-router-dom'; import { useAuth } from '../../app/context/AuthProvider'; import { ROLES_NAME_ID } from '../../constants/constants'; -import { AdminPanelSvg, DictSvg, TasksSvg } from '../common/icons/icons'; +import { AdminPanelSvg, DictSvg, ProjectSvg, SummarySvg, TasksSvg } from '../common/icons/icons'; const Switch = styled.div` margin-left: 1rem; @@ -54,6 +54,8 @@ export function HeaderSwitch() { const formsTasksPaths = ['/tasks', '/forms']; const adminPathsPrefix = '/admin_panel'; const dictPaths = '/dicts-navigator'; + const svodPaths = '/svod'; + const projectsPaths = '/projects'; if (!user) return; @@ -62,10 +64,24 @@ export function HeaderSwitch() {
- +
Задачи
+ +
+ +
+ Проекты +
+ + +
+ +
+ Своды +
+ {user.role_id === ROLES_NAME_ID.admin && (
@@ -87,4 +103,4 @@ export function HeaderSwitch() { if (targetElement) { return createPortal(portalContent, targetElement); } -} +} \ No newline at end of file diff --git a/web/src/components/common/NavigationToggle.jsx b/web/src/components/common/NavigationToggle.jsx deleted file mode 100644 index a392f05..0000000 --- a/web/src/components/common/NavigationToggle.jsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Box, Typography } from '@mui/material'; -import { PrimaryOutlinedButton } from './Buttons/Buttons'; // Ваш компонент кнопки - -const NavigationToggle = ({ currentView, onViewChange }) => { - const handleNavigateToTasks = () => { - onViewChange('/tasks'); - }; - - const handleNavigateToProjects = () => { - onViewChange('/projects'); - }; - - return ( - - {currentView === 'tasks' ? ( - ← К проектам - ) : ( - ← К задачам - )} - - {currentView === 'tasks' ? 'Управление задачами' : 'Управление проектами'} - - - ); -}; - -export default NavigationToggle; diff --git a/web/src/components/common/icons/icons.jsx b/web/src/components/common/icons/icons.jsx index 5fbc50e..b6c0f88 100644 --- a/web/src/components/common/icons/icons.jsx +++ b/web/src/components/common/icons/icons.jsx @@ -236,14 +236,14 @@ export const Trash = styled.div` `; export const TrashSvg = ({ fill, size = 20 }) => ( - - - - + + + + ); export const Palette = styled.div` @@ -314,30 +314,30 @@ export const Ban = styled.div` `; export const TasksSvg = ({ fill }) => ( - - - + + + ); export const AdminPanelSvg = ({ fill }) => ( - - - + + + ); export const DictSvg = ({ fill }) => ( - - - + + + ); export const Cancel = styled.div` @@ -401,120 +401,134 @@ export const EmptyListIcon = styled.div` background-size: cover; `; export const EditSvg = ({ fill = '#737373', size = '12' }) => ( - - - + + + ); export const SettingSvg = ({ size = '8' }) => ( - - - + + + ); export const UnLockedSvg = ({ size = '12' }) => ( - - - + + + ); export const QuestionMarkSvg = ({ size = '13' }) => ( - - - + + + ); export const ExportSvg = ({ size = '16', color = '#4A5565', strokeWidth = null }) => ( - <> - - - - + <> + + + + ); export const ExitSvg = ({ color = '#B73B0B', size = 16 }, props) => { - return ( - - - - ); + return ( + + + + ); }; export const CheckBoxCheckSvg = ({ size = '26' }) => { - return ( - - - - - - ); + return ( + + + + + + ); }; export const CheckBoxUncheckSvg = ({ size = '26' }) => { - return ( - - - - - ); + return ( + + + + + ); }; export const EditPenSvg = ({ fill = '#737373' }) => ( - - - + + + ); export const TransitionSvg = ({ size = 16 }) => ( - - - + + + ); + +export const ProjectSvg = ({ size = 16 }) => ( + +); + +export const SummarySvg = ({ size = 16 }) => ( + +); \ No newline at end of file diff --git a/web/src/pages/ProjectsPage/ProjectsPage.jsx b/web/src/pages/ProjectsPage/ProjectsPage.jsx index 61bd384..38d4ad5 100644 --- a/web/src/pages/ProjectsPage/ProjectsPage.jsx +++ b/web/src/pages/ProjectsPage/ProjectsPage.jsx @@ -7,7 +7,6 @@ import { SspApi } from '../../api/ssp'; import { useAuth } from '../../app/context/AuthProvider'; import { HeaderSwitch } from '../../components/HeaderMenu/HeaderSwitch'; import { PrimaryButton, PrimaryOutlinedButton } from '../../components/common/Buttons/Buttons'; -import NavigationToggle from '../../components/common/NavigationToggle'; import { PaginatedList } from '../../components/common/PaginatedList'; import { WhitePlus } from '../../components/common/icons/icons'; import { ROLES_NAME_ID } from '../../constants/constants'; @@ -199,7 +198,6 @@ export default function ProjectsPage() { <> - navigate(path)} /> - navigate(path)} />