2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
2023-12-25 16:53:27 +03:00
|
|
|
import { motion } from 'framer-motion';
|
2023-12-17 20:19:28 +03:00
|
|
|
import { FaSquarePlus } from 'react-icons/fa6';
|
|
|
|
import { IoLibrary } from 'react-icons/io5';
|
2023-12-15 17:34:50 +03:00
|
|
|
|
2024-04-03 21:05:53 +03:00
|
|
|
import { IconManuals } from '@/components/Icons';
|
2024-04-07 19:45:07 +03:00
|
|
|
import { CProps } from '@/components/props';
|
2023-12-26 14:23:51 +03:00
|
|
|
import { useConceptNavigation } from '@/context/NavigationContext';
|
2024-04-01 19:07:20 +03:00
|
|
|
import { useConceptOptions } from '@/context/OptionsContext';
|
2024-01-06 03:15:02 +03:00
|
|
|
import { animateNavigation } from '@/styling/animations';
|
2023-12-13 14:32:57 +03:00
|
|
|
|
2024-04-01 21:45:10 +03:00
|
|
|
import { urls } from '../urls';
|
2023-12-13 14:32:57 +03:00
|
|
|
import Logo from './Logo';
|
2023-07-15 17:46:19 +03:00
|
|
|
import NavigationButton from './NavigationButton';
|
2023-12-05 01:22:44 +03:00
|
|
|
import ToggleNavigationButton from './ToggleNavigationButton';
|
2023-07-15 17:46:19 +03:00
|
|
|
import UserMenu from './UserMenu';
|
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
function Navigation() {
|
2023-12-13 14:32:57 +03:00
|
|
|
const router = useConceptNavigation();
|
2024-04-01 19:07:20 +03:00
|
|
|
const { noNavigationAnimation } = useConceptOptions();
|
2023-07-15 17:46:19 +03:00
|
|
|
|
2024-04-07 19:45:07 +03:00
|
|
|
const navigateHome = (event: CProps.EventMouse) => router.push(urls.home, event.ctrlKey);
|
|
|
|
const navigateLibrary = (event: CProps.EventMouse) => router.push(urls.library, event.ctrlKey);
|
|
|
|
const navigateHelp = (event: CProps.EventMouse) => router.push(urls.manuals, event.ctrlKey);
|
|
|
|
const navigateCreateNew = (event: CProps.EventMouse) => router.push(urls.create_schema, event.ctrlKey);
|
2023-12-28 14:04:44 +03:00
|
|
|
|
2023-07-15 17:46:19 +03:00
|
|
|
return (
|
2024-01-06 03:15:02 +03:00
|
|
|
<nav
|
|
|
|
className={clsx(
|
|
|
|
'z-navigation', // prettier: split lines
|
|
|
|
'sticky top-0 left-0 right-0',
|
|
|
|
'clr-app',
|
|
|
|
'select-none'
|
|
|
|
)}
|
|
|
|
>
|
2023-12-28 14:04:44 +03:00
|
|
|
<ToggleNavigationButton />
|
|
|
|
<motion.div
|
2024-02-17 12:50:25 +03:00
|
|
|
className={clsx(
|
|
|
|
'pl-2 pr-[0.9rem] h-[3rem]', // prettier: split lines
|
|
|
|
'flex justify-between',
|
|
|
|
'shadow-border'
|
|
|
|
)}
|
2023-12-28 14:04:44 +03:00
|
|
|
initial={false}
|
|
|
|
animate={!noNavigationAnimation ? 'open' : 'closed'}
|
|
|
|
variants={animateNavigation}
|
2023-12-26 14:23:51 +03:00
|
|
|
>
|
2023-12-28 14:04:44 +03:00
|
|
|
<div tabIndex={-1} className='flex items-center mr-2 cursor-pointer' onClick={navigateHome}>
|
|
|
|
<Logo />
|
|
|
|
</div>
|
|
|
|
<div className='flex'>
|
|
|
|
<NavigationButton
|
|
|
|
text='Новая схема'
|
|
|
|
title='Создать новую схему'
|
|
|
|
icon={<FaSquarePlus size='1.5rem' />}
|
|
|
|
onClick={navigateCreateNew}
|
|
|
|
/>
|
|
|
|
<NavigationButton
|
|
|
|
text='Библиотека'
|
|
|
|
title='Список схем'
|
|
|
|
icon={<IoLibrary size='1.5rem' />}
|
|
|
|
onClick={navigateLibrary}
|
|
|
|
/>
|
2024-04-03 21:05:53 +03:00
|
|
|
<NavigationButton text='Справка' title='Справочные материалы' icon={<IconManuals />} onClick={navigateHelp} />
|
2023-12-28 14:04:44 +03:00
|
|
|
<UserMenu />
|
|
|
|
</div>
|
|
|
|
</motion.div>
|
|
|
|
</nav>
|
|
|
|
);
|
2023-07-15 17:46:19 +03:00
|
|
|
}
|
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
export default Navigation;
|