ConceptPortal-public/rsconcept/frontend/src/app/ApplicationLayout.tsx

61 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-12-05 15:46:23 +03:00
import { Suspense } from 'react';
2025-02-15 17:39:09 +03:00
import { Outlet } from 'react-router';
import { ModalLoader } from '@/components/Modal';
import { useAppLayoutStore, useMainHeight, useViewportHeight } from '@/stores/appLayout';
import { globals } from '@/utils/constants';
2025-02-12 21:36:25 +03:00
import { NavigationState } from './Navigation/NavigationContext';
import { Footer } from './Footer';
import { GlobalDialogs } from './GlobalDialogs';
2025-02-15 17:11:36 +03:00
import { GlobalLoader } from './GlobalLoader';
import { ToasterThemed } from './GlobalToaster';
import { GlobalTooltips } from './GlobalTooltips';
import { Navigation } from './Navigation';
function ApplicationLayout() {
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);
return (
2025-01-30 12:56:06 +03:00
<NavigationState>
<div className='min-w-[20rem] antialiased h-full max-w-[120rem] mx-auto'>
2025-02-15 17:11:36 +03:00
<ToasterThemed
2025-01-30 12:56:06 +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:39:09 +03:00
<GlobalLoader />
<Outlet />
2025-01-30 12:56:06 +03:00
</main>
{!noNavigation && !noFooter ? <Footer /> : null}
</div>
2025-01-30 12:56:06 +03:00
</div>
</NavigationState>
);
}
export default ApplicationLayout;