Skip to content

Commit 0cce023

Browse files
authored
Merge pull request #34 from devxtra-community/shanu
Shanu
2 parents 479e9c2 + 985d2fe commit 0cce023

12 files changed

Lines changed: 548 additions & 23 deletions

File tree

frontend/app/(tabs)/_layout.tsx

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,59 @@
11
import { Tabs } from 'expo-router';
2+
import { Home, Search, Ticket, User } from 'lucide-react-native';
23

34
export default function TabLayout() {
45
return (
5-
<Tabs screenOptions={{ headerShown: false }}>
6-
<Tabs.Screen name="home/index" options={{ title: 'Home' }} />
7-
<Tabs.Screen name="search/index" options={{ title: 'Search' }} />
8-
<Tabs.Screen name="events/index" options={{ title: 'Events' }} />
6+
<Tabs
7+
screenOptions={{
8+
headerShown: false,
9+
tabBarShowLabel: false,
10+
tabBarStyle: {
11+
height: 60,
12+
paddingTop: 6,
13+
paddingBottom: 6,
14+
},
15+
tabBarActiveTintColor: '#22c55e',
16+
tabBarInactiveTintColor: '#9ca3af',
17+
}}
18+
>
19+
<Tabs.Screen
20+
name="home/index"
21+
options={{
22+
title: 'Home',
23+
tabBarIcon: ({ color, size }) => (
24+
<Home color={color} size={size} strokeWidth={1} />
25+
),
26+
}}
27+
/>
28+
<Tabs.Screen
29+
name="search/index"
30+
options={{
31+
title: 'Search',
32+
tabBarIcon: ({ color, size }) => (
33+
<Search color={color} size={size} strokeWidth={1} />
34+
),
35+
}}
36+
/>
37+
<Tabs.Screen
38+
name="events/index"
39+
options={{
40+
title: 'Events',
41+
tabBarIcon: ({ color, size }) => (
42+
<Ticket color={color} size={size} strokeWidth={1} />
43+
),
44+
}}
45+
/>
946
<Tabs.Screen name="events/[id]" options={{ href: null }} />
10-
<Tabs.Screen name="profile/index" options={{ title: 'Profile' }} />
47+
<Tabs.Screen
48+
name="profile/index"
49+
options={{
50+
title: 'Profile',
51+
tabBarIcon: ({ color, size }) => (
52+
<User color={color} size={size} strokeWidth={1} />
53+
),
54+
}}
55+
/>
56+
<Tabs.Screen name="events/create" options={{ href: null }} />
1157
</Tabs>
1258
);
1359
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import CreateEventScreen from '@/screens/events/CreateEventScreen';
2+
export default function CreactEvent() {
3+
return <CreateEventScreen />;
4+
}

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"expo-symbols": "~1.0.8",
3131
"expo-system-ui": "~6.0.9",
3232
"expo-web-browser": "~15.0.10",
33+
"lucide-react-native": "^0.562.0",
3334
"react": "19.1.0",
3435
"react-dom": "19.1.0",
3536
"react-native": "0.81.5",

frontend/screens/auth/PhoneScreen.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ export default function PhoneScreen() {
2323
params: { phone: fullPhoneNumber },
2424
});
2525
}
26+
} catch (err: any) {
27+
const data = err?.response?.data;
28+
if (data.next == 'login') {
29+
router.push('/(auth)/login');
30+
}
2631
} finally {
2732
setLoading(false);
2833
}
@@ -61,6 +66,15 @@ export default function PhoneScreen() {
6166
{loading ? 'Sending OTP...' : 'Continue'}
6267
</Text>
6368
</Pressable>
69+
<Pressable
70+
onPress={() => router.push('/(auth)/login')}
71+
style={styles.loginInstead}
72+
>
73+
<Text style={styles.loginText}>
74+
Already have an account?{' '}
75+
<Text style={styles.loginHighlight}>Login instead</Text>
76+
</Text>
77+
</Pressable>
6478
</View>
6579
</View>
6680
</SafeAreaView>
@@ -133,4 +147,18 @@ const styles = StyleSheet.create({
133147
fontSize: 16,
134148
fontWeight: '600',
135149
},
150+
loginInstead: {
151+
marginTop: 20,
152+
alignItems: 'center',
153+
},
154+
155+
loginText: {
156+
fontSize: 14,
157+
color: '#555',
158+
},
159+
160+
loginHighlight: {
161+
color: '#000',
162+
fontWeight: '600',
163+
},
136164
});

frontend/screens/auth/RegisterScreen.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { useState } from 'react';
1111
import { useRouter, useLocalSearchParams } from 'expo-router';
1212
import { registerUser } from '@/services/auth/otp.service';
13+
import { storeTokens } from '@/services/token/token.storage';
1314

