diff options
Diffstat (limited to 'src/components/profile')
-rw-r--r-- | src/components/profile/Content.tsx | 2 | ||||
-rw-r--r-- | src/components/profile/Friends.tsx | 2 | ||||
-rw-r--r-- | src/components/profile/ProfileHeader.tsx | 2 | ||||
-rw-r--r-- | src/components/profile/ProfilePreview.tsx | 42 |
4 files changed, 12 insertions, 36 deletions
diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index e75ae949..ae9f9564 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -13,7 +13,7 @@ import { import {TouchableOpacity} from 'react-native-gesture-handler'; import Animated from 'react-native-reanimated'; import {useDispatch, useSelector, useStore} from 'react-redux'; -import {Cover} from '.'; +import Cover from './Cover'; import GreyPlusLogo from '../../assets/icons/grey-plus-logo.svg'; import {COVER_HEIGHT, TAGG_LIGHT_BLUE} from '../../constants'; import { diff --git a/src/components/profile/Friends.tsx b/src/components/profile/Friends.tsx index 02a7460a..7c7265c5 100644 --- a/src/components/profile/Friends.tsx +++ b/src/components/profile/Friends.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {View, StyleSheet, ScrollView, Text} from 'react-native'; import {ProfilePreviewType, ScreenType} from '../../types'; -import {ProfilePreview} from '..'; +import {ProfilePreview} from '../profile'; import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; import {TAGG_LIGHT_BLUE} from '../../constants'; import {RootState} from '../../store/rootReducer'; diff --git a/src/components/profile/ProfileHeader.tsx b/src/components/profile/ProfileHeader.tsx index 7dad2a68..e5bd9d93 100644 --- a/src/components/profile/ProfileHeader.tsx +++ b/src/components/profile/ProfileHeader.tsx @@ -1,7 +1,7 @@ import React, {useState} from 'react'; import {StyleSheet, Text, View} from 'react-native'; import {useSelector} from 'react-redux'; -import {UniversityIcon} from '.'; +import UniversityIcon from './UniversityIcon'; import {PROFILE_CUTOUT_TOP_Y} from '../../constants'; import {RootState} from '../../store/rootreducer'; import {ScreenType} from '../../types'; diff --git a/src/components/profile/ProfilePreview.tsx b/src/components/profile/ProfilePreview.tsx index 02ab94e7..f08335a1 100644 --- a/src/components/profile/ProfilePreview.tsx +++ b/src/components/profile/ProfilePreview.tsx @@ -16,6 +16,7 @@ import {loadImageFromURL} from '../../services'; import {RootState} from '../../store/rootreducer'; import {PreviewType, ProfilePreviewType, ScreenType} from '../../types'; import { + addUserToRecentlyViewed, checkIfUserIsBlocked, fetchUserX, isIPhoneX, @@ -37,12 +38,14 @@ interface ProfilePreviewProps extends ViewProps { profilePreview: ProfilePreviewType; previewType: PreviewType; screenType: ScreenType; + setMFDrawer?: Function; } const ProfilePreview: React.FC<ProfilePreviewProps> = ({ profilePreview: {username, first_name, last_name, id, thumbnail_url}, previewType, screenType, + setMFDrawer, }) => { const navigation = useNavigation(); const {user: loggedInUser} = useSelector((state: RootState) => state.user); @@ -87,39 +90,7 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ return; } if (previewType !== 'Comment') { - const jsonValue = await AsyncStorage.getItem( - '@recently_searched_users', - ); - let recentlySearchedList = - jsonValue != null ? JSON.parse(jsonValue) : null; - if (recentlySearchedList) { - if (recentlySearchedList.length > 0) { - if ( - recentlySearchedList.some( - (saved_user: ProfilePreviewType) => saved_user.id === id, - ) - ) { - console.log('User already in recently searched.'); - } else { - if (recentlySearchedList.length >= 10) { - recentlySearchedList.pop(); - } - recentlySearchedList.unshift(user); - } - } - } else { - recentlySearchedList = [user]; - } - - try { - let recentlySearchedListString = JSON.stringify(recentlySearchedList); - await AsyncStorage.setItem( - '@recently_searched_users', - recentlySearchedListString, - ); - } catch (e) { - console.log(e); - } + await addUserToRecentlyViewed(user) } const userXId = @@ -139,6 +110,11 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ ); } + // Close Mutual Friends drawer on suggested people upon navigation + if (setMFDrawer) { + setMFDrawer(false); + } + navigation.push('Profile', { userXId, screenType, |