2024-12-05 15:46:23 +03:00
|
|
|
import { Suspense } from 'react';
|
2024-11-25 19:53:20 +03:00
|
|
|
import { Outlet } from 'react-router';
|
2024-01-04 19:30:10 +03:00
|
|
|
|
|
|
|
import ConceptToaster from '@/app/ConceptToaster';
|
|
|
|
import Footer from '@/app/Footer';
|
|
|
|
import Navigation from '@/app/Navigation';
|
2024-12-05 15:46:23 +03:00
|
|
|
import Loader from '@/components/ui/Loader';
|
2025-01-27 15:03:48 +03:00
|
|
|
import { NavigationState } from '@/app/Navigation/NavigationContext';
|
2025-01-14 21:58:16 +03:00
|
|
|
import { useAppLayoutStore, useMainHeight, useViewportHeight } from '@/stores/appLayout';
|
2024-03-27 15:32:59 +03:00
|
|
|
import { globals } from '@/utils/constants';
|
2024-01-04 19:30:10 +03:00
|
|
|
|
2025-01-16 16:31:32 +03:00
|
|
|
import { GlobalDialogs } from './GlobalDialogs';
|
2025-01-15 22:16:27 +03:00
|
|
|
import { GlobalTooltips } from './GlobalTooltips';
|
|
|
|
|
2024-01-04 19:30:10 +03:00
|
|
|
function ApplicationLayout() {
|
2025-01-14 21:58:16 +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-27 15:03:48 +03:00
|
|
|
|
|
|
|
// TODO: prefetch data
|
|
|
|
|
2024-01-04 19:30:10 +03:00
|
|
|
return (
|
|
|
|
<NavigationState>
|
2024-12-16 23:52:11 +03:00
|
|
|
<div className='min-w-[20rem] antialiased h-full max-w-[120rem] mx-auto'>
|
2024-01-04 19:30:10 +03:00
|
|
|
<ConceptToaster
|
2024-12-18 15:33:37 +03:00
|
|
|
className='text-[14px] cc-animate-position'
|
|
|
|
style={{ marginTop: noNavigationAnimation ? '1.5rem' : '3.5rem' }}
|
2024-01-04 19:30:10 +03:00
|
|
|
autoClose={3000}
|
|
|
|
draggable={false}
|
|
|
|
pauseOnFocusLoss={false}
|
|
|
|
/>
|
|
|
|
|
2025-01-16 16:31:32 +03:00
|
|
|
<GlobalDialogs />
|
2025-01-15 22:16:27 +03:00
|
|
|
<GlobalTooltips />
|
|
|
|
|
2024-01-04 19:30:10 +03:00
|
|
|
<Navigation />
|
|
|
|
|
|
|
|
<div
|
2024-03-27 15:32:59 +03:00
|
|
|
id={globals.main_scroll}
|
2024-08-24 11:21:02 +03:00
|
|
|
className='overflow-x-auto max-w-[100vw]'
|
2024-01-04 19:30:10 +03:00
|
|
|
style={{
|
2024-06-05 13:00:28 +03:00
|
|
|
maxHeight: viewportHeight
|
2024-01-04 19:30:10 +03:00
|
|
|
}}
|
|
|
|
>
|
2024-09-21 20:04:07 +03:00
|
|
|
<main className='cc-scroll-y' style={{ overflowY: showScroll ? 'scroll' : 'auto', minHeight: mainHeight }}>
|
2024-12-05 15:46:23 +03:00
|
|
|
<Suspense fallback={<Loader />}>
|
|
|
|
<Outlet />
|
|
|
|
</Suspense>
|
2024-01-04 19:30:10 +03:00
|
|
|
</main>
|
2025-01-14 21:58:16 +03:00
|
|
|
{!noNavigation && !noFooter ? <Footer /> : null}
|
2024-01-04 19:30:10 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</NavigationState>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ApplicationLayout;
|