-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
76 lines (66 loc) · 2.12 KB
/
App.tsx
File metadata and controls
76 lines (66 loc) · 2.12 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { useState, useEffect } from "react";
import { Home } from "./screens/Home";
import { Chat } from "./screens/Chat";
import { Settings } from "./screens/Settings";
import { ManagePacks } from "./screens/ManagePacks";
import { AppProfileSettings } from "./screens/AppProfileSettings";
import { PackBuilder } from "./screens/PackBuilder";
import { Toaster } from "sonner@2.0.3";
import { Screen, NavigationData, setupAITesting, setupDatabaseTesting, exposeAIFunctionsGlobally } from "./utils/appUtils";
export default function App() {
const [currentScreen, setCurrentScreen] = useState<Screen>("home");
const [navigationData, setNavigationData] = useState<NavigationData>({});
const handleNavigate = (screen: string, data?: any) => {
setCurrentScreen(screen as Screen);
setNavigationData(data || {});
};
// Test AI and Database connections on app startup
useEffect(() => {
setupAITesting();
setupDatabaseTesting();
exposeAIFunctionsGlobally();
}, []);
return (
<>
<div
className="w-full mx-auto overflow-hidden bg-[#131314] relative"
style={{
maxWidth: '428px',
height: '926px',
width: '100%'
}}
>
{currentScreen === "home" && (
<Home onNavigate={handleNavigate} />
)}
{currentScreen === "chat" && (
<Chat
onNavigate={handleNavigate}
initialPack={navigationData.pack}
prefill={navigationData.prefill}
/>
)}
{currentScreen === "settings" && (
<Settings onNavigate={handleNavigate} />
)}
{currentScreen === "manage-packs" && (
<ManagePacks onNavigate={handleNavigate} />
)}
{currentScreen === "app-profile-settings" && (
<AppProfileSettings onNavigate={handleNavigate} />
)}
{currentScreen === "pack-builder" && (
<PackBuilder
onNavigate={handleNavigate}
pack={navigationData.pack}
mode={navigationData.mode}
/>
)}
</div>
<Toaster
position="top-center"
theme="dark"
/>
</>
);
}