Fix frontend 3

This commit is contained in:
Urtzi Alfaro
2025-08-28 23:40:44 +02:00
parent 2bbbf33d7b
commit 221781731c
11 changed files with 872 additions and 69 deletions

View File

@@ -124,7 +124,7 @@ export const AppShell = forwardRef<AppShellRef, AppShellProps>(({
isSidebarCollapsed,
}), [toggleSidebar, collapseSidebar, expandSidebar, isSidebarOpen, isSidebarCollapsed]);
// Handle responsive sidebar state
// Handle responsive sidebar state and prevent body scroll on mobile
React.useEffect(() => {
const handleResize = () => {
if (window.innerWidth >= 1024) {
@@ -133,9 +133,26 @@ export const AppShell = forwardRef<AppShellRef, AppShellProps>(({
}
};
// Prevent body scroll when mobile sidebar is open
if (isSidebarOpen && window.innerWidth < 1024) {
document.body.style.overflow = 'hidden';
document.body.style.position = 'fixed';
document.body.style.width = '100%';
} else {
document.body.style.overflow = '';
document.body.style.position = '';
document.body.style.width = '';
}
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);
return () => {
window.removeEventListener('resize', handleResize);
// Cleanup on unmount
document.body.style.overflow = '';
document.body.style.position = '';
document.body.style.width = '';
};
}, [isSidebarOpen]);
// Error boundary handling
React.useEffect(() => {
@@ -212,8 +229,9 @@ export const AppShell = forwardRef<AppShellRef, AppShellProps>(({
{/* Mobile overlay */}
{isSidebarOpen && (
<div
className="fixed inset-0 bg-black/50 z-[var(--z-modal-backdrop)] lg:hidden"
className="fixed inset-0 bg-black/50 z-[var(--z-modal-backdrop)] lg:hidden backdrop-blur-sm"
onClick={handleOverlayClick}
onTouchStart={handleOverlayClick}
aria-hidden="true"
/>
)}