1415
const INTERESTS = [
1516
'Technology',
@@ -86,6 +87,7 @@ export default function RegisterScreen() {
8687

8788
if (res?.success) {
8889
router.replace('/(tabs)/home');
90+
storeTokens(res.accesstoken, res.refreshtoken);
8991
} else {
9092
Alert.alert('Registration failed', res?.message || 'Try again');
9193
}

frontend/screens/auth/loginScreen.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import { useState } from 'react';
1010
import { useRouter } from 'expo-router';
1111
import { loginUser } from '@/services/auth/otp.service';
12+
import { storeTokens } from '@/services/token/token.storage';
1213

1314
export default function LoginScreen() {
1415
const router = useRouter();
@@ -18,9 +19,11 @@ export default function LoginScreen() {
1819

1920
async function handleLogin() {
2021
const res = await loginUser({ phoneNumber, password });
22+
console.log(res);
2123

2224
if (res?.success) {
2325
router.replace('/(tabs)/home');
26+
storeTokens(res.accesstoken, res.refreshtoken);
2427
}
2528
}
2629

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { View, Text, Pressable, StyleSheet } from 'react-native';
2+
import { useRouter } from 'expo-router';
3+
4+
export default function CreateEventScreen() {
5+
const router = useRouter();
6+
7+
return (
8+
<View style={styles.container}>
9+
<View style={styles.header}>
10+
<Pressable onPress={() => router.back()}>
11+
<Text style={styles.backText}>Back</Text>
12+
</Pressable>
13+
14+
<Text style={styles.title}>Create Event</Text>
15+
16+
<View style={{ width: 40 }} />
17+
</View>
18+
19+
<View style={styles.content}>
20+
<Text style={styles.placeholder}>
21+
Event creation form will go here.
22+
</Text>
23+
</View>
24+
</View>
25+
);
26+
}
27+
const styles = StyleSheet.create({
28+
container: {
29+
flex: 1,
30+
backgroundColor: '#fff',
31+
},
32+
header: {
33+
height: 56,
34+
paddingHorizontal: 16,
35+
flexDirection: 'row',
36+
alignItems: 'center',
37+
justifyContent: 'space-between',
38+
borderBottomWidth: 0.5,
39+
borderBottomColor: '#e5e7eb',
40+
},
41+
backText: {
42+
color: '#22c55e',
43+
fontSize: 16,
44+
},
45+
title: {
46+
fontSize: 16,
47+
fontWeight: '600',
48+
},
49+
content: {
50+
flex: 1,
51+
padding: 16,
52+
},
53+
placeholder: {
54+
color: '#6b7280',
55+
fontSize: 14,
56+
},
57+
});
Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,66 @@
1-
import { View, Text } from 'react-native';
1+
import { View, Text, Pressable, StyleSheet } from 'react-native';
2+
import { useRouter } from 'expo-router';
3+
4+
export default function EventsScreen() {
5+
const router = useRouter();
26

3-
export default function EventScreen() {
47
return (
5-
<View>
6-
<Text>Events Screen</Text>
8+
<View style={styles.container}>
9+
<View style={styles.header}>
10+
<Text style={styles.title}>Events</Text>
11+
12+
<Pressable onPress={() => router.push('/(tabs)/events/create')}>
13+
<Text style={styles.createText}>Create</Text>
14+
</Pressable>
15+
</View>
16+
17+
<View style={styles.section}>
18+
<Text style={styles.sectionTitle}>My Events</Text>
19+
<Text style={styles.placeholder}>
20+
You haven’t created any events yet.
21+
</Text>
22+
</View>
23+
24+
<View style={styles.section}>
25+
<Text style={styles.sectionTitle}>Joined Events</Text>
26+
<Text style={styles.placeholder}>
27+
Events you join will appear here.
28+
</Text>
29+
</View>
730
</View>
831
);
932
}
33+
const styles = StyleSheet.create({
34+
container: {
35+
flex: 1,
36+
padding: 16,
37+
backgroundColor: '#fff',
38+
},
39+
header: {
40+
flexDirection: 'row',
41+
justifyContent: 'space-between',
42+
alignItems: 'center',
43+
marginBottom: 24,
44+
},
45+
title: {
46+
fontSize: 22,
47+
fontWeight: '600',
48+
},
49+
createText: {
50+
fontSize: 16,
51+
color: '#22c55e',
52+
fontWeight: '500',
53+
},
54+
section: {
55+
marginBottom: 24,
56+
},
57+
sectionTitle: {
58+
fontSize: 16,
59+
fontWeight: '600',
60+
marginBottom: 8,
61+
},
62+
placeholder: {
63+
fontSize: 14,
64+
color: '#6b7280',
65+
},
66+
});
Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,58 @@
1-
import { Text, View } from 'react-native';
1+
import { View, Text, StyleSheet, Pressable } from 'react-native';
22

33
export default function HomeScreen() {
44
return (
5-
<View>
6-
<Text>this is home page</Text>
5+
<View style={styles.container}>
6+
<View style={styles.header}>
7+
<Text style={styles.title}>Home</Text>
8+
</View>
9+
<View style={styles.section}>
10+
<Text style={styles.sectionTitle}>New Events</Text>
11+
<Text style={styles.placeholder}>New events will appear here.</Text>
12+
</View>
13+
14+
<View style={styles.section}>
15+
<Text style={styles.sectionTitle}>Popular Events</Text>
16+
<Text style={styles.placeholder}>Popular events will appear here.</Text>
17+
</View>
718
</View>
819
);
920
}
21+
const styles = StyleSheet.create({
22+
container: {
23+
flex: 1,
24+
padding: 16,
25+
backgroundColor: '#fff',
26+
},
27+
header: {
28+
marginBottom: 16,
29+
},
30+
title: {
31+
fontSize: 22,
32+
fontWeight: '600',
33+
},
34+
searchBox: {
35+
height: 44,
36+
borderRadius: 8,
37+
backgroundColor: '#f3f4f6',
38+
justifyContent: 'center',
39+
paddingHorizontal: 12,
40+
marginBottom: 24,
41+
},
42+
searchText: {
43+
color: '#6b7280',
44+
fontSize: 14,
45+
},
46+
section: {
47+
marginBottom: 24,
48+
},
49+
sectionTitle: {
50+
fontSize: 16,
51+
fontWeight: '600',
52+
marginBottom: 8,
53+
},
54+
placeholder: {
55+
fontSize: 14,
56+
color: '#6b7280',
57+
},
58+
});

0 commit comments

Comments
 (0)