|
| 1 | +import React, { useState } from 'react'; |
| 2 | +import { SafeAreaView, View, Text, StyleSheet, ScrollView, TouchableOpacity, Image, Switch } from 'react-native'; |
| 3 | +import { useUser } from '@/contexts/UserContext'; |
| 4 | +import { router } from 'expo-router'; |
| 5 | + |
| 6 | +const ProfileScreen = () => { |
| 7 | + const { name } = useUser(); |
| 8 | + const [notificationsEnabled, setNotificationsEnabled] = useState(false); |
| 9 | + |
| 10 | + const toggleNotifications = () => setNotificationsEnabled(prev => !prev); |
| 11 | + |
| 12 | + return ( |
| 13 | + <SafeAreaView style={styles.container}> |
| 14 | + <ScrollView contentContainerStyle={styles.content}> |
| 15 | + {/* Back Arrow */} |
| 16 | + <TouchableOpacity onPress={() => router.back()} style={styles.backBtn}> |
| 17 | + <Image source={require('@/assets/images/arrow-left.png')} style={styles.backIcon} /> |
| 18 | + </TouchableOpacity> |
| 19 | + |
| 20 | + {/* Profile Box */} |
| 21 | + <View style={styles.profileBox}> |
| 22 | + <Text style={styles.profileName}>{name}</Text> |
| 23 | + <TouchableOpacity style={styles.editBtn}> |
| 24 | + <Text style={styles.editText}>Edit</Text> |
| 25 | + </TouchableOpacity> |
| 26 | + |
| 27 | + <View style={styles.statsRow}> |
| 28 | + <View style={styles.statBox}><Text style={styles.statLabel}>Height</Text><Text style={styles.statValue}>180 cm</Text></View> |
| 29 | + <View style={styles.statBox}><Text style={styles.statLabel}>Weight</Text><Text style={styles.statValue}>75 kg</Text></View> |
| 30 | + <View style={styles.statBox}><Text style={styles.statLabel}>Age</Text><Text style={styles.statValue}>28</Text></View> |
| 31 | + </View> |
| 32 | + </View> |
| 33 | + |
| 34 | + {/* Account Box */} |
| 35 | + <View style={styles.sectionBox}> |
| 36 | + <Text style={styles.sectionTitle}>Account</Text> |
| 37 | + <Text style={styles.optionItem}>Personal Data</Text> |
| 38 | + <Text style={styles.optionItem}>Achievement</Text> |
| 39 | + <Text style={styles.optionItem}>Activity History</Text> |
| 40 | + <Text style={styles.optionItem}>Workout Progress</Text> |
| 41 | + </View> |
| 42 | + |
| 43 | + {/* Notification Box */} |
| 44 | + <View style={styles.sectionBox}> |
| 45 | + <Text style={styles.sectionTitle}>Notification</Text> |
| 46 | + <View style={styles.toggleRow}> |
| 47 | + <Text style={styles.optionItem}>Pop-up Notifications</Text> |
| 48 | + <Switch |
| 49 | + value={notificationsEnabled} |
| 50 | + onValueChange={toggleNotifications} |
| 51 | + trackColor={{ false: '#ccc', true: '#70A1FF' }} |
| 52 | + thumbColor={notificationsEnabled ? '#FFF' : '#f4f3f4'} |
| 53 | + /> |
| 54 | + </View> |
| 55 | + </View> |
| 56 | + |
| 57 | + {/* Other Box */} |
| 58 | + <View style={styles.sectionBox}> |
| 59 | + <Text style={styles.sectionTitle}>Other</Text> |
| 60 | + <Text style={styles.optionItem}>Privacy Policy</Text> |
| 61 | + <Text style={styles.optionItem}>Contact Us</Text> |
| 62 | + <Text style={styles.optionItem}>Settings</Text> |
| 63 | + </View> |
| 64 | + </ScrollView> |
| 65 | + |
| 66 | + {/* Bottom Navigation */} |
| 67 | + <View style={styles.bottomNav}> |
| 68 | + <TouchableOpacity onPress={() => router.replace('/home')}> |
| 69 | + <Image source={require('../assets/images/home-active.png')} style={styles.navIcon} /> |
| 70 | + </TouchableOpacity> |
| 71 | + <TouchableOpacity onPress={() => alert('Progress screen not yet implemented')}> |
| 72 | + <Image source={require('../assets/images/chart.png')} style={styles.navIcon} /> |
| 73 | + </TouchableOpacity> |
| 74 | + <TouchableOpacity onPress={() => alert('Search screen not yet implemented')}> |
| 75 | + <Image source={require('../assets/images/search.png')} style={styles.searchIcon} /> |
| 76 | + </TouchableOpacity> |
| 77 | + <TouchableOpacity onPress={() => alert('Camera screen not yet implemented')}> |
| 78 | + <Image source={require('../assets/images/camera.png')} style={styles.navIcon} /> |
| 79 | + </TouchableOpacity> |
| 80 | + <TouchableOpacity onPress={() => router.replace('/home')}> |
| 81 | + <Image source={require('../assets/images/user.png')} style={styles.navIcon} /> |
| 82 | + </TouchableOpacity> |
| 83 | + </View> |
| 84 | + </SafeAreaView> |
| 85 | + ); |
| 86 | +}; |
| 87 | + |
| 88 | +const styles = StyleSheet.create({ |
| 89 | + container: { flex: 1, backgroundColor: '#FFFFFF' }, |
| 90 | + content: { padding: 16, paddingBottom: 80 }, |
| 91 | + backBtn: { marginBottom: 16 }, |
| 92 | + backIcon: { width: 24, height: 24 }, |
| 93 | + profileBox: { backgroundColor: '#E5F1FF', borderRadius: 20, padding: 16, marginBottom: 24 }, |
| 94 | + profileName: { fontSize: 24, fontWeight: 'bold', color: '#333' }, |
| 95 | + editBtn: { backgroundColor: '#70A1FF', borderRadius: 12, paddingVertical: 6, paddingHorizontal: 12, alignSelf: 'flex-start', marginTop: 8 }, |
| 96 | + editText: { color: '#FFF' }, |
| 97 | + statsRow: { flexDirection: 'row', justifyContent: 'space-between', marginTop: 16 }, |
| 98 | + statBox: { backgroundColor: '#FFF', borderRadius: 12, padding: 12, width: '30%', alignItems: 'center' }, |
| 99 | + statLabel: { fontSize: 12, color: '#555' }, |
| 100 | + statValue: { fontSize: 16, fontWeight: 'bold', color: '#333' }, |
| 101 | + sectionBox: { backgroundColor: '#F5F8FF', borderRadius: 16, padding: 16, marginBottom: 24 }, |
| 102 | + sectionTitle: { fontSize: 16, fontWeight: 'bold', color: '#333', marginBottom: 8 }, |
| 103 | + optionItem: { fontSize: 14, color: '#555', paddingVertical: 6 }, |
| 104 | + toggleRow: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }, |
| 105 | + bottomNav: { position: 'absolute', bottom: 0, left: 0, right: 0, height: 60, flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center', backgroundColor: '#FFF', borderTopWidth: 1, borderColor: '#EEE' }, |
| 106 | + navIcon: { width: 24, height: 24 }, |
| 107 | + centerButton: { backgroundColor: '#fff', padding: 12, borderRadius: 24, elevation: 4 }, |
| 108 | + searchIcon: { width: 28, height: 28 }, |
| 109 | +}); |
| 110 | + |
| 111 | +export default ProfileScreen; |
0 commit comments