aboutsummaryrefslogtreecommitdiff
path: root/src/components/search/SearchResultCell.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-03-29 14:02:31 -0400
committerIvan Chen <ivan@tagg.id>2021-03-29 14:02:31 -0400
commit04bf806285e7626644234b7febee2dad5c912f8d (patch)
tree9ed3ec581792d6a0e1135f02a1d4716890ca75fc /src/components/search/SearchResultCell.tsx
parente8324a7278a82d926acceedc10921f0b14e6d403 (diff)
parent4de1ebd43437712e28a89bb624c5b12afad45cc6 (diff)
Merge branch 'master' into tma-701-private-account-banner
# Conflicts: # src/constants/strings.ts
Diffstat (limited to 'src/components/search/SearchResultCell.tsx')
-rw-r--r--src/components/search/SearchResultCell.tsx17
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>