Skip to content

Commit 2ec74e3

Browse files
committed
keeps track of age, weight, height of users
1 parent 6fcf2e8 commit 2ec74e3

File tree

3 files changed

+163
-147
lines changed

3 files changed

+163
-147
lines changed

KonditionExpo/app/profile.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useUser } from '@/contexts/UserContext';
44
import { router } from 'expo-router';
55

66
const ProfileScreen = () => {
7-
const { name } = useUser();
7+
const { name, height, weight, age } = useUser();
88
const [notificationsEnabled, setNotificationsEnabled] = useState(false);
99

1010
const toggleNotifications = () => setNotificationsEnabled(prev => !prev);
@@ -19,15 +19,24 @@ const ProfileScreen = () => {
1919

2020
{/* Profile Box */}
2121
<View style={styles.profileBox}>
22-
<Text style={styles.profileName}>{name}</Text>
22+
<Text style={styles.profileName}>{name || 'User'}</Text>
2323
<TouchableOpacity style={styles.editBtn}>
2424
<Text style={styles.editText}>Edit</Text>
2525
</TouchableOpacity>
2626

2727
<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>
28+
<View style={styles.statBox}>
29+
<Text style={styles.statLabel}>Height</Text>
30+
<Text style={styles.statValue}>{height ? `${height} cm` : '-'}</Text>
31+
</View>
32+
<View style={styles.statBox}>
33+
<Text style={styles.statLabel}>Weight</Text>
34+
<Text style={styles.statValue}>{weight ? `${weight} kg` : '-'}</Text>
35+
</View>
36+
<View style={styles.statBox}>
37+
<Text style={styles.statLabel}>Age</Text>
38+
<Text style={styles.statValue}>{age > 0 ? age : '-'}</Text>
39+
</View>
3140
</View>
3241
</View>
3342

@@ -71,7 +80,7 @@ const ProfileScreen = () => {
7180
<TouchableOpacity onPress={() => alert('Progress screen not yet implemented')}>
7281
<Image source={require('../assets/images/chart.png')} style={styles.navIcon} />
7382
</TouchableOpacity>
74-
<TouchableOpacity onPress={() => alert('Search screen not yet implemented')}>
83+
<TouchableOpacity onPress={() => alert('Search screen not yet implemented')}>
7584
<Image source={require('../assets/images/search.png')} style={styles.searchIcon} />
7685
</TouchableOpacity>
7786
<TouchableOpacity onPress={() => alert('Camera screen not yet implemented')}>
@@ -104,7 +113,6 @@ const styles = StyleSheet.create({
104113
toggleRow: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' },
105114
bottomNav: { position: 'absolute', bottom: 0, left: 0, right: 0, height: 60, flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center', backgroundColor: '#FFF', borderTopWidth: 1, borderColor: '#EEE' },
106115
navIcon: { width: 24, height: 24 },
107-
centerButton: { backgroundColor: '#fff', padding: 12, borderRadius: 24, elevation: 4 },
108116
searchIcon: { width: 28, height: 28 },
109117
});
110118

0 commit comments

Comments
 (0)