From 8e4d48807f06e82e795bee7256667954958e0e15 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 3 Jun 2021 17:31:28 -0400 Subject: Remove white ring --- src/components/taggs/Tagg.tsx | 56 +++++---------------------------------- src/components/taggs/TaggsBar.tsx | 2 -- 2 files changed, 6 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx index 4a58bacb..0e0311c5 100644 --- a/src/components/taggs/Tagg.tsx +++ b/src/components/taggs/Tagg.tsx @@ -5,13 +5,8 @@ import {useSelector} from 'react-redux'; import PurpleRingPlus from '../../assets/icons/purple_ring+.svg'; import PurpleRing from '../../assets/icons/purple_ring.svg'; import RingPlus from '../../assets/icons/ring+.svg'; -import WhiteRing from '../../assets/icons/ring-white.svg'; import Ring from '../../assets/icons/ring.svg'; -import { - INTEGRATED_SOCIAL_LIST, - SOCIAL_ICON_SIZE_ADJUSTMENT, - TAGG_RING_DIM, -} from '../../constants'; +import {INTEGRATED_SOCIAL_LIST, TAGG_RING_DIM} from '../../constants'; import { ERROR_LINK, ERROR_UNABLE_TO_FIND_PROFILE, @@ -24,8 +19,8 @@ import { } from '../../services'; import {RootState} from '../../store/rootReducer'; import {ScreenType, UserType} from '../../types'; -import {canViewProfile, normalize} from '../../utils'; -import {SmallSocialIcon, SocialIcon, SocialLinkModal} from '../common'; +import {canViewProfile} from '../../utils'; +import {SocialIcon, SocialLinkModal} from '../common'; interface TaggProps { social: string; @@ -35,7 +30,6 @@ interface TaggProps { setSocialDataNeedUpdate: (social: string, username: string) => void; userXId: string | undefined; user: UserType; - whiteRing: boolean | undefined; screenType: ScreenType; } @@ -48,7 +42,6 @@ const Tagg: React.FC = ({ userXId, screenType, user, - whiteRing, }) => { const navigation = useNavigation(); const state = useSelector((s: RootState) => s); @@ -107,9 +100,6 @@ const Tagg: React.FC = ({ const pickTheRightRingHere = () => { if (youMayPass) { - if (whiteRing) { - return ; - } if (social === 'Tagg') { return ; } else { @@ -139,7 +129,7 @@ const Tagg: React.FC = ({ return ( <> - {(userXId && !isLinked) || (whiteRing && !userXId) ? ( + {userXId && !isLinked ? ( ) : ( <> @@ -149,27 +139,13 @@ const Tagg: React.FC = ({ setModalVisible={setModalVisible} completionCallback={linkNonIntegratedSocial} /> - + {pickTheRightRingHere()} - {!whiteRing && ( - - - - )} )} @@ -178,19 +154,10 @@ const Tagg: React.FC = ({ }; const styles = StyleSheet.create({ - spcontainer: { - justifyContent: 'space-between', - alignItems: 'center', - marginRight: 15, - marginLeft: 19, - height: normalize(60), - }, container: { justifyContent: 'space-between', alignItems: 'center', - marginRight: 15, - marginLeft: 15, - height: normalize(90), + marginHorizontal: 15, }, iconTap: { justifyContent: 'center', @@ -202,17 +169,6 @@ const styles = StyleSheet.create({ borderRadius: 30, position: 'absolute', }, - smallIconContainer: { - height: 20, - width: 20, - position: 'absolute', - justifyContent: 'center', - alignItems: 'center', - bottom: 0, - }, - smallIcon: { - borderRadius: 1000, - }, }); export default Tagg; diff --git a/src/components/taggs/TaggsBar.tsx b/src/components/taggs/TaggsBar.tsx index a7e8fc7a..7076ffaf 100644 --- a/src/components/taggs/TaggsBar.tsx +++ b/src/components/taggs/TaggsBar.tsx @@ -82,7 +82,6 @@ const TaggsBar: React.FC = ({ isIntegrated={INTEGRATED_SOCIAL_LIST.indexOf(social) !== -1} setTaggsNeedUpdate={setTaggsNeedUpdate} setSocialDataNeedUpdate={handleSocialUpdate} - whiteRing={false} />, ); i++; @@ -100,7 +99,6 @@ const TaggsBar: React.FC = ({ userXId={userXId} screenType={screenType} user={user} - whiteRing={false} />, ); i++; -- cgit v1.2.3-70-g09d2 From b19ce79cc40be0062780c925599e3f29e5df3fb3 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 3 Jun 2021 17:33:38 -0400 Subject: Move code to legacy --- src/components/suggestedPeople/SPTaggsBar.tsx | 130 --------------------- src/components/suggestedPeople/index.ts | 1 - .../suggestedPeople/legacy/SPTaggsBar.tsx | 128 ++++++++++++++++++++ 3 files changed, 128 insertions(+), 131 deletions(-) delete mode 100644 src/components/suggestedPeople/SPTaggsBar.tsx create mode 100644 src/components/suggestedPeople/legacy/SPTaggsBar.tsx (limited to 'src') diff --git a/src/components/suggestedPeople/SPTaggsBar.tsx b/src/components/suggestedPeople/SPTaggsBar.tsx deleted file mode 100644 index 3ab33da1..00000000 --- a/src/components/suggestedPeople/SPTaggsBar.tsx +++ /dev/null @@ -1,130 +0,0 @@ -import React, {useEffect, useState} from 'react'; -import {StyleSheet} from 'react-native'; -import Animated from 'react-native-reanimated'; -import {useDispatch, useSelector} from 'react-redux'; -import {INTEGRATED_SOCIAL_LIST, SOCIAL_LIST} from '../../constants'; -import {getLinkedSocials} from '../../services'; -import {loadIndividualSocial, updateSocial} from '../../store/actions'; -import {RootState} from '../../store/rootReducer'; -import {ScreenType} from '../../types'; -import Tagg from '../taggs/Tagg'; - -const {View, ScrollView} = Animated; -interface TaggsBarProps { - userXId: string | undefined; - screenType: ScreenType; - linkedSocials?: string[]; -} -const TaggsBar: React.FC = ({ - userXId, - screenType, - linkedSocials, -}) => { - let [taggs, setTaggs] = useState([]); - let [taggsNeedUpdate, setTaggsNeedUpdate] = useState(true); - const {user} = useSelector((state: RootState) => - userXId ? state.userX[screenType][userXId] : state.user, - ); - - const dispatch = useDispatch(); - - /** - * Updates the individual social that needs update - * If username is empty, update nonintegrated socials like Snapchat and TikTok - * @param socialType Type of the social that needs update - */ - const handleSocialUpdate = (socialType: string, username: string) => { - if (username !== '') { - dispatch(updateSocial(socialType, username)); - } else { - dispatch(loadIndividualSocial(user.userId, socialType)); - } - }; - - /** - * This useEffect should be called evey time the user being viewed is changed OR - * And update is triggered manually - */ - useEffect(() => { - const loadData = async () => { - const socials: string[] = linkedSocials - ? linkedSocials - : await getLinkedSocials(user.userId); - const unlinkedSocials = SOCIAL_LIST.filter( - (s) => socials.indexOf(s) === -1, - ); - let new_taggs = []; - let i = 0; - for (let social of socials) { - new_taggs.push( - , - ); - i++; - } - if (!userXId) { - for (let social of unlinkedSocials) { - new_taggs.push( - , - ); - i++; - } - } - setTaggs(new_taggs); - setTaggsNeedUpdate(false); - }; - if (user.userId) { - loadData(); - } - }, [taggsNeedUpdate, user]); - - return taggs.length > 0 ? ( - - - {taggs} - - - ) : ( - <> - ); -}; - -const styles = StyleSheet.create({ - spContainer: { - shadowColor: '#000', - shadowRadius: 10, - shadowOffset: {width: 0, height: 2}, - zIndex: 1, - marginBottom: 25, - }, - contentContainer: { - alignItems: 'center', - paddingBottom: 5, - }, -}); - -export default TaggsBar; diff --git a/src/components/suggestedPeople/index.ts b/src/components/suggestedPeople/index.ts index 34bb96d4..ecdf4f35 100644 --- a/src/components/suggestedPeople/index.ts +++ b/src/components/suggestedPeople/index.ts @@ -1,3 +1,2 @@ export {default as MutualFriends} from './MutualFriends'; -export {default as SPTaggsBar} from './SPTaggsBar'; export {default as BadgeIcon} from './BadgeIcon'; diff --git a/src/components/suggestedPeople/legacy/SPTaggsBar.tsx b/src/components/suggestedPeople/legacy/SPTaggsBar.tsx new file mode 100644 index 00000000..3273f88d --- /dev/null +++ b/src/components/suggestedPeople/legacy/SPTaggsBar.tsx @@ -0,0 +1,128 @@ +import React, {useEffect, useState} from 'react'; +import {StyleSheet} from 'react-native'; +import Animated from 'react-native-reanimated'; +import {useDispatch, useSelector} from 'react-redux'; +import {INTEGRATED_SOCIAL_LIST, SOCIAL_LIST} from '../../../constants'; +import {getLinkedSocials} from '../../../services'; +import {loadIndividualSocial, updateSocial} from '../../../store/actions'; +import {RootState} from '../../../store/rootReducer'; +import {ScreenType} from '../../../types'; +import Tagg from '../../taggs/Tagg'; + +const {View, ScrollView} = Animated; +interface TaggsBarProps { + userXId: string | undefined; + screenType: ScreenType; + linkedSocials?: string[]; +} +const TaggsBar: React.FC = ({ + userXId, + screenType, + linkedSocials, +}) => { + let [taggs, setTaggs] = useState([]); + let [taggsNeedUpdate, setTaggsNeedUpdate] = useState(true); + const {user} = useSelector((state: RootState) => + userXId ? state.userX[screenType][userXId] : state.user, + ); + + const dispatch = useDispatch(); + + /** + * Updates the individual social that needs update + * If username is empty, update nonintegrated socials like Snapchat and TikTok + * @param socialType Type of the social that needs update + */ + const handleSocialUpdate = (socialType: string, username: string) => { + if (username !== '') { + dispatch(updateSocial(socialType, username)); + } else { + dispatch(loadIndividualSocial(user.userId, socialType)); + } + }; + + /** + * This useEffect should be called evey time the user being viewed is changed OR + * And update is triggered manually + */ + useEffect(() => { + const loadData = async () => { + const socials: string[] = linkedSocials + ? linkedSocials + : await getLinkedSocials(user.userId); + const unlinkedSocials = SOCIAL_LIST.filter( + (s) => socials.indexOf(s) === -1, + ); + let new_taggs = []; + let i = 0; + for (let social of socials) { + new_taggs.push( + , + ); + i++; + } + if (!userXId) { + for (let social of unlinkedSocials) { + new_taggs.push( + , + ); + i++; + } + } + setTaggs(new_taggs); + setTaggsNeedUpdate(false); + }; + if (user.userId) { + loadData(); + } + }, [taggsNeedUpdate, user]); + + return taggs.length > 0 ? ( + + + {taggs} + + + ) : ( + <> + ); +}; + +const styles = StyleSheet.create({ + spContainer: { + shadowColor: '#000', + shadowRadius: 10, + shadowOffset: {width: 0, height: 2}, + zIndex: 1, + marginBottom: 25, + }, + contentContainer: { + alignItems: 'center', + paddingBottom: 5, + }, +}); + +export default TaggsBar; -- cgit v1.2.3-70-g09d2