diff options
author | Ivan Chen <ivan@tagg.id> | 2021-03-27 20:30:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-27 20:30:36 -0400 |
commit | 67fb6f5cae06dfbcb359dd6468cb66ad85fa230d (patch) | |
tree | eaf092811d5be72e89e4dec9942dc59a1f8a0211 /src/components/search/SearchResultCell.tsx | |
parent | bef5728b24a71d1bf327a72e425346020a997037 (diff) | |
parent | bf0a2abf8bab333ff0d87bc07002e6f96199ce3b (diff) |
Merge pull request #330 from ankit-thanekar007/tma-722-cornell-fe
[TMA 722] : Cornell FrontEnd changes
Diffstat (limited to 'src/components/search/SearchResultCell.tsx')
-rw-r--r-- | src/components/search/SearchResultCell.tsx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/components/search/SearchResultCell.tsx b/src/components/search/SearchResultCell.tsx index 9a8216e5..5a6ea110 100644 --- a/src/components/search/SearchResultCell.tsx +++ b/src/components/search/SearchResultCell.tsx @@ -2,7 +2,7 @@ import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; import {Alert, Image, StyleSheet, Text, View} from 'react-native'; import {TouchableOpacity} from 'react-native-gesture-handler'; -import {useDispatch, useStore} from 'react-redux'; +import {useDispatch, useSelector, useStore} from 'react-redux'; import {ERROR_UNABLE_TO_VIEW_PROFILE} from '../../constants/strings'; import {loadImageFromURL} from '../../services'; import {RootState} from '../../store/rootReducer'; @@ -10,11 +10,13 @@ import { CategoryPreviewType, ProfilePreviewType, ScreenType, + UniversityType, UserType, } from '../../types'; import { addCategoryToRecentlySearched, addUserToRecentlySearched, + getUniversityBadge, normalize, SCREEN_WIDTH, } from '../../utils'; @@ -43,6 +45,9 @@ const SearchResultsCell: React.FC<SearchResults> = ({ loggedInUser, }) => { const [avatar, setAvatar] = useState<string | undefined>(undefined); + + const {university} = useSelector((state: RootState) => state.user.profile); + useEffect(() => { (async () => { if (thumbnail_url !== undefined) { @@ -143,17 +148,17 @@ const SearchResultsCell: React.FC<SearchResults> = ({ return require('../../assets/images/search.png'); }; - const universityIcon = () => { - return require('../../assets/images/bwbadges.png'); - }; - const categoryCell = () => { return ( <TouchableOpacity style={styles.cellContainer} onPress={onPressCategory}> <View style={[styles.imageContainer, styles.categoryBackground]}> <Image resizeMode="contain" - source={category === 'Brown' ? universityIcon() : searchIcon()} + source={ + category in UniversityType + ? getUniversityBadge(university, 'Search') + : searchIcon() + } style={styles.categoryImage} /> </View> |