wuhp commited on
Commit
441bf3d
·
verified ·
1 Parent(s): 8a571fd

Update App.tsx

Browse files
Files changed (1) hide show
  1. App.tsx +19 -5
App.tsx CHANGED
@@ -5,28 +5,42 @@ import LandingPage from './components/LandingPage';
5
 
6
  // Lazy load the heavy builder component to improve initial load performance
7
  const Builder = React.lazy(() => import('./components/Builder'));
 
8
 
9
  // Loading screen fallback for Suspense
10
  const LoadingScreen = () => (
11
  <div className="fixed inset-0 bg-slate-950 flex items-center justify-center text-white z-50">
12
  <div className="flex flex-col items-center gap-4">
13
  <Sparkles className="animate-spin text-blue-500" size={32} />
14
- <p className="text-slate-400 text-sm animate-pulse font-medium">Loading Builder Environment...</p>
15
  </div>
16
  </div>
17
  );
18
 
19
  const App = () => {
20
- const [showLanding, setShowLanding] = useState(true);
21
 
22
- if (showLanding) {
23
- return <LandingPage onEnterApp={() => setShowLanding(false)} />;
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
 
26
  return (
27
  <ReactFlowProvider>
28
  <Suspense fallback={<LoadingScreen />}>
29
- <Builder onBackToHome={() => setShowLanding(true)} />
30
  </Suspense>
31
  </ReactFlowProvider>
32
  );
 
5
 
6
  // Lazy load the heavy builder component to improve initial load performance
7
  const Builder = React.lazy(() => import('./components/Builder'));
8
+ const HelpPage = React.lazy(() => import('./components/HelpPage'));
9
 
10
  // Loading screen fallback for Suspense
11
  const LoadingScreen = () => (
12
  <div className="fixed inset-0 bg-slate-950 flex items-center justify-center text-white z-50">
13
  <div className="flex flex-col items-center gap-4">
14
  <Sparkles className="animate-spin text-blue-500" size={32} />
15
+ <p className="text-slate-400 text-sm animate-pulse font-medium">Loading...</p>
16
  </div>
17
  </div>
18
  );
19
 
20
  const App = () => {
21
+ const [view, setView] = useState<'landing' | 'builder' | 'help'>('landing');
22
 
23
+ if (view === 'landing') {
24
+ return (
25
+ <LandingPage
26
+ onEnterApp={() => setView('builder')}
27
+ onShowHelp={() => setView('help')}
28
+ />
29
+ );
30
+ }
31
+
32
+ if (view === 'help') {
33
+ return (
34
+ <Suspense fallback={<LoadingScreen />}>
35
+ <HelpPage onBack={() => setView('landing')} />
36
+ </Suspense>
37
+ );
38
  }
39
 
40
  return (
41
  <ReactFlowProvider>
42
  <Suspense fallback={<LoadingScreen />}>
43
+ <Builder onBackToHome={() => setView('landing')} />
44
  </Suspense>
45
  </ReactFlowProvider>
46
  );