Compare commits

..

No commits in common. "55791474d60a486f50c298a05fbab619941fddcd" and "8c1341bba8c2deefc056f6312601c7c50c5f9b4e" have entirely different histories.

5 changed files with 149 additions and 148 deletions

View File

@ -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, ProjectSvg, SummarySvg, TasksSvg } from '../common/icons/icons';
import { AdminPanelSvg, DictSvg, TasksSvg } from '../common/icons/icons';
const Switch = styled.div`
margin-left: 1rem;
@ -54,8 +54,6 @@ export function HeaderSwitch() {
const formsTasksPaths = ['/tasks', '/forms'];
const adminPathsPrefix = '/admin_panel';
const dictPaths = '/dicts-navigator';
const svodPaths = '/svod';
const projectsPaths = '/projects';
if (!user) return;
@ -64,24 +62,10 @@ export function HeaderSwitch() {
<Buttons>
<StyledNavLink to='/tasks' className={formsTasksPaths.includes(location.pathname) ? 'active' : ''}>
<div className='img'>
<TasksSvg fill={formsTasksPaths.includes(location.pathname) ? '#258141' : '#99A1AF'} />
<TasksSvg fill={formsTasksPaths.includes(location.pathname) ? '#258141' : '#99A1AF'}></TasksSvg>
</div>
<span>Задачи</span>
</StyledNavLink>
<StyledNavLink to='/projects' className={location.pathname.startsWith(projectsPaths) ? 'active' : ''}>
<div className='img'>
<ProjectSvg fill={location.pathname.startsWith(projectsPaths) ? '#258141' : '#99A1AF'} />
</div>
<span>Проекты</span>
</StyledNavLink>
<StyledNavLink to='/svod' className={location.pathname.startsWith(svodPaths) ? 'active' : ''}>
<div className='img'>
<SummarySvg fill={location.pathname.startsWith(svodPaths) ? '#258141' : '#99A1AF'} />
</div>
<span>Своды</span>
</StyledNavLink>
{user.role_id === ROLES_NAME_ID.admin && (
<StyledNavLink to='/admin_panel/users' className={location.pathname.startsWith(adminPathsPrefix) ? 'active' : ''}>
<div className='img'>

View File

@ -0,0 +1,27 @@
import { Box, Typography } from '@mui/material';
import { PrimaryOutlinedButton } from './Buttons/Buttons'; // Ваш компонент кнопки
const NavigationToggle = ({ currentView, onViewChange }) => {
const handleNavigateToTasks = () => {
onViewChange('/tasks');
};
const handleNavigateToProjects = () => {
onViewChange('/projects');
};
return (
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1.5 }}>
{currentView === 'tasks' ? (
<PrimaryOutlinedButton onClick={handleNavigateToProjects}> К проектам</PrimaryOutlinedButton>
) : (
<PrimaryOutlinedButton onClick={handleNavigateToTasks}> К задачам</PrimaryOutlinedButton>
)}
<Typography variant='h6' color='primary' sx={{ fontWeight: 200, fontSize: '1rem' }}>
{currentView === 'tasks' ? 'Управление задачами' : 'Управление проектами'}
</Typography>
</Box>
);
};
export default NavigationToggle;

View File

@ -518,17 +518,3 @@ export const TransitionSvg = ({ size = 16 }) => (
/>
</svg>
);
export const ProjectSvg = ({ size = 16 }) => (
<svg width={size} height={size} viewBox="0 0 16 16" fill="none" aria-hidden="true">
<path d="M2.7 3.2h4.1l1 1.3h5.5c.7 0 1.2.5 1.2 1.2v6.6c0 .7-.5 1.2-1.2 1.2H2.7c-.7 0-1.2-.5-1.2-1.2V4.4c0-.7.5-1.2 1.2-1.2Z" stroke="#258141" stroke-width="1.15" stroke-linejoin="round" /><path d="M4.2 7.2h7.6M4.2 9.5h5.4" stroke="#258141" stroke-width="1.15" stroke-linecap="round">
</path>
</svg>
);
export const SummarySvg = ({ size = 16 }) => (
<svg width={size} height={size} viewBox="0 0 16 16" fill="none" aria-hidden="true">
<path d="M2.5 13.3V2.7M2.5 13.3h11" stroke="#99A1AF" stroke-width="1.15" stroke-linecap="round" /><path d="M4.6 10.6V7.9M7.9 10.6V4.8M11.2 10.6V6.4" stroke="#99A1AF" stroke-width="1.45" stroke-linecap="round">
</path>
</svg>
);

View File

@ -7,6 +7,7 @@ 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';
@ -198,6 +199,7 @@ export default function ProjectsPage() {
<>
<PageContainer>
<HeaderSwitch />
<NavigationToggle currentView={'projects'} onViewChange={(path) => navigate(path)} />
<PaginatedList
items={items}

View File

@ -8,6 +8,7 @@ import { useAuth } from '../../app/context/AuthProvider';
import { HeaderSwitch } from '../../components/HeaderMenu/HeaderSwitch';
import { PrimaryButton } from '../../components/common/Buttons/Buttons';
import Modal from '../../components/common/Modal/Modal';
import NavigationToggle from '../../components/common/NavigationToggle';
import { OrgUnitsAutocompletePaper } from '../../components/common/OrgUnitsAutocompletePaper/OrgUnitsAutocompletePaper';
import { renderOrgUnitValue } from '../../components/common/OrgUnitsAutocompletePaper/renderOrgUnitValue';
import { PaginatedList } from '../../components/common/PaginatedList';
@ -217,6 +218,7 @@ export default function TasksPage() {
<>
<PageContainer>
<HeaderSwitch />
<NavigationToggle currentView={'tasks'} onViewChange={(path) => navigate(path)} />
<PaginatedList
items={items}
loading={loading}