'use client'; import React, { useState, useEffect } from 'react'; import { usePathname } from 'next/navigation'; import Header from './nav/Header'; import Footer from './Footer'; import PageTransitionEffect from './animation/pageTransitionEffect'; import { useTranslation } from '../i18n/useTranslation'; // Utility to detect mobile devices function isMobileDevice() { if (typeof navigator === 'undefined') return false; return /Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); } interface PageLayoutProps { children: React.ReactNode; showHeader?: boolean; showFooter?: boolean; className?: string; contentClassName?: string; } export default function PageLayout({ children, showHeader = true, showFooter = true, className = 'bg-white text-gray-900', contentClassName = 'flex-1 relative z-10 w-full', }: PageLayoutProps) { const { t } = useTranslation(); const isMobile = isMobileDevice(); const [isLoggingOut, setIsLoggingOut] = useState(false); // NEW const pathname = usePathname(); // Global scrollbar restore / leak cleanup (runs on navigation) useEffect(() => { const html = document.documentElement; const body = document.body; // ensure a visible/stable vertical scrollbar on desktop html.style.overflowY = 'scroll'; body.style.overflowY = 'auto'; // clear common scroll-lock leftovers (gap where scrollbar should be) if (html.style.overflow === 'hidden') html.style.overflow = ''; if (body.style.overflow === 'hidden') body.style.overflow = ''; html.style.paddingRight = ''; body.style.paddingRight = ''; }, [pathname]); return (
{t('autofix.kb1c1c0e5')}