diff options
author | Ivan Chen <ivan@tagg.id> | 2021-01-11 16:11:11 -0500 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-01-15 14:19:50 -0500 |
commit | 080e76350c2570eeb096fad40fe95f1b766b4539 (patch) | |
tree | bcb9f73f2c192f8c34f2064a5c3fd003756c2823 /src/components | |
parent | 1dccfb1d3e9470d81de8d1ec0a0dbb3803372f7d (diff) |
created strings.ts and linting
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/moments/Moment.tsx | 24 | ||||
-rw-r--r-- | src/components/onboarding/LinkSocialMedia.tsx | 5 | ||||
-rw-r--r-- | src/components/profile/Content.tsx | 2 | ||||
-rw-r--r-- | src/components/profile/MomentMoreInfoDrawer.tsx | 7 | ||||
-rw-r--r-- | src/components/profile/ProfilePreview.tsx | 3 | ||||
-rw-r--r-- | src/components/taggs/Tagg.tsx | 17 |
6 files changed, 29 insertions, 29 deletions
diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 6dbcd170..56093d65 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -1,27 +1,20 @@ import {useNavigation} from '@react-navigation/native'; import React, {Fragment} from 'react'; -import { - Alert, - StyleProp, - StyleSheet, - View, - ViewProps, - ViewStyle, -} from 'react-native'; +import {Alert, StyleProp, StyleSheet, View, ViewStyle} from 'react-native'; import {Text} from 'react-native-animatable'; import {ScrollView, TouchableOpacity} from 'react-native-gesture-handler'; +import ImagePicker from 'react-native-image-crop-picker'; import LinearGradient from 'react-native-linear-gradient'; -import PlusIcon from '../../assets/icons/plus_icon-01.svg'; -import UpIcon from '../../assets/icons/up_icon.svg'; -import DownIcon from '../../assets/icons/down_icon.svg'; +import {MomentType, ScreenType} from 'src/types'; import DeleteIcon from '../../assets/icons/delete-logo.svg'; +import DownIcon from '../../assets/icons/down_icon.svg'; +import PlusIcon from '../../assets/icons/plus_icon-01.svg'; import BigPlusIcon from '../../assets/icons/plus_icon-02.svg'; +import UpIcon from '../../assets/icons/up_icon.svg'; import {TAGG_TEXT_LIGHT_BLUE} from '../../constants'; +import {ERROR_UPLOAD_MOMENT} from '../../constants/strings'; import {SCREEN_WIDTH} from '../../utils'; -import ImagePicker from 'react-native-image-crop-picker'; import MomentTile from './MomentTile'; -import {MomentType, ScreenType} from 'src/types'; -import {useDispatch} from 'react-redux'; interface MomentProps { title: string; @@ -49,7 +42,6 @@ const Moment: React.FC<MomentProps> = ({ externalStyles, }) => { const navigation = useNavigation(); - const dispatch = useDispatch(); const navigateToImagePicker = () => { ImagePicker.openPicker({ @@ -77,7 +69,7 @@ const Moment: React.FC<MomentProps> = ({ }) .catch((err) => { if (err.code && err.code !== 'E_PICKER_CANCELLED') { - Alert.alert('Unable to upload moment!'); + Alert.alert(ERROR_UPLOAD_MOMENT); } }); }; diff --git a/src/components/onboarding/LinkSocialMedia.tsx b/src/components/onboarding/LinkSocialMedia.tsx index c7b0a6b4..6cb7e9cf 100644 --- a/src/components/onboarding/LinkSocialMedia.tsx +++ b/src/components/onboarding/LinkSocialMedia.tsx @@ -13,6 +13,7 @@ import { SOCIAL_FONT_COLORS, TAGG_ICON_DIM, } from '../../constants/constants'; +import {ERROR_LINK, SUCCESS_LINK} from '../../constants/strings'; import { handlePressForAuthBrowser, registerNonIntegratedSocialLink, @@ -64,12 +65,12 @@ const SocialMediaLinker: React.FC<SocialMediaLinkerProps> = ({ const linkNonIntegratedSocial = async (username: string) => { if (await registerNonIntegratedSocialLink(label, username)) { - Alert.alert(`Successfully linked ${label} 🎉`); + Alert.alert(SUCCESS_LINK(label)); setAuthenticated(true); } else { // If we display too fast the alert will get dismissed with the modal setTimeout(() => { - Alert.alert(`Something went wrong, we can't link with ${label} 😔`); + Alert.alert(ERROR_LINK(label)); }, 500); } }; diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index 1d639a41..50516b55 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -296,7 +296,7 @@ const Content: React.FC<ContentProps> = ({y, userXId, screenType}) => { momentCategories.filter((mc) => mc !== category), false, ), - ); + ) dispatch(deleteUserMomentsForCategory(category)); }, }, diff --git a/src/components/profile/MomentMoreInfoDrawer.tsx b/src/components/profile/MomentMoreInfoDrawer.tsx index e127e05c..77c349ca 100644 --- a/src/components/profile/MomentMoreInfoDrawer.tsx +++ b/src/components/profile/MomentMoreInfoDrawer.tsx @@ -1,6 +1,7 @@ import React from 'react'; import {Alert, StyleSheet, TouchableOpacity, ViewProps} from 'react-native'; import MoreIcon from '../../assets/icons/more_horiz-24px.svg'; +import {ERROR_DELETE_MOMENT, MOMENT_DELETED_MSG} from '../../constants/strings'; import {deleteMoment, sendReport} from '../../services'; import {GenericMoreInfoDrawer} from '../common'; @@ -21,7 +22,7 @@ const MomentMoreInfoDrawer: React.FC<MomentMoreInfoDrawerProps> = (props) => { if (success) { // set time out for UI transitions setTimeout(() => { - Alert.alert('Moment deleted!', '', [ + Alert.alert(MOMENT_DELETED_MSG, '', [ { text: 'OK', onPress: () => dismissScreenAndUpdate(), @@ -31,9 +32,7 @@ const MomentMoreInfoDrawer: React.FC<MomentMoreInfoDrawerProps> = (props) => { }, 500); } else { setTimeout(() => { - Alert.alert( - 'We were unable to delete that moment 😠, please try again later!', - ); + Alert.alert(ERROR_DELETE_MOMENT); }, 500); } }); diff --git a/src/components/profile/ProfilePreview.tsx b/src/components/profile/ProfilePreview.tsx index 134e94cd..23cb2155 100644 --- a/src/components/profile/ProfilePreview.tsx +++ b/src/components/profile/ProfilePreview.tsx @@ -21,6 +21,7 @@ import {logout} from '../../store/actions'; import {fetchUserX, userXInStore} from '../../utils'; import {SearchResultsBackground} from '../search'; import NavigationBar from 'src/routes/tabs'; +import {ERROR_UNABLE_TO_VIEW_PROFILE} from '../../constants/strings'; const NO_USER: UserType = { userId: '', @@ -96,7 +97,7 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ //If the logged in user is blocked by the user being viewed, do not proceed. const isUserBlocked = await checkIfUserIsBlocked(user.id); if (isUserBlocked) { - Alert.alert('You cannot view this profile'); + Alert.alert(ERROR_UNABLE_TO_VIEW_PROFILE); return; } const jsonValue = await AsyncStorage.getItem( diff --git a/src/components/taggs/Tagg.tsx b/src/components/taggs/Tagg.tsx index 12172df9..82ac07df 100644 --- a/src/components/taggs/Tagg.tsx +++ b/src/components/taggs/Tagg.tsx @@ -17,6 +17,11 @@ import { } from '../../services'; import {SmallSocialIcon, SocialIcon, SocialLinkModal} from '../common'; import {UserType} from '../../types'; +import { + ERROR_LINK, + ERROR_UNABLE_TO_FIND_PROFILE, + SUCCESS_LINK, +} from '../../constants/strings'; interface TaggProps { social: string; @@ -56,7 +61,7 @@ const Tagg: React.FC<TaggProps> = ({ show auth browser case !integrated_social: show modal - Tagg's "Tagg" will use the Ring instead of PurpleRing + Tagg's "Tagg" will use the Ring instead of PurpleRing */ const modalOrAuthBrowserOrPass = async () => { @@ -71,7 +76,7 @@ const Tagg: React.FC<TaggProps> = ({ if (socialURL) { Linking.openURL(socialURL); } else { - Alert.alert('We were unable to find this profile 😔'); + Alert.alert(ERROR_UNABLE_TO_FIND_PROFILE); } }); } @@ -79,7 +84,9 @@ const Tagg: React.FC<TaggProps> = ({ if (isIntegrated) { handlePressForAuthBrowser(social).then((success) => { setTaggsNeedUpdate(success); - if (success) setSocialDataNeedUpdate(social, ''); + if (success) { + setSocialDataNeedUpdate(social, ''); + } }); } else { setModalVisible(true); @@ -105,13 +112,13 @@ const Tagg: React.FC<TaggProps> = ({ const linkNonIntegratedSocial = async (username: string) => { if (await registerNonIntegratedSocialLink(social, username)) { - Alert.alert(`Successfully linked ${social} 🎉`); + Alert.alert(SUCCESS_LINK(social)); setTaggsNeedUpdate(true); setSocialDataNeedUpdate(social, username); } else { // If we display too fast the alert will get dismissed with the modal setTimeout(() => { - Alert.alert(`Something went wrong, we can't link with ${social} 😔`); + Alert.alert(ERROR_LINK(social)); }, 500); } }; |