Procházet zdrojové kódy

new pages and new notification logic

master
azri před 5 dny
rodič
revize
8a3933356e

+ 6
- 3
app/(tabs)/index.jsx Zobrazit soubor

@@ -2,8 +2,11 @@
2 2
 import React, { useState } from 'react';
3 3
 import { PaperProvider } from 'react-native-paper';
4 4
 import { lightTheme, darkTheme } from '../../theme';
5
-import WelcomeScreen from '../screens/WelcomeScreen';
6
-import HomeScreen from '../screens/HomeScreen';
5
+import Welcome from '../screens/Welcome';
6
+import Home from '../screens/Home';
7
+import Request from '../screens/Request';
8
+import Status from '../screens/Status';
9
+import Notification from '../screens/Notification';
7 10
 import { Button, Switch } from 'react-native-paper';
8 11
 import { View } from 'react-native';
9 12
 
@@ -13,7 +16,7 @@ const App = () => {
13 16
   return (
14 17
     <PaperProvider theme={lightTheme}>
15 18
       <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
16
-        <HomeScreen />
19
+        <Notification />
17 20
       </View>
18 21
     </PaperProvider>
19 22
   );

app/screens/HomeScreen.jsx → app/screens/Home.jsx Zobrazit soubor

@@ -1,14 +1,30 @@
1 1
 import React, { useState } from 'react';
2
-import { View, StyleSheet, TextInput, Text } from 'react-native';
2
+import { View, StyleSheet, TextInput, Text, ScrollView } from 'react-native';
3 3
 import { Appbar, Menu, Avatar, useTheme } from 'react-native-paper';
4 4
 import Icon from 'react-native-vector-icons/MaterialIcons';
5 5
 import dpuser from "@/assets/images/userdp.png";
6 6
 
7
-const HomeScreen = () => {
7
+const Home = () => {
8 8
   const { colors, fonts } = useTheme();
9 9
   const [menuVisible, setMenuVisible] = useState(false);
10 10
   const [searchInput, setSearchInput] = useState("")
11 11
 
12
+  const renderNotification = () => {
13
+    return (
14
+      <View style={{marginBottom:30, borderBottomWidth:1, borderBottomColor:"rgba(57, 104, 104, 0.3)"}}>
15
+        <View style={{ flexDirection: "row", marginBottom: 10 }}>
16
+          <Avatar.Image size={60} source={dpuser}></Avatar.Image>
17
+          <View style={{ flex: 1, justifyContent: "center", paddingStart: 15, position:"relative", justifyContent:"space-evenly" }}>
18
+            <Text style={{ fontWeight: "700", position:"absolute", top:5, right:0, color:"rgba(0,0,0,0.3)" }}>7:55AM</Text>
19
+            <Text style={{ fontWeight: "700" }}>Invest Pahang</Text>
20
+            <Text style={{ fontWeight: "700" }}>ID No : Ariffudin@PSK</Text>
21
+          </View>
22
+        </View>
23
+        <Text style={{ fontWeight: "700", marginBottom:10 }}>Muhammad Ariffudin is working from home today</Text>
24
+      </View>
25
+    )
26
+  }
27
+
12 28
   return (
13 29
     <View style={[styles.container, { backgroundColor: colors.background }]}>
14 30
       <Appbar.Header>
@@ -51,6 +67,20 @@ const HomeScreen = () => {
51 67
         <Icon name="search" size={20} color="#888" style={styles.icon} />
52 68
       </View>
53 69
 
70
+      <View style={{flex:1}}>
71
+        <ScrollView>
72
+          <Text style={[fonts.titleMedium, { fontWeight: "bold", marginBottom: 15 }]}>Today</Text>
73
+          {[1,2].map(() => renderNotification())}
74
+
75
+          <Text style={[fonts.titleMedium, { fontWeight: "bold", marginBottom: 15 }]}>Yesterday</Text>
76
+          {[1,2].map(() => renderNotification())}
77
+
78
+          <Text style={[fonts.titleMedium, { fontWeight: "bold", marginBottom: 15 }]}>Older</Text>
79
+          {[1,2].map(() => renderNotification())}
80
+
81
+        </ScrollView>
82
+      </View>
83
+
54 84
     </View>
55 85
   );
56 86
 };
@@ -69,8 +99,8 @@ const styles = StyleSheet.create({
69 99
     paddingHorizontal: 6,
70 100
     fontSize: 10,
71 101
     fontWeight: "400",
72
-    verticalAlign:"middle",
73
-    marginStart:5
102
+    verticalAlign: "middle",
103
+    marginStart: 5
74 104
   },
75 105
   tabContainer: {
76 106
     flexDirection: "row",
@@ -95,7 +125,8 @@ const styles = StyleSheet.create({
95 125
   searchSection: {
96 126
     flexDirection: 'row',
97 127
     justifyContent: 'center',
98
-    alignItems: 'center'
128
+    alignItems: 'center',
129
+    marginBottom: 20
99 130
   },
100 131
   icon: {
101 132
     padding: 10,
@@ -114,4 +145,4 @@ const styles = StyleSheet.create({
114 145
   }
115 146
 });
116 147
 
117
-export default HomeScreen;
148
+export default Home;

+ 112
- 0
app/screens/Notification.jsx Zobrazit soubor

@@ -0,0 +1,112 @@
1
+import React, { useState } from 'react';
2
+import { View, StyleSheet, TextInput, Text, ScrollView } from 'react-native';
3
+import { Appbar, Menu, Avatar, useTheme, Button } from 'react-native-paper';
4
+import Icon from 'react-native-vector-icons/MaterialIcons';
5
+import dpuser from "@/assets/images/userdp.png";
6
+
7
+const Notification = () => {
8
+  const { colors, fonts } = useTheme();
9
+  const [menuVisible, setMenuVisible] = useState(false);
10
+  const [inputContent, setInputContent] = useState("");
11
+
12
+
13
+  const preTextClick = (pretext) => {
14
+    setInputContent(pretext)
15
+  }
16
+
17
+  return (
18
+    <View style={[styles.container, { backgroundColor: colors.background }]}>
19
+      <Appbar.Header>
20
+
21
+        <Avatar.Image size={50} source={dpuser}></Avatar.Image>
22
+
23
+        <View style={styles.titleContainer}>
24
+          <Appbar.Content title="Send Notification" titleStyle={[fonts.titleLarge, styles.title]} />
25
+        </View>
26
+
27
+        {/* Menu Component */}
28
+        <Menu
29
+          visible={menuVisible}
30
+          onDismiss={() => setMenuVisible(false)}
31
+          anchor={
32
+            <Appbar.Action icon="dots-vertical" onPress={() => setMenuVisible(true)} />
33
+          }
34
+        >
35
+          <Menu.Item onPress={() => console.log('Profile Clicked')} title="Profile" />
36
+          <Menu.Item onPress={() => console.log('Settings Clicked')} title="Settings" />
37
+          <Menu.Item onPress={() => console.log('Logout Clicked')} title="Logout" />
38
+        </Menu>
39
+      </Appbar.Header>
40
+
41
+
42
+      <View style={{ flex: 1, marginTop: 20 }}>
43
+        <View style={{ flexDirection: "row", gap: 20, marginBottom: 20 }}>
44
+          <Text style={[fonts.titleLarge, { fontWeight: "bold" }]}>To :</Text>
45
+          <TextInput value='asd' style={{ flex: 1, paddingHorizontal: 20, borderBottomColor: "rgba(0,0,0,0.2)", borderBottomWidth: 1, marginEnd: 20 }}></TextInput>
46
+        </View>
47
+        <TextInput
48
+          style={styles.textArea}
49
+          value={inputContent}
50
+          onChangeText={setInputContent}
51
+          multiline={true} // Enables multi-line input
52
+          numberOfLines={8} // Sets an initial number of visible lines
53
+        />
54
+        <Text style={[fonts.titleLarge, { fontWeight: "bold", marginBottom:20 }]}>Select Pretext</Text>
55
+        <View style={{flex:1}}>
56
+          {[
57
+            "Request to Work From Home",
58
+            "Request for late Check In",
59
+            "Request for early Check Out",
60
+            "Notify for Annual Leave",
61
+            "Notify for Emergency Leave"
62
+          ].map(text => <Text onPress={()=>{preTextClick(text)}} style={[fonts.titleMedium, {marginBottom:20, fontWeight:"bold", color:colors.secondary}]} >{text}</Text> )}
63
+        </View>
64
+      </View>
65
+
66
+    </View>
67
+  );
68
+};
69
+
70
+const styles = StyleSheet.create({
71
+  container: {
72
+    flex: 1,
73
+    padding: 20,
74
+    width: '100%',
75
+  },
76
+  textArea: {
77
+    height: 220,
78
+    borderColor: "#ccc",
79
+    borderWidth: 1,
80
+    padding: 10,
81
+    borderRadius: 8,
82
+    textAlignVertical: "top", // Makes text start from the top-left
83
+    backgroundColor: "#fff",
84
+    marginBottom:20
85
+  },
86
+  badge: {
87
+    backgroundColor: "#BB5C3F",
88
+    color: "#FFF",
89
+    borderRadius: 100,
90
+    paddingVertical: 4,
91
+    paddingHorizontal: 6,
92
+    fontSize: 10,
93
+    fontWeight: "400",
94
+    verticalAlign: "middle",
95
+    marginStart: 5
96
+  },
97
+  titleContainer: {
98
+    flex: 1,
99
+    alignItems: 'center',
100
+  },
101
+  title: {
102
+    fontWeight: 'bold',
103
+  },
104
+  icon: {
105
+    padding: 10,
106
+    position: "absolute",
107
+    right: 10,
108
+    color: "#D9D9D9"
109
+  }
110
+});
111
+
112
+export default Notification;

+ 168
- 0
app/screens/Request.jsx Zobrazit soubor

@@ -0,0 +1,168 @@
1
+import React, { useState } from 'react';
2
+import { View, StyleSheet, TextInput, Text, ScrollView } from 'react-native';
3
+import { Appbar, Menu, Avatar, useTheme, Button } from 'react-native-paper';
4
+import Icon from 'react-native-vector-icons/MaterialIcons';
5
+import dpuser from "@/assets/images/userdp.png";
6
+
7
+const Request = () => {
8
+  const { colors, fonts } = useTheme();
9
+  const [menuVisible, setMenuVisible] = useState(false);
10
+  const [searchInput, setSearchInput] = useState("")
11
+
12
+  const renderNotificationAction = () => {
13
+    return (
14
+      <View style={{marginBottom:30, borderBottomWidth:1, paddingBottom:15, borderBottomColor:"rgba(57, 104, 104, 0.3)"}}>
15
+        <View style={{ flexDirection: "row", marginBottom: 10 }}>
16
+          <Avatar.Image size={60} source={dpuser}></Avatar.Image>
17
+          <View style={{ flex: 1, justifyContent: "center", paddingStart: 15, position:"relative", justifyContent:"space-evenly" }}>
18
+            <Text style={{ fontWeight: "700", position:"absolute", top:5, right:0, color:"rgba(0,0,0,0.3)" }}>7:55AM</Text>
19
+            <Text style={{ fontWeight: "700" }}>Invest Pahang</Text>
20
+            <Text style={{ fontWeight: "700" }}>ID No : Ariffudin@PSK</Text>
21
+          </View>
22
+        </View>
23
+        <Text style={{ fontWeight: "700", marginBottom:10 }}>Muhammad Ariffudin is working from home today</Text>
24
+        <View style={{flexDirection:"row", justifyContent:"space-evenly", gap:10}}>
25
+          <Button mode='outlined' style={{paddingHorizontal:35, borderColor:colors.primary }} onPress={()=>{console.log("click")}}>Reject</Button>
26
+          <Button mode='contained' style={{paddingHorizontal:35}} onPress={()=>{console.log("click")}}>Accept</Button>
27
+        </View>
28
+      </View>
29
+    )
30
+  }
31
+
32
+  const renderNotificationResult = (result) => {
33
+    return (
34
+      <View style={{marginBottom:30, borderBottomWidth:1, paddingBottom:15, borderBottomColor:"rgba(57, 104, 104, 0.3)"}}>
35
+        <View style={{ flexDirection: "row", marginBottom: 10 }}>
36
+          <Avatar.Image size={60} source={dpuser}></Avatar.Image>
37
+          <View style={{ flex: 1, justifyContent: "center", paddingStart: 15, position:"relative", justifyContent:"space-evenly" }}>
38
+            <Text style={{ fontWeight: "700", position:"absolute", top:5, right:0, color:"rgba(0,0,0,0.3)" }}>7:55AM</Text>
39
+            <Text style={{ fontWeight: "700" }}>Invest Pahang</Text>
40
+            <Text style={{ fontWeight: "700" }}>ID No : Ariffudin@PSK</Text>
41
+          </View>
42
+        </View>
43
+        <Text style={{ fontWeight: "700", marginBottom:10 }}>Muhammad Ariffudin is working from home today</Text>
44
+        <View style={{flexDirection:"row"}}>
45
+          {(result) ?
46
+          <Text style={[fonts.titleSmall, {color:colors.primary}]}><Icon name="done" size={20} style={{verticalAlign:"middle", marginEnd:10}} />Request Accepted</Text> : 
47
+          <Text style={[fonts.titleSmall, {color:colors.error}]}><Icon name="close" size={20} style={{verticalAlign:"middle", marginEnd:10}} />Request Decline</Text>
48
+          }
49
+        </View>
50
+      </View>
51
+    )
52
+  }
53
+
54
+  return (
55
+    <View style={[styles.container, { backgroundColor: colors.background }]}>
56
+      <Appbar.Header>
57
+
58
+        <Avatar.Image size={50} source={dpuser}></Avatar.Image>
59
+
60
+        <View style={styles.titleContainer}>
61
+          <Appbar.Content title="Request" titleStyle={[fonts.titleLarge, styles.title]} />
62
+        </View>
63
+
64
+        {/* Menu Component */}
65
+        <Menu
66
+          visible={menuVisible}
67
+          onDismiss={() => setMenuVisible(false)}
68
+          anchor={
69
+            <Appbar.Action icon="dots-vertical" onPress={() => setMenuVisible(true)} />
70
+          }
71
+        >
72
+          <Menu.Item onPress={() => console.log('Profile Clicked')} title="Profile" />
73
+          <Menu.Item onPress={() => console.log('Settings Clicked')} title="Settings" />
74
+          <Menu.Item onPress={() => console.log('Logout Clicked')} title="Logout" />
75
+        </Menu>
76
+      </Appbar.Header>
77
+
78
+      <View style={styles.tabContainer}>
79
+        <Text style={[styles.tabButton, fonts.titleMedium, { fontWeight: "bold" }]}>General  </Text>
80
+        <Text style={[styles.tabButton, fonts.titleMedium, { fontWeight: "bold" }, { borderBottomWidth: 2, borderBottomColor: colors.secondary, color: colors.secondary }]}>Request <Text style={styles.badge}>1</Text></Text>
81
+      </View>
82
+
83
+
84
+      <View style={styles.searchSection}>
85
+        <TextInput
86
+          style={styles.input}
87
+          placeholder="Search"
88
+          onChangeText={setSearchInput}
89
+          value={searchInput}
90
+          underlineColorAndroid="transparent"
91
+          placeholderTextColor="#D9D9D9"
92
+        />
93
+        <Icon name="search" size={20} color="#888" style={styles.icon} />
94
+      </View>
95
+
96
+      <View style={{flex:1}}>
97
+        <ScrollView>
98
+          {[1,2].map(() => renderNotificationAction())}
99
+          {[1].map(() => renderNotificationResult(true))}
100
+          {[1].map(() => renderNotificationResult(false))}
101
+        </ScrollView>
102
+      </View>
103
+
104
+    </View>
105
+  );
106
+};
107
+
108
+const styles = StyleSheet.create({
109
+  container: {
110
+    flex: 1,
111
+    padding: 20,
112
+    width: '100%',
113
+  },
114
+  badge: {
115
+    backgroundColor: "#BB5C3F",
116
+    color: "#FFF",
117
+    borderRadius: 100,
118
+    paddingVertical: 4,
119
+    paddingHorizontal: 6,
120
+    fontSize: 10,
121
+    fontWeight: "400",
122
+    verticalAlign: "middle",
123
+    marginStart: 5
124
+  },
125
+  tabContainer: {
126
+    flexDirection: "row",
127
+    marginBottom: 20
128
+  },
129
+  tabButton: {
130
+    fontWeight: "bold",
131
+    paddingVertical: 15,
132
+    width: "50%",
133
+    textAlign: "center",
134
+    active: {
135
+      borderBottomWidth: 2,
136
+    }
137
+  },
138
+  titleContainer: {
139
+    flex: 1,
140
+    alignItems: 'center',
141
+  },
142
+  title: {
143
+    fontWeight: 'bold',
144
+  },
145
+  searchSection: {
146
+    flexDirection: 'row',
147
+    justifyContent: 'center',
148
+    alignItems: 'center',
149
+    marginBottom: 20
150
+  },
151
+  icon: {
152
+    padding: 10,
153
+    position: "absolute",
154
+    right: 10,
155
+    color: "#D9D9D9"
156
+  },
157
+  input: {
158
+    height: 40,
159
+    flex: 1,
160
+    borderWidth: 1,
161
+    paddingVertical: 10,
162
+    paddingHorizontal: 20,
163
+    borderRadius: 100,
164
+    borderColor: "#C0CFD0"
165
+  }
166
+});
167
+
168
+export default Request;

+ 100
- 0
app/screens/Status.jsx Zobrazit soubor

@@ -0,0 +1,100 @@
1
+import React, { useState } from 'react';
2
+import { View, StyleSheet, TextInput, Text, ScrollView, Image } from 'react-native';
3
+import { Appbar, Menu, Avatar, IconButton, useTheme } from 'react-native-paper';
4
+import Icon from 'react-native-vector-icons/MaterialIcons';
5
+import burgerImage from "@/assets/images/burger.png";
6
+import dpuser from "@/assets/images/userdp.png";
7
+
8
+const Status = () => {
9
+  const { colors, fonts } = useTheme();
10
+  const [menuVisible, setMenuVisible] = useState(false);
11
+  const [searchInput, setSearchInput] = useState("")
12
+
13
+  return (
14
+    <View style={[styles.container, { backgroundColor: colors.background }]}>
15
+      <Appbar.Header>
16
+
17
+        <IconButton
18
+          icon="chevron-left" // Or use "arrow-left"
19
+          iconColor={colors.secondary}
20
+          size={24}
21
+          onPress={() => navigation.goBack()} // Navigates back
22
+        />
23
+
24
+        <View style={styles.titleContainer}>
25
+          <Appbar.Content title="Status" titleStyle={[fonts.titleLarge, styles.title]} />
26
+        </View>
27
+
28
+        <Icon
29
+          name="search"  //used as offset
30
+          size={40}
31
+          color="#FFF"
32
+        />
33
+
34
+      </Appbar.Header>
35
+
36
+      <View style={{ flex: 1 }}>
37
+        <View style={{ alignItems: "center", marginBottom: 20 }}>
38
+          <Text style={[fonts.titleLarge, { color: colors.secondary, fontWeight: "bold" }]}>Abang Bob Burger</Text>
39
+          <Text style={[fonts.titleMedium, { color: colors.secondary, fontWeight: "bold" }]}>No ID : BobBurgerBangi</Text>
40
+        </View>
41
+        <Image source={burgerImage} style={styles.itemImage}></Image>
42
+
43
+        <Text style={[fonts.titleLarge, { fontWeight: "bold", marginBottom: 20 }]}>Notification</Text>
44
+
45
+        <View style={{ flex: 1, flexDirection: "row", gap: 10 }}>
46
+          <Avatar.Image size={60} source={burgerImage} style={{ backgroundColor: "rgba(0,0,0,0.2)" }}></Avatar.Image>
47
+          <View style={{width:"80%"}}>
48
+            <View style={{ backgroundColor: "white", borderWidth: 1, borderColor: colors.secondary, borderRadius: 20, padding: 20, marginBottom:5 }}>
49
+              <Text style={[fonts.titleMedium, { fontWeight: "bold", marginBottom: 20 }]}>
50
+                Order Ready for Pick Up
51
+              </Text>
52
+              <Text style={[fonts.titleSmall, { fontWeight: "bold" }]}>
53
+                Your order for Burger Ayam Special is now ready for pick up. Please pick up in 15 minutes as we are preparing for closing soon.
54
+              </Text>
55
+            </View>
56
+            <Text style={[fonts.titleSmall, { fontWeight: "bold", marginLeft:"auto", color:"rgba(0,0,0,0.4)" }]}>
57
+              11/2/2024 10:52PM
58
+            </Text>
59
+          </View>
60
+
61
+        </View>
62
+
63
+      </View>
64
+
65
+    </View>
66
+  );
67
+};
68
+
69
+const styles = StyleSheet.create({
70
+  itemImage: {
71
+    marginLeft: "auto",
72
+    marginRight: "auto",
73
+    marginBottom: 20
74
+  },
75
+  container: {
76
+    flex: 1,
77
+    padding: 20,
78
+    width: '100%',
79
+  },
80
+  badge: {
81
+    backgroundColor: "#BB5C3F",
82
+    color: "#FFF",
83
+    borderRadius: 100,
84
+    paddingVertical: 4,
85
+    paddingHorizontal: 6,
86
+    fontSize: 10,
87
+    fontWeight: "400",
88
+    verticalAlign: "middle",
89
+    marginStart: 5
90
+  },
91
+  titleContainer: {
92
+    flex: 1,
93
+    alignItems: 'center',
94
+  },
95
+  title: {
96
+    fontWeight: 'bold',
97
+  }
98
+});
99
+
100
+export default Status;

app/screens/WelcomeScreen.jsx → app/screens/Welcome.jsx Zobrazit soubor

@@ -4,7 +4,7 @@ import { Button, useTheme } from 'react-native-paper';
4 4
 import text4uLogo from '@/assets/images/text4ulogo.png'
5 5
 import text4uTitle from '@/assets/images/text4utitle.png'
6 6
 
7
-const WelcomeScreen = () => {
7
+const Welcome = () => {
8 8
     const { colors, button, fonts } = useTheme();
9 9
 
10 10
     const goToLogin = () => {
@@ -96,4 +96,4 @@ const styles = StyleSheet.create({
96 96
     }
97 97
 });
98 98
 
99
-export default WelcomeScreen;
99
+export default Welcome;

binární
assets/images/burger.png Zobrazit soubor


Načítá se…
Zrušit
Uložit