diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-22 19:07:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 19:07:04 -0400 |
commit | 1f04e445e9d317bc141624a440a2c1e55f8704b3 (patch) | |
tree | 1d38b38e527955481aac1c45de65f6cf7ef600d3 /src/components/profile/ProfileHeader.tsx | |
parent | e8913cc0bdc432c20a008e852482c82c3bb3c2a0 (diff) | |
parent | ac082ed35d765f7182e95541d8eb9e2d9f033641 (diff) |
Merge pull request #379 from ankit-thanekar007/tma-794-806-badge-profile-view
[TMA-794/806] Badge profile view
Diffstat (limited to 'src/components/profile/ProfileHeader.tsx')
-rw-r--r-- | src/components/profile/ProfileHeader.tsx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/components/profile/ProfileHeader.tsx b/src/components/profile/ProfileHeader.tsx index 2c623c2b..9dc58501 100644 --- a/src/components/profile/ProfileHeader.tsx +++ b/src/components/profile/ProfileHeader.tsx @@ -1,10 +1,12 @@ import React, {useState} from 'react'; import {StyleSheet, Text, View} from 'react-native'; +import {TouchableOpacity} from 'react-native-gesture-handler'; import {useSelector} from 'react-redux'; import {PROFILE_CUTOUT_TOP_Y} from '../../constants'; import {RootState} from '../../store/rootreducer'; import {ScreenType} from '../../types'; import {normalize} from '../../utils'; +import BadgeDetailView from '../common/BadgeDetailView'; import Avatar from './Avatar'; import FriendsCount from './FriendsCount'; import ProfileMoreInfoDrawer from './ProfileMoreInfoDrawer'; @@ -29,8 +31,14 @@ const ProfileHeader: React.FC<ProfileHeaderProps> = ({ } = useSelector((state: RootState) => userXId ? state.userX[screenType][userXId] : state.user, ); + + const { + user: {username = ''}, + } = useSelector((state: RootState) => state.user); const [drawerVisible, setDrawerVisible] = useState(false); + const [showBadgeView, setBadgeViewVisible] = useState(false); const [firstName, lastName] = [...name.split(' ')]; + return ( <View style={styles.container}> <ProfileMoreInfoDrawer @@ -59,7 +67,18 @@ const ProfileHeader: React.FC<ProfileHeaderProps> = ({ )} <View style={styles.friendsAndUniversity}> <FriendsCount screenType={screenType} userXId={userXId} /> - <UniversityIcon {...{university, university_class}} /> + <TouchableOpacity onPress={() => setBadgeViewVisible(true)}> + <UniversityIcon + {...{university, university_class, needsShadow: true}} + /> + </TouchableOpacity> + {showBadgeView && ( + <BadgeDetailView + isEditable={userXName === username} + name={name} + setBadgeViewVisible={setBadgeViewVisible} + /> + )} </View> </View> </View> |