diff options
author | Ivan Chen <ivan@tagg.id> | 2021-03-29 15:01:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 15:01:52 -0400 |
commit | ad2ad5d232473d38426c2f0f8283ba015dadfd4c (patch) | |
tree | f375a074fa23ca70c304f93b5577ed830250394c /src/components/taggs | |
parent | 4de1ebd43437712e28a89bb624c5b12afad45cc6 (diff) | |
parent | ee80ddfb8a486fea31d845aba4e0b4847fe637e9 (diff) |
Merge pull request #306 from TaggiD-Inc/tma-701-private-account-banner
[TMA 701] : Separated Private and Public Profiles
Diffstat (limited to 'src/components/taggs')
-rw-r--r-- | src/components/taggs/Tagg.tsx | 5 | ||||
-rw-r--r-- | src/components/taggs/TaggsBar.tsx | 14 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx index 547a77cb..4e4987fb 100644 --- a/src/components/taggs/Tagg.tsx +++ b/src/components/taggs/Tagg.tsx @@ -34,6 +34,7 @@ interface TaggProps { userXId: string | undefined; user: UserType; whiteRing: boolean | undefined; + allowNavigation?: boolean; } const Tagg: React.FC<TaggProps> = ({ @@ -45,6 +46,7 @@ const Tagg: React.FC<TaggProps> = ({ userXId, user, whiteRing, + allowNavigation = true, }) => { const navigation = useNavigation(); const [modalVisible, setModalVisible] = useState(false); @@ -145,7 +147,8 @@ const Tagg: React.FC<TaggProps> = ({ <View style={whiteRing ? styles.spcontainer : styles.container}> <TouchableOpacity style={styles.iconTap} - onPress={modalOrAuthBrowserOrPass}> + onPress={modalOrAuthBrowserOrPass} + disabled={!allowNavigation}> <SocialIcon style={styles.icon} social={social} whiteRing /> {pickTheRightRingHere()} </TouchableOpacity> diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx index f952c53f..567b58de 100644 --- a/src/components/taggs/TaggsBar.tsx +++ b/src/components/taggs/TaggsBar.tsx @@ -2,7 +2,7 @@ import React, {Fragment, useEffect, useState} from 'react'; import {StyleSheet} from 'react-native'; import Animated from 'react-native-reanimated'; import {useSafeAreaInsets} from 'react-native-safe-area-context'; -import {useDispatch, useSelector} from 'react-redux'; +import {useDispatch, useSelector, useStore} from 'react-redux'; import { INTEGRATED_SOCIAL_LIST, PROFILE_CUTOUT_BOTTOM_Y, @@ -12,6 +12,7 @@ import {getLinkedSocials} from '../../services'; import {loadIndividualSocial, updateSocial} from '../../store/actions'; import {RootState} from '../../store/rootReducer'; import {ScreenType} from '../../types'; +import {canViewProfile} from '../../utils'; import Tagg from './Tagg'; const {View, ScrollView, interpolate, Extrapolate} = Animated; @@ -33,10 +34,11 @@ const TaggsBar: React.FC<TaggsBarProps> = ({ }) => { let [taggs, setTaggs] = useState<Object[]>([]); let [taggsNeedUpdate, setTaggsNeedUpdate] = useState(true); - - const {user} = userXId - ? useSelector((state: RootState) => state.userX[screenType][userXId]) - : useSelector((state: RootState) => state.user); + const {user} = useSelector((state: RootState) => + userXId ? state.userX[screenType][userXId] : state.user, + ); + const state: RootState = useStore().getState(); + const allowTaggsNavigation = canViewProfile(state, userXId, screenType); const dispatch = useDispatch(); @@ -79,6 +81,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({ setTaggsNeedUpdate={setTaggsNeedUpdate} setSocialDataNeedUpdate={handleSocialUpdate} whiteRing={whiteRing ? whiteRing : undefined} + allowNavigation={allowTaggsNavigation} />, ); i++; @@ -96,6 +99,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({ userXId={userXId} user={user} whiteRing={whiteRing ? whiteRing : undefined} + allowNavigation={allowTaggsNavigation} />, ); i++; |