ConceptPortal-public/rsconcept/frontend/src/app/application-layout.tsx

59 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 clsx from 'clsx';
2025-03-12 12:04:50 +03:00
import { ModalLoader } from '@/components/modal';
2025-03-12 11:55:43 +03:00
import { useAppLayoutStore, useMainHeight, useViewportHeight } from '@/stores/app-layout';
2025-02-22 11:23:11 +03:00
import { useDialogsStore } from '@/stores/dialogs';
2025-03-12 12:04:50 +03:00
import { NavigationState } from './navigation/navigation-context';
import { Footer } from './footer';
2025-03-12 11:55:43 +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:50 +03:00
import { Navigation } from './navigation';
2025-02-19 23:30:35 +03:00
export function ApplicationLayout() {
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:23:11 +03:00
const activeDialog = useDialogsStore(state => state.active);
return (
2025-01-30 12:56:06 +03:00
<NavigationState>
2025-03-10 16:02:53 +03:00
<div className='min-w-80 antialiased h-full max-w-480 mx-auto'>
2025-02-15 17:11:36 +03:00
<ToasterThemed
className={clsx('sm:text-[14px]/[20px] text-[12px]/[16px]', noNavigationAnimation ? 'mt-6' : 'mt-14')}
2025-01-30 12:56:06 +03:00
autoClose={3000}
draggable={false}
pauseOnFocusLoss={false}
/>
<Suspense fallback={<ModalLoader />}>
<GlobalDialogs />
</Suspense>
<GlobalTooltips />
<Navigation />
2025-02-22 11:23:11 +03:00
<div
className='overflow-x-auto max-w-[100vw]'
style={{ maxHeight: viewportHeight }}
inert={activeDialog !== null}
>
<main className='cc-scroll-y overflow-y-auto' style={{ minHeight: mainHeight }}>
2025-02-15 17:39:09 +03:00
<GlobalLoader />
2025-02-19 19:26:29 +03:00
<MutationErrors />
2025-02-15 17:39:09 +03:00
<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>
);
}