aboutsummaryrefslogtreecommitdiff
path: root/src/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/suggestedPeople/SPBody.tsx88
1 files changed, 48 insertions, 40 deletions
diff --git a/src/screens/suggestedPeople/SPBody.tsx b/src/screens/suggestedPeople/SPBody.tsx
index c22f8143..eb80da49 100644
--- a/src/screens/suggestedPeople/SPBody.tsx
+++ b/src/screens/suggestedPeople/SPBody.tsx
@@ -1,11 +1,11 @@
import {useNavigation} from '@react-navigation/native';
import React, {Fragment, useEffect, useMemo, useState} from 'react';
-import {StyleSheet, Text, View} from 'react-native';
+import {ImageSourcePropType, StyleSheet, Text, View} from 'react-native';
import {Image} from 'react-native-animatable';
import {TouchableOpacity} from 'react-native-gesture-handler';
import RequestedButton from '../../assets/ionicons/requested-button.svg';
-import {SPTaggsBar} from '../../components';
-import {BadgesDropdown, MutualFriends} from '../../components/suggestedPeople';
+import {UniversityIcon} from '../../components';
+import {BadgeIcon, MutualFriends} from '../../components/suggestedPeople';
import {BADGE_DATA} from '../../constants/badges';
import {
ProfilePreviewType,
@@ -28,7 +28,6 @@ const SPBody: React.FC<SPBodyProps> = ({
user,
university,
mutual_friends,
- social_links,
suggested_people_url,
friendship,
badges,
@@ -43,7 +42,7 @@ const SPBody: React.FC<SPBodyProps> = ({
const [localBadges, setLocalBadges] = useState<
{
badge: UniversityBadge;
- img: string;
+ img: ImageSourcePropType;
}[]
>([]);
const navigation = useNavigation();
@@ -116,21 +115,30 @@ const SPBody: React.FC<SPBodyProps> = ({
[suggested_people_url],
);
- const NamePlate = () => {
- return (
- <TouchableOpacity
- onPress={() => {
- navigation.navigate('Profile', {
- userXId: loggedInUserId === user.id ? undefined : user.id,
- screenType,
- });
- }}
- style={styles.nameInfoContainer}>
- <Text style={styles.firstName}>{user.first_name}</Text>
- <Text style={styles.username}>@{user.username}</Text>
- </TouchableOpacity>
- );
- };
+ const NamePlate = () => (
+ <TouchableOpacity
+ onPress={() => {
+ navigation.navigate('Profile', {
+ userXId: loggedInUserId === user.id ? undefined : user.id,
+ screenType,
+ });
+ }}>
+ <Text style={styles.firstName}>{user.first_name}</Text>
+ <Text style={styles.username}>@{user.username}</Text>
+ </TouchableOpacity>
+ );
+
+ const Badges = () => (
+ // Badges aligned left and spaced as if there are 5 items
+ <View style={styles.badgeContainer}>
+ {localBadges.map(({badge, img}, index) => (
+ <BadgeIcon key={index} badge={badge} img={img} style={styles.badge} />
+ ))}
+ {[0, 0, 0, 0, 0].splice(localBadges.length, 5).map((_, index) => (
+ <View key={index} style={styles.badge} />
+ ))}
+ </View>
+ );
return (
<View>
@@ -138,22 +146,20 @@ const SPBody: React.FC<SPBodyProps> = ({
<View style={styles.mainContainer}>
<View style={styles.topContainer}>
<Text style={styles.title}>{firstItem && 'Suggested People'}</Text>
- {localBadges && (
- <BadgesDropdown {...{university, localBadges, badges}} />
- )}
+ <UniversityIcon
+ university={university}
+ style={styles.universityIcon}
+ imageStyle={styles.universityIcon}
+ />
</View>
- <View style={styles.body}>
+ <View>
<View style={styles.marginManager}>
<View style={styles.addUserContainer}>
<NamePlate />
{user.id !== loggedInUserId && <FriendButton />}
</View>
</View>
- <SPTaggsBar
- userXId={user.id === loggedInUserId ? undefined : user.id}
- screenType={screenType}
- linkedSocials={social_links}
- />
+ {localBadges.length !== 0 && <Badges />}
<View style={styles.marginManager}>
<MutualFriends user={user} friends={mutual_friends} />
</View>
@@ -219,7 +225,6 @@ const styles = StyleSheet.create({
textShadowRadius: normalize(2),
letterSpacing: normalize(2),
},
- nameInfoContainer: {},
addButton: {
justifyContent: 'center',
alignItems: 'center',
@@ -267,17 +272,20 @@ const styles = StyleSheet.create({
shadowOffset: {width: 2, height: 2},
shadowOpacity: 0.5,
},
- body: {},
- button: {
- justifyContent: 'center',
+ universityIcon: {
+ left: '5%',
+ width: normalize(31),
+ height: normalize(38),
+ },
+ badgeContainer: {
+ flexDirection: 'row',
alignItems: 'center',
- width: SCREEN_WIDTH * 0.4,
- aspectRatio: 154 / 33,
- borderWidth: 2,
- borderColor: '#fff',
- borderRadius: 3,
- marginRight: '2%',
- marginLeft: '1%',
+ justifyContent: 'space-evenly',
+ marginBottom: 25,
+ },
+ badge: {
+ width: normalize(52),
+ height: normalize(52),
},
});