diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-02 14:54:05 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-06-02 14:54:05 -0400 |
commit | 06c1e5674a2e77bfa22048b4d559949403d30e0e (patch) | |
tree | d1f85e8abb0904cfb17e2e7bffb1c198ced8b6cd /src/components/profile/ProfileBadges.tsx | |
parent | 21bd2597b72c8ba8246b98e72fe45ba373046a7f (diff) |
Improve util code
Diffstat (limited to 'src/components/profile/ProfileBadges.tsx')
-rw-r--r-- | src/components/profile/ProfileBadges.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/components/profile/ProfileBadges.tsx b/src/components/profile/ProfileBadges.tsx index aef52903..8e68dc46 100644 --- a/src/components/profile/ProfileBadges.tsx +++ b/src/components/profile/ProfileBadges.tsx @@ -1,15 +1,15 @@ import {useNavigation} from '@react-navigation/core'; import React, {FC, useEffect, useState} from 'react'; -import {Image, StyleSheet, Text, View} from 'react-native'; +import {StyleSheet, Text, View} from 'react-native'; import {ScrollView, TouchableOpacity} from 'react-native-gesture-handler'; import {useSelector} from 'react-redux'; import {BadgeIcon} from '..'; +import PlusIconImage from '../../assets/icons/plus-icon-thin.svg'; import {BADGE_LIMIT} from '../../constants'; import {RootState} from '../../store/rootReducer'; import {ScreenType, UniversityBadgeDisplayType} from '../../types'; import {badgesToDisplayBadges, normalize} from '../../utils'; import BadgeDetailView from '../common/BadgeDetailView'; -import PlusIconImage from '../../assets/icons/plus-icon-thin.svg'; interface ProfileBadgesProps { userXId: string | undefined; @@ -18,7 +18,7 @@ interface ProfileBadgesProps { const ProfileBadges: React.FC<ProfileBadgesProps> = ({userXId, screenType}) => { const navigation = useNavigation(); - const {badges, name} = useSelector((state: RootState) => + const {badges, name, university} = useSelector((state: RootState) => userXId ? state.userX[screenType][userXId].profile : state.user.profile, ); const [displayBadges, setDisplayBadges] = useState< @@ -28,7 +28,7 @@ const ProfileBadges: React.FC<ProfileBadgesProps> = ({userXId, screenType}) => { const isOwnProfile = userXId === undefined; useEffect(() => { - setDisplayBadges(badgesToDisplayBadges(badges)); + setDisplayBadges(badgesToDisplayBadges(badges, university)); }, [badges]); const PlusIcon: FC = () => ( |