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';
|
2025-03-13 01:14:47 +03:00
|
|
|
import clsx from 'clsx';
|
2024-06-07 20:17:03 +03:00
|
|
|
|
2025-03-12 12:04:23 +03:00
|
|
|
import { ModalLoader } from '@/components/modal';
|
2025-03-12 11:54:32 +03:00
|
|
|
import { useAppLayoutStore, useMainHeight, useViewportHeight } from '@/stores/app-layout';
|
2025-02-22 11:22:34 +03:00
|
|
|
import { useDialogsStore } from '@/stores/dialogs';
|
2024-06-07 20:17:03 +03:00
|
|
|
|
2025-03-12 12:04:23 +03:00
|
|
|
import { NavigationState } from './navigation/navigation-context';
|
|
|
|
import { Footer } from './footer';
|
2025-03-12 11:54:32 +03:00
|
|
|
import { GlobalDialogs } from './global-dialogs';
|
|
|
|
import { GlobalLoader } from './global-Loader';
|
|
|
|
import { ToasterThemed } from './global-toaster';
|
|
|
|
import { GlobalTooltips } from './global-tooltips';
|
|
|
|
import { MutationErrors } from './mutation-errors';
|
2025-03-12 12:04:23 +03:00
|
|
|
import { Navigation } from './navigation';
|
2025-01-29 14:51:34 +03:00
|
|
|
|
2025-02-19 23:29:45 +03:00
|
|
|
export function ApplicationLayout() {
|
2025-01-14 21:57:32 +03:00
|
|
|
const mainHeight = useMainHeight();
|
|
|
|
const viewportHeight = useViewportHeight();
|
|
|
|
const noNavigationAnimation = useAppLayoutStore(state => state.noNavigationAnimation);
|
|
|
|
const noNavigation = useAppLayoutStore(state => state.noNavigation);
|
|
|
|
const noFooter = useAppLayoutStore(state => state.noFooter);
|
2025-02-22 11:22:34 +03:00
|
|
|
const activeDialog = useDialogsStore(state => state.active);
|
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>
|
2025-03-10 16:01:40 +03:00
|
|
|
<div className='min-w-80 antialiased h-full max-w-480 mx-auto'>
|
2025-02-15 17:10:14 +03:00
|
|
|
<ToasterThemed
|
2025-03-13 14:40:56 +03:00
|
|
|
className={clsx('text-[14px]/[20px]', noNavigationAnimation ? 'mt-6' : 'mt-14')}
|
2025-01-30 12:55:51 +03:00
|
|
|
autoClose={3000}
|
|
|
|
draggable={false}
|
|
|
|
pauseOnFocusLoss={false}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Suspense fallback={<ModalLoader />}>
|
|
|
|
<GlobalDialogs />
|
|
|
|
</Suspense>
|
|
|
|
<GlobalTooltips />
|
|
|
|
|
|
|
|
<Navigation />
|
|
|
|
|
2025-02-22 11:22:34 +03:00
|
|
|
<div
|
|
|
|
className='overflow-x-auto max-w-[100vw]'
|
|
|
|
style={{ maxHeight: viewportHeight }}
|
|
|
|
inert={activeDialog !== null}
|
|
|
|
>
|
2025-03-13 01:14:47 +03:00
|
|
|
<main className='cc-scroll-y overflow-y-auto' style={{ 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
|
|
|
);
|
|
|
|
}
|