From 38661e00281363b0f4ad32f0b29d739e1ca09164 Mon Sep 17 00:00:00 2001 From: Ashm Walia <40498934+ashmgarv@users.noreply.github.com> Date: Wed, 30 Dec 2020 11:36:44 -0800 Subject: [TMA - 457]Change followers to friends (#149) * One commit to replace followers with friends * Move block unblock to drawer and some cosmetic changes * Options to edit own profile when viewing * Changes for University Class * Small fix * Made ProfileOnboarding a scroll view and other small changes * Small fix * Small fix thanks to ivan and tanmay * Add ? --- src/utils/common.ts | 15 ++++++++++----- src/utils/users.ts | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/utils') diff --git a/src/utils/common.ts b/src/utils/common.ts index 27411149..a2f88e8b 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -3,12 +3,12 @@ import {Linking} from 'react-native'; import {BROWSABLE_SOCIAL_URLS, TOGGLE_BUTTON_TYPE} from '../constants'; export const getToggleButtonText: ( - button_type: string, + buttonType: string, state: boolean, -) => string | null = (button_type, state) => { - switch (button_type) { - case TOGGLE_BUTTON_TYPE.FOLLOW_UNFOLLOW: - return state ? 'Unfollow' : 'Follow'; +) => string | null = (buttonType, state) => { + switch (buttonType) { + case TOGGLE_BUTTON_TYPE.FRIEND_UNFRIEND: + return state ? 'Unfriend' : 'Add Friend'; case TOGGLE_BUTTON_TYPE.BLOCK_UNBLOCK: return state ? 'Unblock' : 'Block'; default: @@ -25,6 +25,11 @@ export const handleOpenSocialUrlOnBrowser = ( } }; +//Returns university class just like we would like to display on profile page +export const getUniversityClass = (universityClass: number) => { + return `Class of ${(universityClass % 2000).toString()}'`; +}; + export const getDateAge: ( date: moment.Moment, ) => 'today' | 'yesterday' | 'thisWeek' | 'unknown' = (date: moment.Moment) => { diff --git a/src/utils/users.ts b/src/utils/users.ts index be92d184..bcb43cbc 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -4,7 +4,7 @@ import {loadSocialPosts} from '../services'; import { loadAllSocials, loadBlockedList, - loadFollowData, + loadFriendsData, loadRecentlySearched, loadUserData, loadUserMoments, @@ -21,7 +21,7 @@ import {ScreenType, UserType} from './../types/types'; const loadData = async (dispatch: AppDispatch, user: UserType) => { await Promise.all([ dispatch(loadUserData(user)), - dispatch(loadFollowData(user.userId)), + dispatch(loadFriendsData(user.userId)), dispatch(loadUserMomentCategories(user.userId)), dispatch(loadUserMoments(user.userId)), dispatch(loadUserNotifications()), -- cgit v1.2.3-70-g09d2