-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.tsx
154 lines (146 loc) · 4.89 KB
/
App.tsx
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
154
import {
adaptNavigationTheme,
MD3DarkTheme,
MD3LightTheme,
PaperProvider,
} from "react-native-paper";
import { AuthProvider } from "./src/auth";
import { decode, encode } from "base-64";
import {
DarkTheme as NavigationDarkTheme,
DefaultTheme as NavigationDefaultTheme,
NavigationContainer,
} from "@react-navigation/native";
import HomeScreen from "./src/screens/home";
import CustomNavigationBar from "./src/components/navbar";
import SlotScreen from "./src/screens/feed/slot";
import { createStackNavigator } from "@react-navigation/stack";
import AlbumScreen from "./src/screens/media/album";
import SmoelScreen from "./src/screens/media/smoel";
import { Item } from "./src/__generated__/media";
import SlidesScreen from "./src/screens/media/slides";
import { useColorScheme } from "react-native";
import merge from "deepmerge";
import WebScreen from "./src/screens/web";
import * as Notifications from "expo-notifications";
import SearchScreen, { Item as InventoryItem } from "./src/screens/feed/search";
import ItemScreen from "./src/screens/feed/item";
import { SerializedComponent } from "unfucked-ical";
import EventScreen from "./src/screens/calendar/event";
import "./src/logging";
import ReloadProvider from "./src/components/register/reloadProvider";
import { Provider } from "jotai";
import { store } from "./src/stores/store";
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: false,
shouldSetBadge: true,
}),
});
if (!global.btoa) global.btoa = encode;
if (!global.atob) global.atob = decode;
export type StackParamList = {
Home: undefined;
Slot: { slot: number; title: string };
Album: { album: string; title: string };
Smoel: { smoel: string; title: string };
Slides: { items: Item[]; item: number };
Web: { source: string; title: string };
Search: undefined;
Item: { item: InventoryItem; title: string };
Event: { event: SerializedComponent; title: string };
};
const Stack = createStackNavigator<StackParamList>();
const { LightTheme, DarkTheme } = adaptNavigationTheme({
reactNavigationLight: NavigationDefaultTheme,
reactNavigationDark: NavigationDarkTheme,
});
const CombinedDefaultTheme = merge(MD3LightTheme, LightTheme);
const CombinedDarkTheme = merge(MD3DarkTheme, DarkTheme);
export default function App() {
const colorScheme = useColorScheme();
return (
<Provider store={store}>
<NavigationContainer
theme={
colorScheme === "dark" ? CombinedDarkTheme : CombinedDefaultTheme
}
>
<PaperProvider
theme={
colorScheme === "dark" ? CombinedDarkTheme : CombinedDefaultTheme
}
>
<AuthProvider>
<ReloadProvider>
<Stack.Navigator
screenOptions={{
header: CustomNavigationBar,
}}
>
<Stack.Screen
name={"Home"}
component={HomeScreen}
options={{
headerShown: false,
}}
/>
<Stack.Screen
name={"Slot"}
component={SlotScreen}
options={({ route }) => ({
title: route.params.title,
})}
/>
<Stack.Screen
name={"Album"}
component={AlbumScreen}
options={({ route }) => ({
title: route.params.title,
})}
/>
<Stack.Screen
name={"Smoel"}
component={SmoelScreen}
options={({ route }) => ({
title: route.params.title,
})}
/>
<Stack.Screen name={"Slides"} component={SlidesScreen} />
<Stack.Screen
name={"Web"}
component={WebScreen}
options={({ route }) => ({
title: route.params.title,
})}
/>
<Stack.Screen
name={"Search"}
component={SearchScreen}
options={{
headerShown: false,
}}
/>
<Stack.Screen
name={"Item"}
component={ItemScreen}
options={({ route }) => ({
title: route.params.title,
})}
/>
<Stack.Screen
name={"Event"}
component={EventScreen}
options={({ route }) => ({
title: route.params.title,
})}
/>
</Stack.Navigator>
</ReloadProvider>
</AuthProvider>
</PaperProvider>
</NavigationContainer>
</Provider>
);
}