Repository navigation
Expand file tree
/
Copy pathApp.tsx
More file actions
76 lines (68 loc) · 1.94 KB
/
Copy pathApp.tsx
File metadata and controls
76 lines (68 loc) · 1.94 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 { StatusBar } from "expo-status-bar";
import React from "react";
import { ActivityIndicator, StyleSheet, useWindowDimensions, View } from "react-native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { AppStateProvider, useAppState } from "./src/context/app-state";
import { ConnectScreen } from "./src/screens/ConnectScreen";
import { ConversationListScreen } from "./src/screens/ConversationListScreen";
import { MobileShell } from "./src/screens/mobile-shell";
import { WorkspaceScreen } from "./src/screens/workspace-screen";
import { applyWebTheme, colors, layout, TABLET_MIN_WIDTH } from "./src/theme";
function Shell() {
const { route } = useAppState();
const { width } = useWindowDimensions();
const isTablet = width >= TABLET_MIN_WIDTH;
if (route.name === "boot") {
return (
<View style={styles.boot}>
<ActivityIndicator color={colors.accent} />
</View>
);
}
if (route.name === "connect") {
return <ConnectScreen />;
}
if (isTablet) {
return (
<View style={styles.split}>
<View style={styles.paneList}>
<ConversationListScreen />
</View>
<View style={styles.paneChat}>
<WorkspaceScreen />
</View>
</View>
);
}
return <MobileShell />;
}
export default function App() {
React.useEffect(() => {
applyWebTheme();
}, []);
return (
<SafeAreaProvider>
<AppStateProvider>
<StatusBar style="light" />
<Shell />
</AppStateProvider>
</SafeAreaProvider>
);
}
const styles = StyleSheet.create({
boot: {
flex: 1,
backgroundColor: colors.bg,
alignItems: "center",
justifyContent: "center",
},
split: { flex: 1, flexDirection: "row", backgroundColor: colors.bg },
paneList: {
width: layout.sidebarWidth,
maxWidth: "42%",
borderRightColor: colors.border,
borderRightWidth: 1,
backgroundColor: colors.bg,
},
paneChat: { flex: 1 },
});