Merge pull request 'create project button in header switch' (#80) from update-header-switch into test
Reviewed-on: #80
This commit is contained in:
commit
55791474d6
@ -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() {
|
||||
<Buttons>
|
||||
<StyledNavLink to='/tasks' className={formsTasksPaths.includes(location.pathname) ? 'active' : ''}>
|
||||
<div className='img'>
|
||||
<TasksSvg fill={formsTasksPaths.includes(location.pathname) ? '#258141' : '#99A1AF'}></TasksSvg>
|
||||
<TasksSvg fill={formsTasksPaths.includes(location.pathname) ? '#258141' : '#99A1AF'} />
|
||||
</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'>
|
||||
|
||||
@ -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 (
|
||||
<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;
|
||||
@ -518,3 +518,17 @@ 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>
|
||||
);
|
||||
@ -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() {
|
||||
<>
|
||||
<PageContainer>
|
||||
<HeaderSwitch />
|
||||
<NavigationToggle currentView={'projects'} onViewChange={(path) => navigate(path)} />
|
||||
|
||||
<PaginatedList
|
||||
items={items}
|
||||
|
||||
@ -8,7 +8,6 @@ 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';
|
||||
@ -218,7 +217,6 @@ export default function TasksPage() {
|
||||
<>
|
||||
<PageContainer>
|
||||
<HeaderSwitch />
|
||||
<NavigationToggle currentView={'tasks'} onViewChange={(path) => navigate(path)} />
|
||||
<PaginatedList
|
||||
items={items}
|
||||
loading={loading}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user