-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
146 lines (130 loc) · 4.61 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
import React from "react";
import { Provider } from "react-redux";
import { combineReducers, configureStore } from "@reduxjs/toolkit";
import {
configureFonts,
MD3LightTheme,
Provider as PaperProvider,
Text,
TextInput,
} from "react-native-paper";
import { useKeepAwake } from "expo-keep-awake";
import { ClientsScreen } from "./src/clients/ClientsScreen";
import { ServiceListScreen } from "./src/appointment/ServiceSelectionScreen";
import { BrandsSelectionScreen } from "./src/appointment/BrandsSelectionScreen";
import { ServiceConfigurationScreen } from "./src/appointment/ServiceConfigurationScreen";
import { ActiveAppointmentScreen } from "./src/screens/ActiveAppointmentScreen";
import { ClientNotesScreen } from "./src/clients/ClientNotesScreen";
import serviceSliceReducer from "./src/appointment/createAppointment.slice";
import catalogSliceReducer from "./src/catalog/serviceCatalog.slice";
import timerSliceReducer from "./src/timer/timer.slice";
import createSagaMiddleware from "redux-saga";
import { DefaultTheme, NavigationContainer } from "@react-navigation/native";
import { Service } from "./src/types";
import { rootSaga } from "./src/rootSaga";
import { Header } from "./src/components/Header";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { useFonts } from "expo-font";
import { colors } from "./src/styles/color";
import { useSignIn } from "./src/clients/api.clients";
import { composeWithDevTools } from "redux-devtools-extension";
const rootReducer = combineReducers({
appointment: serviceSliceReducer,
catalog: catalogSliceReducer,
timer: timerSliceReducer,
});
export type RootState = ReturnType<typeof rootReducer>;
const sagaMiddleware = createSagaMiddleware();
const isDevelopment = process.env.NODE_ENV === "development";
const storeEnhancers = isDevelopment ? composeWithDevTools({}) : undefined;
export const store = configureStore({
reducer: rootReducer,
middleware: [sagaMiddleware],
// @ts-ignore
enhancers: isDevelopment ? [storeEnhancers] : [],
});
sagaMiddleware.run(rootSaga);
type RootStackParamList = {
// AppointmentListScreen: undefined;
ClientsScreen: undefined;
ClientNotesScreen: undefined;
ServiceListScreen: undefined;
BrandSelectionScreen: undefined;
ServiceConfigurationScreen: { service: Service };
ActiveAppointmentScreen: undefined;
};
const Stack = createNativeStackNavigator<RootStackParamList>();
const fontConfig = {
fontFamily: "ChampagneLimousines",
regular: { fontSize: 20, fontFamily: "ChampagneLimousinesBold" },
medium: { fontSize: 20, fontFamily: "ChampagneLimousinesBold" },
light: { fontSize: 20, fontFamily: "ChampagneLimousinesItalic" },
thin: { fontSize: 20, fontFamily: "ChampagneLimousinesItalic" },
};
const App = () => {
const { uid, isSignedIn } = useSignIn();
useKeepAwake();
// useAppointment();
const [fontsLoaded] = useFonts({
ChampagneLimousines: require("./assets/fonts/ChampagneLimousines.ttf"),
ChampagneLimousinesBold: require("./assets/fonts/ChampagneLimousinesBold.ttf"),
ChampagneLimousinesItalic: require("./assets/fonts/ChampagneLimousinesItalic.ttf"),
});
if (!fontsLoaded) {
return <Text>Loading...</Text>;
}
return (
<PaperProvider
theme={{
...MD3LightTheme,
fonts: configureFonts({ config: fontConfig }),
}}
>
<NavigationContainer
theme={{
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: colors.pink,
},
}}
>
<Provider store={store}>
<Stack.Navigator
screenOptions={{
header: (props) => (
<>
<Header />
{/*<TextInput>{uid}</TextInput>*/}
</>
),
}}
>
<Stack.Screen name="ClientsScreen" component={ClientsScreen} />
<Stack.Screen
name="ServiceListScreen"
component={ServiceListScreen}
/>
<Stack.Screen
name="BrandSelectionScreen"
component={BrandsSelectionScreen}
/>
<Stack.Screen
name="ServiceConfigurationScreen"
component={ServiceConfigurationScreen}
/>
<Stack.Screen
name="ActiveAppointmentScreen"
component={ActiveAppointmentScreen}
/>
<Stack.Screen
name="ClientNotesScreen"
component={ClientNotesScreen}
/>
</Stack.Navigator>
</Provider>
</NavigationContainer>
</PaperProvider>
);
};
export default App;