aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/assets/images/shuffle-1.pngbin0 -> 157612 bytes
-rw-r--r--src/assets/images/shuffle-2.pngbin0 -> 149495 bytes
-rw-r--r--src/components/common/GradientBorderButton.tsx66
-rw-r--r--src/components/common/index.ts1
-rw-r--r--src/components/search/SearchCategories.tsx97
-rw-r--r--src/components/search/SearchResultCell.tsx14
-rw-r--r--src/components/search/SearchResultList.tsx1
-rw-r--r--src/routes/main/MainStackNavigator.tsx1
-rw-r--r--src/routes/main/MainStackScreen.tsx3
-rw-r--r--src/screens/search/DiscoverUsers.tsx125
-rw-r--r--src/screens/search/SearchScreen.tsx22
-rw-r--r--src/services/ExploreService.ts46
-rw-r--r--src/store/actions/taggUsers.ts4
-rw-r--r--src/store/initialStates.ts14
-rw-r--r--src/store/reducers/taggUsersReducer.ts1
-rw-r--r--src/utils/common.ts21
16 files changed, 301 insertions, 115 deletions
diff --git a/src/assets/images/shuffle-1.png b/src/assets/images/shuffle-1.png
new file mode 100644
index 00000000..d28ddc21
--- /dev/null
+++ b/src/assets/images/shuffle-1.png
Binary files differ
diff --git a/src/assets/images/shuffle-2.png b/src/assets/images/shuffle-2.png
new file mode 100644
index 00000000..a6a701b0
--- /dev/null
+++ b/src/assets/images/shuffle-2.png
Binary files differ
diff --git a/src/components/common/GradientBorderButton.tsx b/src/components/common/GradientBorderButton.tsx
new file mode 100644
index 00000000..00ea7175
--- /dev/null
+++ b/src/components/common/GradientBorderButton.tsx
@@ -0,0 +1,66 @@
+import MaskedView from '@react-native-community/masked-view';
+import React from 'react';
+import {StyleSheet, Text, View} from 'react-native';
+import {TouchableOpacity} from 'react-native-gesture-handler';
+import LinearGradient from 'react-native-linear-gradient';
+import {TAGG_LIGHT_BLUE_2, TAGG_PURPLE} from '../../constants';
+import {normalize} from '../../utils';
+
+interface GradientBorderButtonProps {
+ text: string;
+ darkStyle: boolean;
+ onPress: () => void;
+}
+
+const GradientBorderButton: React.FC<GradientBorderButtonProps> = ({
+ text,
+ darkStyle,
+ onPress,
+}) => {
+ const labelColor = darkStyle ? 'white' : '#828282';
+ const borderWidth = darkStyle ? 2 : 1;
+ return (
+ <TouchableOpacity style={styles.container} onPress={onPress}>
+ <MaskedView
+ maskElement={
+ <View
+ style={[styles.gradientContainer, styles.maskBorder, {borderWidth}]}
+ />
+ }>
+ <LinearGradient
+ colors={[TAGG_PURPLE, TAGG_LIGHT_BLUE_2]}
+ start={{x: 0.0, y: 1.0}}
+ end={{x: 1.0, y: 1.0}}
+ style={styles.gradientContainer}
+ />
+ </MaskedView>
+ <View style={styles.textContainer}>
+ <Text style={[styles.label, {color: labelColor}]}>{text}</Text>
+ </View>
+ </TouchableOpacity>
+ );
+};
+const styles = StyleSheet.create({
+ container: {
+ marginVertical: 15,
+ },
+ gradientContainer: {
+ width: 175,
+ height: 40,
+ },
+ label: {
+ fontWeight: '500',
+ fontSize: normalize(14),
+ },
+ maskBorder: {
+ borderRadius: 20,
+ },
+ textContainer: {
+ position: 'absolute',
+ width: 175,
+ height: 40,
+ justifyContent: 'center',
+ alignItems: 'center',
+ },
+});
+export default GradientBorderButton;
diff --git a/src/components/common/index.ts b/src/components/common/index.ts
index e1543cd8..8499dbfa 100644
--- a/src/components/common/index.ts
+++ b/src/components/common/index.ts
@@ -22,3 +22,4 @@ export {default as TaggPrompt} from './TaggPrompt';
export {default as AcceptDeclineButtons} from './AcceptDeclineButtons';
export {default as FriendsButton} from './FriendsButton';
export {default as TaggSquareButton} from './TaggSquareButton';
+export {default as GradientBorderButton} from './GradientBorderButton';
diff --git a/src/components/search/SearchCategories.tsx b/src/components/search/SearchCategories.tsx
index c3c4c518..a71befe6 100644
--- a/src/components/search/SearchCategories.tsx
+++ b/src/components/search/SearchCategories.tsx
@@ -1,47 +1,64 @@
import {useNavigation} from '@react-navigation/native';
import React, {useEffect, useState} from 'react';
-import {StyleSheet, Text, View} from 'react-native';
-import {TouchableOpacity} from 'react-native-gesture-handler';
-import LinearGradient from 'react-native-linear-gradient';
-import {getButtons} from '../../services/ExploreService';
+import {StyleSheet, View} from 'react-native';
+import {GradientBorderButton} from '..';
+import {getSuggestedSearchBubbleSuggestions} from '../../services/ExploreService';
import {SearchCategoryType} from '../../types';
-import {TAGG_LIGHT_BLUE_2, TAGG_PURPLE} from '../../constants';
import {SCREEN_WIDTH} from '../../utils';
-const SearchCategories: React.FC = () => {
- const [buttons, setButtons] = useState<SearchCategoryType[]>([]);
+interface SearchCategoriesProps {
+ darkStyle?: boolean;
+ defaultButtons?: SearchCategoryType[];
+}
+
+const SearchCategories: React.FC<SearchCategoriesProps> = ({
+ darkStyle = false,
+ defaultButtons,
+}) => {
+ const navigation = useNavigation();
+ const mtSearchCategory: (key: number) => SearchCategoryType = (key) => ({
+ id: key,
+ name: '...',
+ category: '...',
+ });
+ const [buttons, setButtons] = useState<SearchCategoryType[]>([
+ mtSearchCategory(-1),
+ mtSearchCategory(-2),
+ mtSearchCategory(-3),
+ mtSearchCategory(-4),
+ ]);
+
useEffect(() => {
const loadButtons = async () => {
- const localButtons = await getButtons();
- console.log('localButtons: ', localButtons);
- await setButtons(localButtons);
+ const localButtons = await getSuggestedSearchBubbleSuggestions();
+ setButtons([]);
+ if (localButtons) {
+ setButtons(localButtons);
+ }
};
- loadButtons();
+ if (!defaultButtons) {
+ loadButtons();
+ } else {
+ setButtons(defaultButtons);
+ }
}, []);
- const navigation = useNavigation();
return (
<View style={styles.container}>
- {buttons &&
- buttons.map((searchCategory) => (
- <LinearGradient
- key={searchCategory.id}
- colors={[TAGG_PURPLE, TAGG_LIGHT_BLUE_2]}
- start={{x: 0.0, y: 1.0}}
- end={{x: 1.0, y: 1.0}}
- style={styles.gradientContainer}>
- <TouchableOpacity
- style={styles.buttonContainer}
- key={searchCategory.id}
- onPress={() => {
- navigation.navigate('DiscoverUsers', {
- searchCategory,
- });
- }}>
- <Text style={styles.buttonText}>{searchCategory.name}</Text>
- </TouchableOpacity>
- </LinearGradient>
- ))}
+ {buttons.map((searchCategory) => (
+ <GradientBorderButton
+ key={searchCategory.id}
+ text={searchCategory.name}
+ darkStyle={darkStyle}
+ onPress={() => {
+ if (searchCategory.name !== '...') {
+ navigation.push('DiscoverUsers', {
+ searchCategory,
+ });
+ }
+ }}
+ />
+ ))}
</View>
);
};
@@ -56,20 +73,8 @@ const styles = StyleSheet.create({
flexWrap: 'wrap',
justifyContent: 'space-evenly',
},
- gradientContainer: {
- width: 159,
- height: 38,
- alignItems: 'center',
- justifyContent: 'center',
- marginVertical: '2.5%',
- flexDirection: 'row',
- alignContent: 'center',
- borderRadius: 20,
- borderColor: 'transparent',
- borderWidth: 1,
- },
buttonContainer: {
- backgroundColor: 'white',
+ backgroundColor: 'transparent',
width: 158,
height: 37,
borderRadius: 20,
@@ -84,7 +89,7 @@ const styles = StyleSheet.create({
fontSize: 15,
lineHeight: 17.9,
alignSelf: 'center',
- color: '#828282',
+ color: 'white',
},
});
export default SearchCategories;
diff --git a/src/components/search/SearchResultCell.tsx b/src/components/search/SearchResultCell.tsx
index 70adcd94..9a8216e5 100644
--- a/src/components/search/SearchResultCell.tsx
+++ b/src/components/search/SearchResultCell.tsx
@@ -7,29 +7,30 @@ import {ERROR_UNABLE_TO_VIEW_PROFILE} from '../../constants/strings';
import {loadImageFromURL} from '../../services';
import {RootState} from '../../store/rootReducer';
import {
+ CategoryPreviewType,
ProfilePreviewType,
ScreenType,
UserType,
- CategoryPreviewType,
} from '../../types';
-import {normalize, SCREEN_WIDTH} from '../../utils';
+import {
+ addCategoryToRecentlySearched,
+ addUserToRecentlySearched,
+ normalize,
+ SCREEN_WIDTH,
+} from '../../utils';
import {
checkIfUserIsBlocked,
defaultUserProfile,
fetchUserX,
userXInStore,
- addUserToRecentlySearched,
- addCategoryToRecentlySearched,
} from '../../utils/users';
interface SearchResults {
- type: 'badges' | 'categories' | 'users';
profileData: ProfilePreviewType;
loggedInUser: UserType;
}
const SearchResultsCell: React.FC<SearchResults> = ({
- type,
profileData: {
id,
name,
@@ -114,7 +115,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 2a4d3746..687b2285 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}
/>
diff --git a/src/routes/main/MainStackNavigator.tsx b/src/routes/main/MainStackNavigator.tsx
index 10b8ec3d..8953cfe0 100644
--- a/src/routes/main/MainStackNavigator.tsx
+++ b/src/routes/main/MainStackNavigator.tsx
@@ -22,7 +22,6 @@ export type MainStackParams = {
screenType: ScreenType;
};
DiscoverUsers: {
- type: 'badges' | 'categories' | 'users';
searchCategory: SearchCategoryType;
};
Profile: {
diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx
index 91f41fe4..cb232297 100644
--- a/src/routes/main/MainStackScreen.tsx
+++ b/src/routes/main/MainStackScreen.tsx
@@ -4,11 +4,9 @@ import {StackNavigationOptions} from '@react-navigation/stack';
import React, {useState} from 'react';
import {StyleSheet, Text} from 'react-native';
import {normalize} from 'react-native-elements';
-import MutualBadgeHolders from '../../screens/suggestedPeople/MutualBadgeHolders';
import BackIcon from '../../assets/icons/back-arrow.svg';
import {
AnimatedTutorial,
- BadgeSelection,
CaptionScreen,
CategorySelection,
CreateCustomCategory,
@@ -26,6 +24,7 @@ import {
SuggestedPeopleScreen,
SuggestedPeopleUploadPictureScreen,
} from '../../screens';
+import MutualBadgeHolders from '../../screens/suggestedPeople/MutualBadgeHolders';
import {ScreenType} from '../../types';
import {AvatarHeaderHeight, SCREEN_WIDTH} from '../../utils';
import {MainStack, MainStackParams} from './MainStackNavigator';
diff --git a/src/screens/search/DiscoverUsers.tsx b/src/screens/search/DiscoverUsers.tsx
index ce7507fc..d67e5448 100644
--- a/src/screens/search/DiscoverUsers.tsx
+++ b/src/screens/search/DiscoverUsers.tsx
@@ -1,15 +1,26 @@
+import {RouteProp, useNavigation} from '@react-navigation/native';
import React, {useEffect, useState} from 'react';
import {FlatList, StatusBar, StyleSheet} from 'react-native';
-import {Text} from 'react-native-animatable';
+import {Image, Text} from 'react-native-animatable';
+import {TouchableOpacity} from 'react-native-gesture-handler';
import {SafeAreaView} from 'react-native-safe-area-context';
-import {HeaderHeight, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils';
-import {SearchBackground, TabsGradient} from '../../components';
-import {RouteProp} from '@react-navigation/native';
-import {MainStackParams} from '../../routes';
-import {normalize} from '../../utils';
-import {ProfilePreviewType} from '../../types';
+import {
+ SearchBackground,
+ SearchCategories,
+ TabsGradient,
+ TaggLoadingIndicator,
+} from '../../components';
import ExploreSectionUser from '../../components/search/ExploreSectionUser';
+import {headerBarOptions, MainStackParams} from '../../routes';
import {getDiscoverUsers} from '../../services/ExploreService';
+import {ProfilePreviewType} from '../../types';
+import {
+ HeaderHeight,
+ normalize,
+ SCREEN_HEIGHT,
+ SCREEN_WIDTH,
+ shuffle,
+} from '../../utils';
type DiscoverUsersRouteProps = RouteProp<MainStackParams, 'DiscoverUsers'>;
@@ -18,16 +29,81 @@ interface DiscoverUsersProps {
}
const DiscoverUsers: React.FC<DiscoverUsersProps> = ({route}) => {
- const {type: category_type} = route.params;
- const {id, name} = route.params.searchCategory;
- const [users, setUsers] = useState<ProfilePreviewType[]>();
+ const {name} = route.params.searchCategory;
+ const [categoryName, setCategoryName] = useState<string | undefined>();
+ const [users, setUsers] = useState<ProfilePreviewType[]>([]);
+ const [shouldRefresh, setShouldRefresh] = useState(false);
+ const [showIcon1, setShowIcon1] = useState(true);
+ const mtUser = (key: number) => ({
+ id: key,
+ username: '...',
+ first_name: '',
+ last_name: '',
+ thumbnail_url: '',
+ });
+ const dummyUsers = [
+ mtUser(-1),
+ mtUser(-2),
+ mtUser(-3),
+ mtUser(-4),
+ mtUser(-5),
+ mtUser(-6),
+ mtUser(-7),
+ mtUser(-8),
+ mtUser(-9),
+ ];
+ const [loading, setLoading] = useState(true);
+ const navigation = useNavigation();
+
+ navigation.setOptions({
+ ...headerBarOptions('white', name),
+ headerRight: () => (
+ <TouchableOpacity
+ onPress={() => {
+ setShowIcon1(!showIcon1);
+ setShouldRefresh(true);
+ }}>
+ <Image
+ source={
+ showIcon1
+ ? require('../../assets/images/shuffle-1.png')
+ : require('../../assets/images/shuffle-2.png')
+ }
+ style={styles.shuffleIcon}
+ />
+ </TouchableOpacity>
+ ),
+ });
+
+ useEffect(() => {
+ setCategoryName(name);
+ }, []);
+
+ useEffect(() => {
+ if (shouldRefresh) {
+ setLoading(true);
+ setTimeout(() => {
+ setUsers(shuffle(users));
+ setShouldRefresh(false);
+ setLoading(false);
+ }, 500);
+ }
+ }, [shouldRefresh, users]);
useEffect(() => {
const loadData = async () => {
- setUsers(await getDiscoverUsers(id, category_type));
+ setLoading(true);
+ if (!categoryName) {
+ return;
+ }
+ const fetched_users = await getDiscoverUsers(categoryName);
+ if (fetched_users) {
+ setUsers(fetched_users);
+ }
+ setLoading(false);
};
loadData();
- }, []);
+ }, [categoryName]);
const _renderItem = ({item: user}: {item: ProfilePreviewType}) => (
<ExploreSectionUser key={user.id} user={user} style={styles.user} />
@@ -37,16 +113,23 @@ const DiscoverUsers: React.FC<DiscoverUsersProps> = ({route}) => {
<SearchBackground>
<StatusBar barStyle="light-content" />
<SafeAreaView>
- <Text style={styles.headerText}>{name}</Text>
+ {loading && <TaggLoadingIndicator fullscreen={true} />}
<FlatList
- data={users}
+ data={loading ? dummyUsers : users.slice(0, 9)}
style={styles.scrollView}
+ scrollEnabled={false}
contentContainerStyle={styles.contentContainerStyle}
columnWrapperStyle={styles.columnWrapperStyle}
numColumns={3}
keyExtractor={(item) => item.id}
renderItem={_renderItem}
showsVerticalScrollIndicator={false}
+ ListFooterComponent={() => (
+ <>
+ <Text style={styles.otherGroups}>Other Groups</Text>
+ <SearchCategories darkStyle={true} />
+ </>
+ )}
/>
<TabsGradient />
</SafeAreaView>
@@ -67,6 +150,7 @@ const styles = StyleSheet.create({
},
scrollView: {
top: HeaderHeight,
+ marginTop: '10%',
width: SCREEN_WIDTH * 0.95,
height: SCREEN_HEIGHT - HeaderHeight,
alignSelf: 'center',
@@ -83,6 +167,19 @@ const styles = StyleSheet.create({
width: SCREEN_WIDTH * 0.95,
paddingBottom: SCREEN_HEIGHT * 0.2,
},
+ otherGroups: {
+ color: 'white',
+ fontSize: normalize(18),
+ fontWeight: '600',
+ lineHeight: normalize(35),
+ alignSelf: 'center',
+ marginTop: 20,
+ },
+ shuffleIcon: {
+ width: 40,
+ height: 40,
+ marginRight: 20,
+ },
});
export default DiscoverUsers;
diff --git a/src/screens/search/SearchScreen.tsx b/src/screens/search/SearchScreen.tsx
index 59b17f57..65ec3934 100644
--- a/src/screens/search/SearchScreen.tsx
+++ b/src/screens/search/SearchScreen.tsx
@@ -17,13 +17,18 @@ import {SEARCH_ENDPOINT, TAGG_LIGHT_BLUE} from '../../constants';
import {loadSearchResults} from '../../services';
import {resetScreenType} from '../../store/actions';
import {RootState} from '../../store/rootReducer';
-import {ProfilePreviewType, ScreenType, CategoryPreviewType} from '../../types';
import {
+ CategoryPreviewType,
+ ProfilePreviewType,
+ ScreenType,
+ SearchCategoryType,
+} from '../../types';
+import {
+ getRecentlySearchedCategories,
+ getRecentlySearchedUsers,
normalize,
SCREEN_HEIGHT,
SCREEN_WIDTH,
- getRecentlySearchedCategories,
- getRecentlySearchedUsers,
} from '../../utils';
/**
@@ -43,6 +48,11 @@ const SearchScreen: React.FC = () => {
>([]);
const [searching, setSearching] = useState(false);
const top = Animated.useValue(-SCREEN_HEIGHT);
+ const defaultButtons: SearchCategoryType[] = [21, 22, 23, 24].map((year) => ({
+ id: -1,
+ name: `Brown '${year}`,
+ category: 'Brown',
+ }));
const [keyboardVisible, setKeyboardVisible] = React.useState(
'keyboardVisible',
);
@@ -63,7 +73,9 @@ const SearchScreen: React.FC = () => {
* Main handler for changes in query.
*/
useEffect(() => {
- if (!searching) return;
+ if (!searching) {
+ return;
+ }
if (query.length < 3) {
loadRecentlySearched().then(() => setResults(undefined));
return;
@@ -175,7 +187,7 @@ const SearchScreen: React.FC = () => {
stickyHeaderIndices={[4]}
contentContainerStyle={styles.contentContainer}
showsVerticalScrollIndicator={false}>
- <SearchCategories />
+ <SearchCategories defaultButtons={defaultButtons} />
<SearchResultsBackground {...{top}}>
{results === undefined &&
recents.length + recentCategories.length !== 0 ? (
diff --git a/src/services/ExploreService.ts b/src/services/ExploreService.ts
index 9b0b4f71..07af91ad 100644
--- a/src/services/ExploreService.ts
+++ b/src/services/ExploreService.ts
@@ -68,13 +68,10 @@ export const getAllExploreSections = async () => {
}
};
-export const getDiscoverUsers = async (id: number, category_type: string) => {
+export const getDiscoverUsers = async (categoryName: string) => {
try {
const token = await AsyncStorage.getItem('token');
- let url = DISCOVER_ENDPOINT + `${id}/`;
- if (category_type === 'badges') {
- url += '?type=badge';
- }
+ const url = `${DISCOVER_ENDPOINT}get_users/?category=${categoryName}`;
const response = await fetch(url, {
method: 'GET',
headers: {
@@ -82,31 +79,36 @@ export const getDiscoverUsers = async (id: number, category_type: string) => {
},
});
if (response.status !== 200) {
- return EMPTY_PROFILE_PREVIEW_LIST;
+ return undefined;
}
- const data = await response.json();
- const users: ProfilePreviewType[] = data.users;
+ const users: ProfilePreviewType[] = await response.json();
return users;
} catch (error) {
console.log('Error fetching SP user data');
console.log(error);
- return [];
+ return undefined;
}
};
-export const getButtons = async () => {
- const token = await AsyncStorage.getItem('token');
- const response = await fetch(SEARCH_BUTTONS_ENDPOPINT, {
- method: 'GET',
- headers: {
- Authorization: 'Token ' + token,
- },
- });
+export const getSuggestedSearchBubbleSuggestions = async () => {
+ try {
+ const token = await AsyncStorage.getItem('token');
+ const response = await fetch(SEARCH_BUTTONS_ENDPOPINT, {
+ method: 'GET',
+ headers: {
+ Authorization: 'Token ' + token,
+ },
+ });
+
+ if (response.status !== 200) {
+ return undefined;
+ }
- if (response.status !== 200) {
- return [];
+ const data: SearchCategoryType[] = await response.json();
+ return data;
+ } catch (error) {
+ console.log('Error fetching suggested search bubble suggestions');
+ console.log(error);
+ return undefined;
}
-
- const data: SearchCategoryType[] = await response.json();
- return data;
};
diff --git a/src/store/actions/taggUsers.ts b/src/store/actions/taggUsers.ts
index 7b6d4d5e..72ce848b 100644
--- a/src/store/actions/taggUsers.ts
+++ b/src/store/actions/taggUsers.ts
@@ -11,10 +11,10 @@ export const loadRecentlySearched = (): ThunkAction<
> => async (dispatch) => {
try {
const recentSearches = await loadRecentlySearchedUsers();
- const exploreSections = await getAllExploreSections();
+ getAllExploreSections();
dispatch({
type: taggUsersFetched.type,
- payload: {recentSearches, explores: exploreSections},
+ payload: {recentSearches},
});
} catch (error) {
console.log(error);
diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts
index 1a3db433..b43e4a1d 100644
--- a/src/store/initialStates.ts
+++ b/src/store/initialStates.ts
@@ -69,22 +69,8 @@ export const NO_SOCIAL_ACCOUNTS: Record<string, SocialAccountType> = {
Twitter: {posts: []},
};
-export const EMPTY_EXPLORE_SECTIONS: Record<
- ExploreSectionType,
- ProfilePreviewType[]
-> = {
- 'People You May Know': EMPTY_PROFILE_PREVIEW_LIST,
- 'New to Tagg': EMPTY_PROFILE_PREVIEW_LIST,
- 'Trending on Tagg': EMPTY_PROFILE_PREVIEW_LIST,
- "Brown '21": EMPTY_PROFILE_PREVIEW_LIST,
- "Brown '22": EMPTY_PROFILE_PREVIEW_LIST,
- "Brown '23": EMPTY_PROFILE_PREVIEW_LIST,
- "Brown '24": EMPTY_PROFILE_PREVIEW_LIST,
-};
-
export const NO_TAGG_USERS = {
recentSearches: EMPTY_PROFILE_PREVIEW_LIST,
- explores: EMPTY_EXPLORE_SECTIONS,
};
export const NO_SOCIALS = {
diff --git a/src/store/reducers/taggUsersReducer.ts b/src/store/reducers/taggUsersReducer.ts
index 33e2e18d..92973101 100644
--- a/src/store/reducers/taggUsersReducer.ts
+++ b/src/store/reducers/taggUsersReducer.ts
@@ -7,7 +7,6 @@ const taggUsersSlice = createSlice({
reducers: {
taggUsersFetched: (state, action) => {
state.recentSearches = action.payload.recentSearches;
- state.explores = action.payload.explores;
},
},
});
diff --git a/src/utils/common.ts b/src/utils/common.ts
index 30122e79..c1049c42 100644
--- a/src/utils/common.ts
+++ b/src/utils/common.ts
@@ -94,3 +94,24 @@ export const haveUnreadNotifications = async (
}
return false;
};
+
+// https://stackoverflow.com/a/2450976
+export const shuffle = (array: any[]) => {
+ var currentIndex = array.length,
+ temporaryValue,
+ randomIndex;
+
+ // While there remain elements to shuffle...
+ while (currentIndex !== 0) {
+ // Pick a remaining element...
+ randomIndex = Math.floor(Math.random() * currentIndex);
+ currentIndex -= 1;
+
+ // And swap it with the current element.
+ temporaryValue = array[currentIndex];
+ array[currentIndex] = array[randomIndex];
+ array[randomIndex] = temporaryValue;
+ }
+
+ return array;
+};