fix: Preserve state when resizing window to mobile size

Change mobile warning from unmounting components to showing an overlay.
This prevents losing diagram and chat state when window is resized.
This commit is contained in:
dayuan.jiang
2025-11-17 15:18:29 +09:00
parent 7518285e98
commit aa330f74b3

View File

@@ -40,20 +40,19 @@ export default function Home() {
}; };
}, []); }, []);
if (isMobile) {
return ( return (
<div className="flex items-center justify-center h-screen bg-gray-100"> <div className="flex h-screen bg-gray-100 relative">
{/* Mobile warning overlay - keeps components mounted */}
{isMobile && (
<div className="absolute inset-0 z-50 flex items-center justify-center bg-gray-100">
<div className="text-center p-8"> <div className="text-center p-8">
<h1 className="text-2xl font-semibold text-gray-800"> <h1 className="text-2xl font-semibold text-gray-800">
Please open this application on a desktop or laptop Please open this application on a desktop or laptop
</h1> </h1>
</div> </div>
</div> </div>
); )}
}
return (
<div className="flex h-screen bg-gray-100">
<div className={`${isChatVisible ? 'w-2/3' : 'w-full'} p-1 h-full relative transition-all duration-300 ease-in-out`}> <div className={`${isChatVisible ? 'w-2/3' : 'w-full'} p-1 h-full relative transition-all duration-300 ease-in-out`}>
<DrawIoEmbed <DrawIoEmbed
ref={drawioRef} ref={drawioRef}