diff options
-rw-r--r-- | src/components/profile/Content.tsx | 6 | ||||
-rw-r--r-- | src/components/profile/ProfileBody.tsx | 6 | ||||
-rw-r--r-- | src/components/profile/ProfilePreview.tsx | 9 |
3 files changed, 7 insertions, 14 deletions
diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index 71e4f195..17713ea3 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -119,11 +119,6 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => { }); }, []); - /** - * If own profile is being viewed then do not show the follow button. - */ - const isOwnProfile = loggedInUser.username === user.username; - const onLayout = (e: LayoutChangeEvent) => { const {height} = e.nativeEvent.layout; setProfileBodyHeight(height); @@ -283,7 +278,6 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => { onLayout, userXId, screenType, - isOwnProfile, isFollowed, handleFollowUnfollow, isBlocked, diff --git a/src/components/profile/ProfileBody.tsx b/src/components/profile/ProfileBody.tsx index 49ee74ee..85634daa 100644 --- a/src/components/profile/ProfileBody.tsx +++ b/src/components/profile/ProfileBody.tsx @@ -11,7 +11,6 @@ interface ProfileBodyProps { onLayout: (event: LayoutChangeEvent) => void; isFollowed: boolean; isBlocked: boolean; - isOwnProfile: boolean; handleFollowUnfollow: Function; handleBlockUnblock: Function; userXId: string | undefined; @@ -21,7 +20,6 @@ const ProfileBody: React.FC<ProfileBodyProps> = ({ onLayout, isFollowed, isBlocked, - isOwnProfile, handleFollowUnfollow, handleBlockUnblock, userXId, @@ -50,7 +48,7 @@ const ProfileBody: React.FC<ProfileBodyProps> = ({ ); }}>{`${website}`}</Text> )} - {userXId && !isOwnProfile ? ( + {userXId && ( <View style={styles.toggleButtonContainer}> {!isBlocked && ( <ToggleButton @@ -65,8 +63,6 @@ const ProfileBody: React.FC<ProfileBodyProps> = ({ buttonType={TOGGLE_BUTTON_TYPE.BLOCK_UNBLOCK} /> </View> - ) : ( - <></> )} </View> ); diff --git a/src/components/profile/ProfilePreview.tsx b/src/components/profile/ProfilePreview.tsx index 71fd2a85..cc18e457 100644 --- a/src/components/profile/ProfilePreview.tsx +++ b/src/components/profile/ProfilePreview.tsx @@ -19,6 +19,7 @@ import {useSelector, useDispatch, useStore} from 'react-redux'; import {RootState} from '../../store/rootreducer'; import {logout} from '../../store/actions'; import {fetchUserX, userXInStore} from '../../utils'; +import NavigationBar from 'src/routes/tabs'; const NO_USER: UserType = { userId: '', username: '', @@ -38,6 +39,7 @@ interface ProfilePreviewProps extends ViewProps { previewType: PreviewType; screenType: ScreenType; } + const ProfilePreview: React.FC<ProfilePreviewProps> = ({ profilePreview: {username, first_name, last_name, id}, previewType, @@ -156,6 +158,7 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ * If the user is already present in store, do not fetch again * Finally, Navigate to profile of the user selected */ + if (!userXInStore(state, screenType, user.id)) { await fetchUserX( dispatch, @@ -163,10 +166,10 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ screenType, ); } + const userXId = loggedInUser.username === user.username ? undefined : user.id; navigation.push('Profile', { - username: user.username, - userXId: user.id, - screenType: screenType, + userXId, + screenType, }); } catch (e) { console.log(e); |