-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathApp.tsx
More file actions
153 lines (146 loc) · 4.14 KB
/
Copy pathApp.tsx
File metadata and controls
153 lines (146 loc) · 4.14 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import React from 'react';
import {
StyleSheet,
useColorScheme,
View,
Platform,
Dimensions,
} from 'react-native';
import { Colors } from 'react-native/Libraries/NewAppScreen';
import { MenuProvider } from 'react-native-popup-menu';
import { NavigationContainer } from '@react-navigation/native';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { DatabaseProvider } from './src/db/DatabaseContext';
import { RemoteConnectionProvider } from './src/connection/RemoteConnectionContext';
import ChatUI from './src/ChatUI';
import CustomDrawerContent from './src/drawer/CustomDrawerContent';
import 'react-native-gesture-handler';
import ChatScreen from './src/screens/ChatScreen';
import SettingsScreen from './src/screens/SettingsScreen';
import ContextSettings from './src/screens/ContextSettings';
import ImageGalleryScreen from './src/screens/ImageGalleryScreen';
import AdvancedSettingsScreen from './src/screens/AdvancedSettingsScreen';
export type DrawerParamList = {
Chat: { historyId?: number };
Settings: undefined;
ContextSettings: undefined;
AdvancedSettings: undefined;
ImageGallery: { images: string[]; initialIndex: number };
};
const Drawer = createDrawerNavigator<DrawerParamList>();
function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
return (
<RemoteConnectionProvider>
<DatabaseProvider>
<MenuProvider customStyles={menuProviderStyles}>
<NavigationContainer>
<Drawer.Navigator
initialRouteName="Chat"
drawerContent={(props) => <CustomDrawerContent {...props} />}
screenOptions={{
headerShown: false,
drawerStyle: {
width: Platform.OS === 'ios' && Dimensions.get('window').width > 768 ? 500 : '75%',
backgroundColor: '#000000',
},
drawerType: 'front',
overlayColor: 'rgba(0, 0, 0, 0.7)',
swipeEdgeWidth: 100, // Increases the swipe detection area (default is 32)
}}
>
<Drawer.Screen
name="Chat"
component={ChatScreen}
options={{
swipeEnabled: true,
}}
/>
<Drawer.Screen
name="Settings"
component={SettingsScreen}
options={{
swipeEnabled: false,
}}
/>
{/* Memory feature disabled temporarily
<Drawer.Screen
name="ContextSettings"
component={ContextSettings}
options={{
swipeEnabled: false,
}}
/>
*/}
<Drawer.Screen
name="AdvancedSettings"
component={AdvancedSettingsScreen}
options={{
swipeEnabled: false,
}}
/>
<Drawer.Screen
name="ImageGallery"
component={ImageGalleryScreen}
options={{
swipeEnabled: false,
}}
/>
</Drawer.Navigator>
</NavigationContainer>
</MenuProvider>
</DatabaseProvider>
</RemoteConnectionProvider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#000000',
},
chatbotContainer: {
width: '100%',
height: '100%',
padding: 5,
paddingBottom: 20,
paddingTop: 60,
backgroundColor: '#000000',
},
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
});
const menuProviderStyles = {
backdrop: {
backgroundColor: 'rgba(0, 0, 0, 0.5)',
opacity: 1,
},
menuProviderWrapper: {
flex: 1,
},
menuOptions: {
optionsContainer: {
width: 70,
position: 'relative',
}
}
};
export default App;