diff options
author | Ivan Chen <ivan@tagg.id> | 2021-03-26 17:28:23 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-03-26 17:28:23 -0400 |
commit | 64f8829ab55bfe6851f10ca933043877769c56bf (patch) | |
tree | 1e28d37d626b85bf5f131f5a1f9e8b787f3cf069 /src/components/profile/Content.tsx | |
parent | 82acd049763452decdab0c40e6cf7286dd2ed57d (diff) |
show taggsbar, prevent taggsbar navigation on profile and SP
Diffstat (limited to 'src/components/profile/Content.tsx')
-rw-r--r-- | src/components/profile/Content.tsx | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index 8d77d798..9fb6f79b 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -22,6 +22,7 @@ import { import {RootState} from '../../store/rootreducer'; import {ContentProps} from '../../types'; import { + canViewProfile, fetchUserX, getUserAsProfilePreviewType, SCREEN_HEIGHT, @@ -81,7 +82,7 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => { const isActuallyBlocked = blockedUsers.some( (cur_user) => user.username === cur_user.username, ); - if (isBlocked != isActuallyBlocked) { + if (isBlocked !== isActuallyBlocked) { setIsBlocked(isActuallyBlocked); } }, [blockedUsers, user]); @@ -110,16 +111,6 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => { } }; - const canViewProfile = () => { - if (loggedInUser.userId === user.userId) { - return true; - } else if (profile.is_private && !isFriend) { - return false; - } else { - return true; - } - }; - const handleScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => { /** * Set the new y position @@ -165,7 +156,11 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => { isBlocked, }} /> - {canViewProfile() ? ( + {canViewProfile( + loggedInUser.userId === user.userId, + profile.is_private, + isFriend, + ) ? ( <> <TaggsBar {...{y, profileBodyHeight, userXId, screenType}} @@ -174,7 +169,14 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => { <PublicProfile {...{y, userXId, screenType}} /> </> ) : ( - <PrivateProfile /> + <> + <TaggsBar + {...{y, profileBodyHeight, userXId, screenType}} + whiteRing={undefined} + allowNavigation={false} + /> + <PrivateProfile /> + </> )} </Animated.ScrollView> ); |