Spaces:
Running
Running
File size: 1,147 Bytes
88a044e ad8e4fc bb1767b 88a044e bb1767b 88a044e bb1767b 88a044e ad8e4fc bb1767b ad8e4fc 88a044e ad8e4fc 88a044e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import React, { useState, Suspense } from 'react';
import { ReactFlowProvider } from 'reactflow';
import { Sparkles } from 'lucide-react';
import LandingPage from './components/LandingPage';
// Lazy load the heavy builder component to improve initial load performance
const Builder = React.lazy(() => import('./components/Builder'));
// Loading screen fallback for Suspense
const LoadingScreen = () => (
<div className="fixed inset-0 bg-slate-950 flex items-center justify-center text-white z-50">
<div className="flex flex-col items-center gap-4">
<Sparkles className="animate-spin text-blue-500" size={32} />
<p className="text-slate-400 text-sm animate-pulse font-medium">Loading Builder Environment...</p>
</div>
</div>
);
const App = () => {
const [showLanding, setShowLanding] = useState(true);
if (showLanding) {
return <LandingPage onEnterApp={() => setShowLanding(false)} />;
}
return (
<ReactFlowProvider>
<Suspense fallback={<LoadingScreen />}>
<Builder onBackToHome={() => setShowLanding(true)} />
</Suspense>
</ReactFlowProvider>
);
};
export default App;
|