aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-03-26 17:28:23 -0400
committerIvan Chen <ivan@tagg.id>2021-03-26 17:28:23 -0400
commit64f8829ab55bfe6851f10ca933043877769c56bf (patch)
tree1e28d37d626b85bf5f131f5a1f9e8b787f3cf069 /src/components/profile
parent82acd049763452decdab0c40e6cf7286dd2ed57d (diff)
show taggsbar, prevent taggsbar navigation on profile and SP
Diffstat (limited to 'src/components/profile')
-rw-r--r--src/components/profile/Content.tsx28
-rw-r--r--src/components/profile/PublicProfile.tsx5
2 files changed, 17 insertions, 16 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>
);
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<ContentProps> = ({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 {