From 64f8829ab55bfe6851f10ca933043877769c56bf Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 26 Mar 2021 17:28:23 -0400 Subject: show taggsbar, prevent taggsbar navigation on profile and SP --- src/components/profile/Content.tsx | 28 +++++++++++++++------------- src/components/profile/PublicProfile.tsx | 5 ++--- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/components/profile') 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 = ({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 = ({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) => { /** * Set the new y position @@ -165,7 +156,11 @@ const Content: React.FC = ({y, userXId, screenType}) => { isBlocked, }} /> - {canViewProfile() ? ( + {canViewProfile( + loggedInUser.userId === user.userId, + profile.is_private, + isFriend, + ) ? ( <> = ({y, userXId, screenType}) => { ) : ( - + <> + + + )} ); diff --git a/src/components/profile/PublicProfile.tsx b/src/components/profile/PublicProfile.tsx index 4b5166f0..a70e8e50 100644 --- a/src/components/profile/PublicProfile.tsx +++ b/src/components/profile/PublicProfile.tsx @@ -2,7 +2,7 @@ import {useFocusEffect, useNavigation} from '@react-navigation/native'; import React, {useCallback, useEffect, useState} from 'react'; import {Alert, StyleSheet, Text, View} from 'react-native'; import {TouchableOpacity} from 'react-native-gesture-handler'; -import {useDispatch, useSelector, useStore} from 'react-redux'; +import {useDispatch, useSelector} from 'react-redux'; import GreyPlusLogo from '../../assets/icons/grey-plus-logo.svg'; import {TAGG_LIGHT_BLUE} from '../../constants'; import { @@ -17,7 +17,6 @@ import { } from '../../store/actions'; import { EMPTY_MOMENTS_LIST, - EMPTY_PROFILE_PREVIEW_LIST, NO_PROFILE, NO_USER, } from '../../store/initialStates'; @@ -159,7 +158,7 @@ const PublicProfile: React.FC = ({y, userXId, screenType}) => { const createImagesMap = useCallback(() => { let map = new Map(); moments.forEach(function (imageObject) { - let moment_category = imageObject.moment_category; + let moment_category = imageObject.moment_category; if (map.has(moment_category)) { map.get(moment_category).push(imageObject); } else { -- cgit v1.2.3-70-g09d2