diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-03-12 14:17:55 -0500 |
|---|---|---|
| committer | Ivan Chen <ivan@tagg.id> | 2021-03-12 14:17:55 -0500 |
| commit | 4a05b26c5c32980ac18c832cc4dd74c6c93922a8 (patch) | |
| tree | ce2c0e37f545d6167ffc2dc024dd2683648c9bdc /src/components | |
| parent | b568f553c4ee2f0452f6bb7ab7b03c84d77c15ab (diff) | |
using discover/get_users, updated route params, cleaned up code
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/common/GradientBorderButton.tsx | 10 | ||||
| -rw-r--r-- | src/components/search/SearchCategories.tsx | 25 | ||||
| -rw-r--r-- | src/components/search/SearchResultCell.tsx | 3 | ||||
| -rw-r--r-- | src/components/search/SearchResultList.tsx | 1 |
4 files changed, 22 insertions, 17 deletions
diff --git a/src/components/common/GradientBorderButton.tsx b/src/components/common/GradientBorderButton.tsx index 0402c44b..00ea7175 100644 --- a/src/components/common/GradientBorderButton.tsx +++ b/src/components/common/GradientBorderButton.tsx @@ -45,20 +45,20 @@ const styles = StyleSheet.create({ marginVertical: 15, }, gradientContainer: { - width: 159, - height: 38, + width: 175, + height: 40, }, label: { fontWeight: '500', - fontSize: normalize(15), + fontSize: normalize(14), }, maskBorder: { borderRadius: 20, }, textContainer: { position: 'absolute', - width: 159, - height: 38, + width: 175, + height: 40, justifyContent: 'center', alignItems: 'center', }, diff --git a/src/components/search/SearchCategories.tsx b/src/components/search/SearchCategories.tsx index f00debb5..a71befe6 100644 --- a/src/components/search/SearchCategories.tsx +++ b/src/components/search/SearchCategories.tsx @@ -2,16 +2,18 @@ import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; import {StyleSheet, View} from 'react-native'; import {GradientBorderButton} from '..'; -import {getButtons} from '../../services/ExploreService'; +import {getSuggestedSearchBubbleSuggestions} from '../../services/ExploreService'; import {SearchCategoryType} from '../../types'; import {SCREEN_WIDTH} from '../../utils'; interface SearchCategoriesProps { darkStyle?: boolean; + defaultButtons?: SearchCategoryType[]; } const SearchCategories: React.FC<SearchCategoriesProps> = ({ darkStyle = false, + defaultButtons, }) => { const navigation = useNavigation(); const mtSearchCategory: (key: number) => SearchCategoryType = (key) => ({ @@ -20,18 +22,25 @@ const SearchCategories: React.FC<SearchCategoriesProps> = ({ category: '...', }); const [buttons, setButtons] = useState<SearchCategoryType[]>([ - mtSearchCategory(1), - mtSearchCategory(2), - mtSearchCategory(3), - mtSearchCategory(4), + mtSearchCategory(-1), + mtSearchCategory(-2), + mtSearchCategory(-3), + mtSearchCategory(-4), ]); + useEffect(() => { const loadButtons = async () => { - const localButtons = await getButtons(); + const localButtons = await getSuggestedSearchBubbleSuggestions(); setButtons([]); - setButtons(localButtons); + if (localButtons) { + setButtons(localButtons); + } }; - loadButtons(); + if (!defaultButtons) { + loadButtons(); + } else { + setButtons(defaultButtons); + } }, []); return ( diff --git a/src/components/search/SearchResultCell.tsx b/src/components/search/SearchResultCell.tsx index 5cba6d2f..e0351d96 100644 --- a/src/components/search/SearchResultCell.tsx +++ b/src/components/search/SearchResultCell.tsx @@ -23,13 +23,11 @@ import { } from '../../utils/users'; interface SearchResults { - type: 'badges' | 'categories' | 'users'; profileData: ProfilePreviewType; loggedInUser: UserType; } const SearchResultsCell: React.FC<SearchResults> = ({ - type, profileData: { id, name, @@ -114,7 +112,6 @@ const SearchResultsCell: React.FC<SearchResults> = ({ const categoryObj: CategoryPreviewType = {name, category}; addCategoryToRecentlySearched(categoryObj); navigation.navigate('DiscoverUsers', { - type, searchCategory: {id, name}, }); }; diff --git a/src/components/search/SearchResultList.tsx b/src/components/search/SearchResultList.tsx index d8cf02d9..704e4192 100644 --- a/src/components/search/SearchResultList.tsx +++ b/src/components/search/SearchResultList.tsx @@ -57,7 +57,6 @@ const SearchResultList: React.FC<SearchResultsProps> = ({ renderItem={({section, item}) => { return ( <SearchResultsCell - type={section.title} profileData={item} loggedInUser={loggedInUser} /> |
