aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-03-29 14:18:00 -0400
committerIvan Chen <ivan@tagg.id>2021-03-29 14:18:00 -0400
commit641a98cd5d184efb5639952812f24c56c90e7f62 (patch)
tree14d1ba8d3b5fc3aed26d850138031915c43c56e5 /src
parent872a3e8dbb7182e532d7878f3b1f316b3ca69386 (diff)
code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/components/profile/Content.tsx1
-rw-r--r--src/components/taggs/TaggsBar.tsx18
-rw-r--r--src/screens/suggestedPeople/SPBody.tsx5
3 files changed, 9 insertions, 15 deletions
diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx
index 779e0525..cf2b7d28 100644
--- a/src/components/profile/Content.tsx
+++ b/src/components/profile/Content.tsx
@@ -165,7 +165,6 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => {
<TaggsBar
{...{y, profileBodyHeight, userXId, screenType}}
whiteRing={undefined}
- allowNavigation={false}
/>
<PrivateProfile />
</>
diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx
index a9c428b2..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;
@@ -22,7 +23,6 @@ interface TaggsBarProps {
screenType: ScreenType;
whiteRing: boolean | undefined;
linkedSocials?: string[];
- allowNavigation?: boolean;
}
const TaggsBar: React.FC<TaggsBarProps> = ({
y,
@@ -31,14 +31,14 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
screenType,
whiteRing,
linkedSocials,
- allowNavigation = true,
}) => {
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();
@@ -81,7 +81,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
setTaggsNeedUpdate={setTaggsNeedUpdate}
setSocialDataNeedUpdate={handleSocialUpdate}
whiteRing={whiteRing ? whiteRing : undefined}
- allowNavigation={allowNavigation}
+ allowNavigation={allowTaggsNavigation}
/>,
);
i++;
@@ -99,7 +99,7 @@ const TaggsBar: React.FC<TaggsBarProps> = ({
userXId={userXId}
user={user}
whiteRing={whiteRing ? whiteRing : undefined}
- allowNavigation={allowNavigation}
+ allowNavigation={allowTaggsNavigation}
/>,
);
i++;
diff --git a/src/screens/suggestedPeople/SPBody.tsx b/src/screens/suggestedPeople/SPBody.tsx
index 297f76c0..824f8b1c 100644
--- a/src/screens/suggestedPeople/SPBody.tsx
+++ b/src/screens/suggestedPeople/SPBody.tsx
@@ -166,11 +166,6 @@ const SPBody: React.FC<SPBodyProps> = ({
screenType={screenType}
whiteRing={true}
linkedSocials={social_links}
- allowNavigation={canViewProfile(
- state,
- loggedInUserId === user.id ? undefined : user.id,
- screenType,
- )}
/>
<View style={styles.marginManager}>
<MutualFriends user={user} friends={mutual_friends} />