import { lazy, Suspense, useState } from 'react'; import { Sidebar } from '../components/Sidebar'; import { MobileTopBar } from '../components/MobileTopBar'; import { DashboardPage } from '../pages/DashboardPage'; import { useWebsocket } from '../hooks/useWebsocket'; // Focus mode carries the gesture/animation code: load it only when used. const FocusPage = lazy(() => import('../pages/FocusPage').then((m) => ({ default: m.FocusPage }))); export function RootLayout() { const [selectedFeedId, setSelectedFeedId] = useState(null); const [isFocusMode, setIsFocusMode] = useState(false); // One socket for the whole session (not per page mount). useWebsocket(); return (
Aller au contenu setIsFocusMode(true)} isFocusMode={isFocusMode} />
{!isFocusMode && ( setIsFocusMode(true)} /> )} {/* Kept mounted in focus mode so the list keeps its scroll position. */} setIsFocusMode(true)} hidden={isFocusMode} />
{isFocusMode && (
} > setIsFocusMode(false)} />
)}
); }