diff --git a/frontend/assets/colorConstants.tsx b/frontend/assets/colorConstants.tsx index aa61e10..cff7e0e 100644 --- a/frontend/assets/colorConstants.tsx +++ b/frontend/assets/colorConstants.tsx @@ -13,6 +13,7 @@ const Colors = { TRANSGREEN: '#366959', BLACKTRANS: '#000000aa', BLUE: 'blue', + TEAL: '#6bcfca' }; export default Colors; \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 3f7b581..d9282a8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -38,7 +38,7 @@ "react-native-circular-progress-indicator": "^4.4.2", "react-native-elements": "^3.4.3", "react-native-gesture-handler": "^2.13.3", - "react-native-paper": "^5.11.1", + "react-native-paper": "^5.11.3", "react-native-reanimated": "~3.3.0", "react-native-safe-area-context": "^4.6.3", "react-native-screens": "~3.22.0", diff --git a/frontend/src/components/expProgressBar.tsx b/frontend/src/components/expProgressBar.tsx new file mode 100644 index 0000000..eeb3c6d --- /dev/null +++ b/frontend/src/components/expProgressBar.tsx @@ -0,0 +1,70 @@ +import React from 'react'; +import { View, Text, StyleSheet } from 'react-native'; +import Colors from '../../assets/colorConstants'; +import { getUserLevel } from '../models/User'; +import { type ExpProgressBarProps } from './types'; + +const ExpProgressBar: React.FC = ({ thisUser }) => { + const lvl = getUserLevel(thisUser); + // testing--const lvl = 7; + const lvlThresh = [250, 500, 1000, 2000, 4000, 8000, 16000, 32000, 64000]; + const maxExp = lvlThresh[lvl - 1]; + + const curr = thisUser.score; + // testing--const curr = 14039; + + const progress = (curr / maxExp) * 100; + + return ( + + + + + + + Level: {lvl} + + + {`${curr}/${maxExp}`} + + + + ); +}; + +const styles = StyleSheet.create({ + container: { + width: 250, + marginVertical: 4, + }, + progressBar: { + flexDirection: 'row', + height: 5, + backgroundColor: Colors.WHITE, + borderRadius: 10, + overflow: 'hidden', + }, + currProgression:{ + backgroundColor: Colors.TEAL, + height: '100%', + + }, + levelContainer:{ + flex: 1, + justifyContent: 'flex-start', + paddingLeft: 5, + }, + texts:{ + marginTop: 5, + color: Colors.WHITE, + fontSize: 12, + }, + progContainer:{ + justifyContent: 'flex-end', + }, + textBox:{ + flexDirection: 'row' + } +}); + +export default ExpProgressBar; diff --git a/frontend/src/components/types.tsx b/frontend/src/components/types.tsx index ba41670..0a7221f 100644 --- a/frontend/src/components/types.tsx +++ b/frontend/src/components/types.tsx @@ -44,3 +44,7 @@ export interface challenge { export interface challengesProps { challenges: challenge[]; } + +export interface ExpProgressBarProps { + thisUser: User, +} \ No newline at end of file diff --git a/frontend/src/widgets/profileWidget.tsx b/frontend/src/widgets/profileWidget.tsx index 09f7a48..2058b74 100644 --- a/frontend/src/widgets/profileWidget.tsx +++ b/frontend/src/widgets/profileWidget.tsx @@ -3,7 +3,7 @@ import { View, Text, Image, StyleSheet, TouchableOpacity } from 'react-native'; import Colors from '../../assets/colorConstants'; import { type profileWidgetBoxProps } from '../components/types'; import { useFonts } from 'expo-font'; -import { getUserLevel } from '../models/User'; +import ExpProgressBar from '../components/expProgressBar'; const ProfileWidgetBox: React.FC = ({ photoURL, user }) => { const [loaded] = useFonts({ @@ -20,7 +20,9 @@ const ProfileWidgetBox: React.FC = ({ photoURL, user }) = {user.full_name} - Level: {getUserLevel(user)} + + + Badges @@ -70,10 +72,6 @@ const styles = StyleSheet.create({ buttonText:{ color: Colors.WHITE, }, - level:{ - fontSize: 16, - color: Colors.WHITE - }, name: { fontSize: 20, color: Colors.WHITE, @@ -81,7 +79,7 @@ const styles = StyleSheet.create({ }, nameBox: { top: '20%', - flex: 1, + flex: 2, alignItems: 'center' }, profilePicture: { @@ -90,8 +88,10 @@ const styles = StyleSheet.create({ borderRadius: 45, alignItems: 'flex-start', top: '15%', - }, + progressBar:{ + } + }); export default ProfileWidgetBox;