veza/apps/web/src/components/layout/DashboardLayout.tsx

61 lines
1.9 KiB
TypeScript
Raw Normal View History

import type { ReactNode } from 'react';
import { Header } from './Header';
import { Sidebar } from './Sidebar';
import { GlobalPlayer } from '@/features/player/components/GlobalPlayer';
import { useUIStore } from '@/stores/ui';
import { cn } from '@/lib/utils';
import { AstralBackground } from '../ui/AstralBackground';
interface DashboardLayoutProps {
children: ReactNode;
}
/**
2026-01-22 16:23:11 +00:00
* Layout principal "App Shell" - Veza Professional V2
*
2026-01-22 16:23:11 +00:00
* Architecture:
* - Body: Fixed viewport (overflow-hidden)
* - Sidebar: Fixed left, z-index high
* - Main: Scrollable container independent of window
* - Header: Sticky top within Main
*/
export function DashboardLayout({ children }: DashboardLayoutProps) {
const { sidebarOpen } = useUIStore();
return (
<div className="flex h-screen w-full overflow-hidden relative bg-background">
2026-01-22 16:23:11 +00:00
{/* 1. Global Background (Fixed z-0) */}
<AstralBackground />
2026-01-22 16:23:11 +00:00
{/* 2. Fixed Sidebar (z-90) */}
<Sidebar />
2026-01-22 16:23:11 +00:00
{/* 3. Main Content Area (The only thing that scrolls) */}
<div
className={cn(
'flex-1 flex flex-col h-full relative z-10 transition-all duration-[var(--duration-slow)] ease-[var(--ease-in-out)]',
sidebarOpen ? 'lg:ml-main-expanded' : 'lg:ml-main-collapsed',
2026-01-22 16:23:11 +00:00
'ml-0'
)}
>
2026-01-22 16:23:11 +00:00
{/* Header is part of the flow but stays at top */}
<Header />
2026-01-22 16:23:11 +00:00
{/* Scrollable Content Container */}
<main
className="flex-1 overflow-y-auto overflow-x-hidden pt-main pb-main px-4 md:px-8 custom-scrollbar"
2026-01-22 16:23:11 +00:00
id="main-scroll-container"
>
<div className="max-w-layout-content mx-auto w-full">
2026-01-22 16:23:11 +00:00
{children}
</div>
</main>
{/* Floating Player (Fixed at bottom of screen, not scroll container) */}
<div className="absolute bottom-0 left-0 right-0 z-50">
<GlobalPlayer />
</div>
</div>
</div>
);
2026-01-22 16:23:11 +00:00
}