2024-12-05 15:45:53 +03:00
|
|
|
import { Suspense } from 'react';
|
2025-02-15 17:38:32 +03:00
|
|
|
import { Outlet } from 'react-router';
|
2024-06-07 20:17:03 +03:00
|
|
|
|
2025-02-10 01:32:16 +03:00
|
|
|
import { ModalLoader } from '@/components/Modal';
|
2025-01-14 21:57:32 +03:00
|
|
|
import { useAppLayoutStore, useMainHeight, useViewportHeight } from '@/stores/appLayout';
|
2024-06-07 20:17:03 +03:00
|
|
|
import { globals } from '@/utils/constants';
|
|
|
|
|
2025-02-12 21:36:03 +03:00
|
|
|
import { NavigationState } from './Navigation/NavigationContext';
|
2025-02-10 01:32:16 +03:00
|
|
|
import { Footer } from './Footer';
|
2025-01-16 16:31:03 +03:00
|
|
|
import { GlobalDialogs } from './GlobalDialogs';
|
2025-02-15 17:10:14 +03:00
|
|
|
import { GlobalLoader } from './GlobalLoader';
|
|
|
|
import { ToasterThemed } from './GlobalToaster';
|
2025-01-15 22:16:06 +03:00
|
|
|
import { GlobalTooltips } from './GlobalTooltips';
|
2025-02-19 19:15:57 +03:00
|
|
|
import { MutationErrors } from './MutationErrors';
|
2025-02-10 01:32:16 +03:00
|
|
|
import { Navigation } from './Navigation';
|
2025-01-29 14:51:34 +03:00
|
|
|
|
2024-06-07 20:17:03 +03:00
|
|
|
function ApplicationLayout() {
|
2025-01-14 21:57:32 +03:00
|
|
|
const mainHeight = useMainHeight();
|
|
|
|
const viewportHeight = useViewportHeight();
|
|
|
|
const showScroll = useAppLayoutStore(state => !state.noScroll);
|
|
|
|
const noNavigationAnimation = useAppLayoutStore(state => state.noNavigationAnimation);
|
|
|
|
const noNavigation = useAppLayoutStore(state => state.noNavigation);
|
|
|
|
const noFooter = useAppLayoutStore(state => state.noFooter);
|
2025-01-21 12:00:09 +03:00
|
|
|
|
2024-06-07 20:17:03 +03:00
|
|
|
return (
|
2025-01-30 12:55:51 +03:00
|
|
|
<NavigationState>
|
|
|
|
<div className='min-w-[20rem] antialiased h-full max-w-[120rem] mx-auto'>
|
2025-02-15 17:10:14 +03:00
|
|
|
<ToasterThemed
|
2025-01-30 12:55:51 +03:00
|
|
|
className='text-[14px] cc-animate-position'
|
|
|
|
style={{ marginTop: noNavigationAnimation ? '1.5rem' : '3.5rem' }}
|
|
|
|
autoClose={3000}
|
|
|
|
draggable={false}
|
|
|
|
pauseOnFocusLoss={false}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Suspense fallback={<ModalLoader />}>
|
|
|
|
<GlobalDialogs />
|
|
|
|
</Suspense>
|
|
|
|
<GlobalTooltips />
|
|
|
|
|
|
|
|
<Navigation />
|
|
|
|
|
|
|
|
<div
|
|
|
|
id={globals.main_scroll}
|
|
|
|
className='overflow-x-auto max-w-[100vw]'
|
|
|
|
style={{
|
|
|
|
maxHeight: viewportHeight
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<main className='cc-scroll-y' style={{ overflowY: showScroll ? 'scroll' : 'auto', minHeight: mainHeight }}>
|
2025-02-15 17:38:32 +03:00
|
|
|
<GlobalLoader />
|
2025-02-19 19:15:57 +03:00
|
|
|
<MutationErrors />
|
2025-02-15 17:38:32 +03:00
|
|
|
<Outlet />
|
2025-01-30 12:55:51 +03:00
|
|
|
</main>
|
|
|
|
{!noNavigation && !noFooter ? <Footer /> : null}
|
2024-06-07 20:17:03 +03:00
|
|
|
</div>
|
2025-01-30 12:55:51 +03:00
|
|
|
</div>
|
|
|
|
</NavigationState>
|
2024-06-07 20:17:03 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ApplicationLayout;
|