-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
173 lines (148 loc) · 9.6 KB
/
App.js
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
//import * as React from 'react';
import React, { useEffect, useState } from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import EmpDashboard from './screens/employee/EmpDashboard';
import Home from './screens/start/Home';
import EmpLogin from './screens/employee/EmpLogin';
import EmpSignup from './screens/employee/EmpSignup';
import AdminLogin from './screens/admin/AdminLogin';
import AdminDashboard from './screens/admin/AdminDashboard';
import EmpDetails from './screens/employee/EmpDetails';
import AdminLeave from './screens/admin/AdminLeave';
import EmpApply from './screens/employee/EmpApply';
import EmpLeave from './screens/employee/EmpLeave';
import Loading from './screens/start/Loading';
import AdminPastLeave from './screens/admin/AdminPastLeave';
import EmpProfile from './screens/employee/EmpProfile';
import EmpDrawerContent from './screens/employee/EmpDrawerContent';
import EmpPersonalInfo from './screens/employee/EmpPersonalInfo';
import EmpPastLeave from './screens/employee/EmpPastLeave';
import AdminDrawer from './screens/admin/AdminDrawer';
import AdminEmpSearch from './screens/admin/AdminEmpSearch';
import AdminMeeting from './screens/admin/AdminMeeting';
import AdminEmpProfiles from './screens/admin/AdminEmpProfiles';
import AdminMessageSearch from './screens/admin/AdminMessageSearch';
import AdminSendMessage from './screens/admin/AdminSendMessage';
import AdminSendNotice from './screens/admin/AdminSendNotice';
import EmpAnnouncement from './screens/employee/EmpAnnouncement';
import EmpWfh from './screens/employee/EmpWfh';
import AdminWfh from './screens/admin/AdminWfh';
import AdminPastLeave2 from './screens/admin/AdminPastLeave2';
import StartScreen from './screens/start/StartScreen';
import EmpUploadDoc from './screens/employee/EmpUploadDoc';
import AdminViewDoc from './screens/admin/AdminViewDoc';
import { Text, View, StyleSheet, Screen } from 'react-native';
import Constants from 'expo-constants';
const Stack = createNativeStackNavigator();
const App = () => {
const [isLoggedin, setLogged] = useState(null)
const detectLogin = async () => {
const token = await AsyncStorage.getItem('token')
if (token) {
setLogged(true)
} else {
setLogged(false)
}
}
useEffect(() => {
detectLogin()
}, [])
return (
<NavigationContainer>
<Stack.Navigator>
{
isLoggedin == null ?
(
<Stack.Screen options={{ headerShown: false }} name="Loading" component={Loading} />
)
:
isLoggedin == true ?
(
<>
<Stack.Screen options={{ headerShown: false }} name="EmpDashboard" component={EmpDashboard} />
<Stack.Screen options={{ headerShown: false }} name="EmpApply" component={EmpApply} />
<Stack.Screen name="EmpLeave" component={EmpLeave} options={{ title: 'Leave' }} />
<Stack.Screen options={{ headerShown: false }} name="EmpDetails" component={EmpDetails} />
{/* <Stack.Screen options={{ headerShown: false }} name="AdminDashboard" component={AdminDashboard} /> */}
<Stack.Screen options={{ headerShown: false }} name="AdminDrawer" component={AdminDrawer} />
<Stack.Screen options={{ headerShown: false }} name="AdminLeave" component={AdminLeave} />
<Stack.Screen options={{ headerShown: false }} name="AdminEmpSearch" component={AdminEmpSearch} />
<Stack.Screen options={{ headerShown: false }} name="Home" component={Home} />
<Stack.Screen options={{ headerShown: false }} name="EmpLogin" component={EmpLogin} />
<Stack.Screen options={{ headerShown: false }} name="EmpSignup" component={EmpSignup} />
<Stack.Screen options={{ headerShown: false }} name="AdminPastLeave" component={AdminPastLeave} />
<Stack.Screen options={{ headerShown: false }} name="AdminPastLeave2" component={AdminPastLeave2} />
<Stack.Screen options={{ headerShown: false }} name="EmpPersonalInfo" component={EmpPersonalInfo} />
<Stack.Screen options={{ headerShown: false }} name="EmpPastLeave" component={EmpPastLeave} />
<Stack.Screen options={{ headerShown: false }} name="AdminViewDoc" component={AdminViewDoc} />
<Stack.Screen name="AdminMeeting" component={AdminMeeting} options={{ title: 'Set Meeting and Holiday' }} />
<Stack.Screen name="AdminEmpProfiles" component={AdminEmpProfiles} options={{ title: 'Employee Profile' }} />
<Stack.Screen options={{ headerShown: false }} name="AdminMessageSearch" component={AdminMessageSearch} />
<Stack.Screen name="AdminSendMessage" component={AdminSendMessage} options={{ title: 'Push Notification' }} />
<Stack.Screen name="AdminSendNotice" component={AdminSendNotice} options={{ title: 'Send Announcement' }} />
<Stack.Screen name="EmpUploadDoc" component={EmpUploadDoc} options={{ title: 'Send Documents' }} />
<Stack.Screen name="EmpWfh" component={EmpWfh} options={{ title: 'Work From Home' }} />
<Stack.Screen options={{ headerShown: false }} name="AdminWfh" component={AdminWfh} />
<Stack.Screen options={{ headerShown: false }} name="EmpAnnouncement" component={EmpAnnouncement} />
{/* <Stack.Screen options={{ headerShown: false }} name="EmpDrawerContent" component={EmpDrawerContent} /> */}
<Stack.Screen name="EmpProfile" component={EmpProfile} options={{ title: 'Profile' }} />
<Stack.Screen options={{ headerShown: false }} name="AdminLogin" component={AdminLogin} />
</>
)
:
(
<>
<Stack.Screen options={{ headerShown: false }} name="StartScreen" component={StartScreen} />
<Stack.Screen options={{ headerShown: false }} name="Home" component={Home} />
<Stack.Screen options={{ headerShown: false }} name="EmpLogin" component={EmpLogin} />
<Stack.Screen options={{ headerShown: false }} name="EmpSignup" component={EmpSignup} />
<Stack.Screen options={{ headerShown: false }} name="AdminLogin" component={AdminLogin} />
<Stack.Screen options={{ headerShown: false }} name="EmpDashboard" component={EmpDashboard} />
<Stack.Screen options={{ headerShown: false }} name="EmpApply" component={EmpApply} />
<Stack.Screen name="EmpLeave" component={EmpLeave} options={{ title: 'Leave' }} />
<Stack.Screen options={{ headerShown: false }} name="EmpDetails" component={EmpDetails} />
{/* <Stack.Screen options={{ headerShown: false }} name="AdminDashboard" component={AdminDashboard} /> */}
<Stack.Screen options={{ headerShown: false }} name="AdminDrawer" component={AdminDrawer} />
<Stack.Screen options={{ headerShown: false }} name="AdminEmpSearch" component={AdminEmpSearch} />
<Stack.Screen options={{ headerShown: false }} name="AdminPastLeave" component={AdminPastLeave} />
<Stack.Screen options={{ headerShown: false }} name="EmpPersonalInfo" component={EmpPersonalInfo} />
<Stack.Screen options={{ headerShown: false }} name="AdminPastLeave2" component={AdminPastLeave2} />
<Stack.Screen options={{ headerShown: false }} name="AdminViewDoc" component={AdminViewDoc} />
<Stack.Screen name="EmpProfile" component={EmpProfile} options={{ title: 'Profile' }} />
<Stack.Screen options={{ headerShown: false }} name="EmpPastLeave" component={EmpPastLeave} />
<Stack.Screen name="AdminMeeting" component={AdminMeeting} options={{ title: 'Set Meeting and Holiday' }} />
<Stack.Screen name="AdminEmpProfiles" component={AdminEmpProfiles} options={{ title: 'Employee Profile' }} />
<Stack.Screen name="AdminSendMessage" component={AdminSendMessage} options={{ title: 'Push Notification' }} />
<Stack.Screen name="AdminSendNotice" component={AdminSendNotice} options={{ title: 'Send Announcement' }} />
<Stack.Screen name="EmpUploadDoc" component={EmpUploadDoc} options={{ title: 'Send Documents' }} />
<Stack.Screen name="EmpWfh" component={EmpWfh} options={{ title: 'Work From Home' }} />
<Stack.Screen options={{ headerShown: false }} name="AdminWfh" component={AdminWfh} />
<Stack.Screen options={{ headerShown: false }} name="EmpAnnouncement" component={EmpAnnouncement} />
<Stack.Screen options={{ headerShown: false }} name="AdminMessageSearch" component={AdminMessageSearch} />
{/* <Stack.Screen options={{ headerShown: false }} name="EmpDrawerContent" component={EmpDrawerContent} /> */}
<Stack.Screen options={{ headerShown: false }} name="AdminLeave" component={AdminLeave} />
</>
)
}
</Stack.Navigator>
</NavigationContainer>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
padding: 8,
},
paragraph: {
margin: 24,
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
},
});
export default App;