2023-07-15 17:46:19 +03:00
|
|
|
|
import { useNavigate } from 'react-router-dom';
|
2023-07-25 20:27:29 +03:00
|
|
|
|
|
|
|
|
|
import { useAuth } from '../../context/AuthContext';
|
|
|
|
|
import { useConceptTheme } from '../../context/ThemeContext';
|
2023-07-15 17:46:19 +03:00
|
|
|
|
import { EducationIcon, LibraryIcon } from '../Icons';
|
2023-07-25 20:27:29 +03:00
|
|
|
|
import Logo from './Logo'
|
2023-07-15 17:46:19 +03:00
|
|
|
|
import NavigationButton from './NavigationButton';
|
2023-07-25 20:27:29 +03:00
|
|
|
|
import TopSearch from './TopSearch';
|
2023-07-15 17:46:19 +03:00
|
|
|
|
import UserMenu from './UserMenu';
|
|
|
|
|
import UserTools from './UserTools';
|
|
|
|
|
|
2023-07-25 20:27:29 +03:00
|
|
|
|
function Navigation () {
|
|
|
|
|
const { user } = useAuth();
|
2023-07-15 17:46:19 +03:00
|
|
|
|
const navigate = useNavigate();
|
2023-07-25 00:20:37 +03:00
|
|
|
|
const { noNavigation, toggleNoNavigation } = useConceptTheme();
|
2023-07-15 17:46:19 +03:00
|
|
|
|
|
2023-07-28 00:10:26 +03:00
|
|
|
|
const navigateCommon = () => { navigate('/library?filter=common') };
|
2023-07-25 20:27:29 +03:00
|
|
|
|
const navigateHelp = () => { navigate('/manuals') };
|
|
|
|
|
|
2023-07-15 17:46:19 +03:00
|
|
|
|
return (
|
2023-07-21 01:50:57 +03:00
|
|
|
|
<nav className='sticky top-0 left-0 right-0 z-50'>
|
2023-07-25 20:27:29 +03:00
|
|
|
|
{!noNavigation &&
|
2023-07-21 01:50:57 +03:00
|
|
|
|
<button
|
|
|
|
|
title='Скрыть навигацию'
|
2023-07-21 18:44:14 +03:00
|
|
|
|
className='absolute top-0 right-0 z-[60] w-[1.2rem] h-[4rem] border-b-2 border-l-2 clr-nav rounded-none'
|
2023-07-25 00:20:37 +03:00
|
|
|
|
onClick={toggleNoNavigation}
|
2023-07-21 01:50:57 +03:00
|
|
|
|
>
|
|
|
|
|
<p>{'>'}</p><p>{'>'}</p>
|
|
|
|
|
</button>}
|
2023-07-25 20:27:29 +03:00
|
|
|
|
{noNavigation &&
|
2023-07-21 01:50:57 +03:00
|
|
|
|
<button
|
|
|
|
|
title='Показать навигацию'
|
2023-07-21 18:44:14 +03:00
|
|
|
|
className='absolute top-0 right-0 z-[60] w-[4rem] h-[1.6rem] border-b-2 border-l-2 clr-nav rounded-none'
|
2023-07-25 00:20:37 +03:00
|
|
|
|
onClick={toggleNoNavigation}
|
2023-07-21 01:50:57 +03:00
|
|
|
|
>
|
|
|
|
|
{'∨∨∨'}
|
|
|
|
|
</button>}
|
2023-07-25 20:27:29 +03:00
|
|
|
|
{!noNavigation &&
|
2023-07-21 18:44:14 +03:00
|
|
|
|
<div className='pr-6 pl-2 py-2.5 h-[4rem] flex items-center justify-between border-b-2 clr-nav rounded-none'>
|
2023-07-15 17:46:19 +03:00
|
|
|
|
<div className='flex items-start justify-start '>
|
|
|
|
|
<Logo title='КонцептПортал' />
|
|
|
|
|
<TopSearch placeholder='Поиск схемы...' />
|
|
|
|
|
</div>
|
|
|
|
|
<div className='flex items-center'>
|
|
|
|
|
{user && <UserTools/>}
|
|
|
|
|
<div className='flex items-center pl-2'>
|
2023-07-16 22:53:22 +03:00
|
|
|
|
<NavigationButton icon={<LibraryIcon />} description='Общие схемы' onClick={navigateCommon} />
|
2023-07-15 17:46:19 +03:00
|
|
|
|
<NavigationButton icon={<EducationIcon />} description='Справка' onClick={navigateHelp} />
|
|
|
|
|
<UserMenu />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-07-21 01:50:57 +03:00
|
|
|
|
</div>}
|
2023-07-15 17:46:19 +03:00
|
|
|
|
</nav>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Navigation;
|