From c71f1279af4ba37b5dce784cae4090ae857f85c1 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 1 Jun 2021 19:20:00 -0400 Subject: Add userX view, Add padding --- src/components/profile/ProfileBadges.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/components/profile/ProfileBadges.tsx b/src/components/profile/ProfileBadges.tsx index 089d9ea4..3456afe9 100644 --- a/src/components/profile/ProfileBadges.tsx +++ b/src/components/profile/ProfileBadges.tsx @@ -25,6 +25,7 @@ const ProfileBadges: React.FC = ({userXId, screenType}) => { UniversityBadgeDisplayType[] >([]); const [isEditBadgeModalVisible, setIsEditBadgeModalVisible] = useState(false); + const isOwnProfile = userXId === undefined; useEffect(() => { setDisplayBadges(badgesToDisplayBadges(badges)); @@ -33,7 +34,7 @@ const ProfileBadges: React.FC = ({userXId, screenType}) => { return ( <> {/* Tutorial text */} - {displayBadges.length === 0 && ( + {displayBadges.length === 0 && isOwnProfile && ( <> Badges @@ -41,7 +42,7 @@ const ProfileBadges: React.FC = ({userXId, screenType}) => { )} - {displayBadges.length === 0 ? ( + {displayBadges.length === 0 && isOwnProfile && ( // Grey circle placeholders = ({userXId, screenType}) => { ))} - ) : ( + )} + {displayBadges.length !== 0 && ( // Populating actual badges = ({userXId, screenType}) => { ))} {/* Plus icon */} - {displayBadges.length < BADGE_LIMIT && ( + {displayBadges.length < BADGE_LIMIT && isOwnProfile && ( navigation.navigate('BadgeSelection', {editing: true}) @@ -96,7 +98,7 @@ const ProfileBadges: React.FC = ({userXId, screenType}) => { ))} {/* X button */} - {displayBadges.length === BADGE_LIMIT && ( + {displayBadges.length === BADGE_LIMIT && isOwnProfile && ( setIsEditBadgeModalVisible(true)}>