From 080e76350c2570eeb096fad40fe95f1b766b4539 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Mon, 11 Jan 2021 16:11:11 -0500 Subject: created strings.ts and linting --- src/components/moments/Moment.tsx | 24 ++++++++---------------- src/components/onboarding/LinkSocialMedia.tsx | 5 +++-- src/components/profile/Content.tsx | 2 +- src/components/profile/MomentMoreInfoDrawer.tsx | 7 +++---- src/components/profile/ProfilePreview.tsx | 3 ++- src/components/taggs/Tagg.tsx | 17 ++++++++++++----- 6 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src/components') 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 = ({ externalStyles, }) => { const navigation = useNavigation(); - const dispatch = useDispatch(); const navigateToImagePicker = () => { ImagePicker.openPicker({ @@ -77,7 +69,7 @@ const Moment: React.FC = ({ }) .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 = ({ 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 = ({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 = (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 = (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 = ({ //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 = ({ 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 = ({ 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 = ({ 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 = ({ 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); } }; -- cgit v1.2.3-70-g09d2 From cc52dabaaf529763e9c1c4683ba94ed55c5671a8 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 15 Jan 2021 14:35:06 -0500 Subject: updated some strings --- src/components/moments/Moment.tsx | 4 +- src/constants/strings.ts | 51 +++++++++++----------- .../onboarding/InvitationCodeVerification.tsx | 4 +- src/screens/onboarding/ProfileOnboarding.tsx | 4 +- src/services/UserProfileService.ts | 4 +- 5 files changed, 34 insertions(+), 33 deletions(-) (limited to 'src/components') diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 56093d65..7905e8a9 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -12,7 +12,7 @@ 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 {ERROR_UPLOAD_MOMENT_SHORT} from '../../constants/strings'; import {SCREEN_WIDTH} from '../../utils'; import MomentTile from './MomentTile'; @@ -69,7 +69,7 @@ const Moment: React.FC = ({ }) .catch((err) => { if (err.code && err.code !== 'E_PICKER_CANCELLED') { - Alert.alert(ERROR_UPLOAD_MOMENT); + Alert.alert(ERROR_UPLOAD_MOMENT_SHORT); } }); }; diff --git a/src/constants/strings.ts b/src/constants/strings.ts index 3b9b6dad..b5344afd 100644 --- a/src/constants/strings.ts +++ b/src/constants/strings.ts @@ -1,46 +1,47 @@ /* eslint-disable */ // Below is the regex to convert this into a csv for the Google Sheet // export const (.*) = .*?(['|"|`])(.*)\2; +// replace with: $1\t$3 export const COMING_SOON_MSG = 'Creating more fun things for you, surprises coming soon πŸ˜‰'; export const ERROR_AUTHENTICATION = 'An error occurred during authentication. Please login again!'; -export const ERROR_CATEGORY_CREATION = 'There was a problem creating categories!'; -export const ERROR_CATEGORY_UPDATE = 'There was a problem updating categories!'; -export const ERROR_DELETE_CATEGORY = 'There was a problem while deleting category!'; -export const ERROR_DELETE_MOMENT = 'We were unable to delete that moment 😭 , please try again later!'; +export const ERROR_CATEGORY_CREATION = 'There was a problem creating your categories. Please refresh and try again.'; +export const ERROR_CATEGORY_UPDATE = 'There was a problem updating your categories. Please refresh and try again'; +export const ERROR_DELETE_CATEGORY = 'There was a problem while deleting category. Please try again'; +export const ERROR_DELETE_MOMENT = 'Unable to delete moment, please try again later!'; export const ERROR_DOUBLE_CHECK_CONNECTION = 'Please double-check your network connection and retry'; -export const ERROR_DUP_OLD_PWD = 'You may not use an already used password'; +export const ERROR_DUP_OLD_PWD = 'You may not use a previously used password'; export const ERROR_EMAIL_IN_USE = 'Email already in use, please try another one'; export const ERROR_FAILED_LOGIN_INFO = 'Login failed, please try re-entering your login information'; export const ERROR_FAILED_TO_COMMENT = 'Unable to post comment, refresh and try again!'; export const ERROR_INVALID_INVITATION_CODE = 'Invitation code invalid, try again or talk to the friend that sent it 😬'; export const ERROR_INVALID_LOGIN = 'Invalid login, Please login again'; -export const ERROR_INVALID_PWD_CODE = 'Looks like you have entered the wrong code'; -export const ERROR_INVALID_VERIFICATION_CODE = 'Invalid verification code, try again. πŸ€” Tap the resend code button to get a new one'; -export const ERROR_INVALID_VERIFICATION_CODE_FORMAT = 'Please enter a valid 6 digit code'; +export const ERROR_INVALID_PWD_CODE = 'Looks like you have entered the wrong code, please try again'; +export const ERROR_INVALID_VERIFICATION_CODE = 'Invalid verification code, try re-entering or tap the resend code button for a new code'; +export const ERROR_INVALID_VERIFICATION_CODE_FORMAT = 'Please enter the 6 digit code sent to your phone'; export const ERROR_INVLAID_CODE = 'The code entered is not valid!'; -export const ERROR_LINK = (str: string) => `Something went wrong, we can\'t link with ${str}, Please refresh and try again`; -export const ERROR_LOGIN = 'There was a problem logging you in, please refresh and try again '; -export const ERROR_LOGIN_FAILED = 'Login failed πŸ˜“'; -export const ERROR_NEXT_PAGE = 'There was a problem while loading the next page πŸ˜“, try again in a couple minutes. Were sorry for the inconvenience.'; -export const ERROR_PROFILE_CREATION = 'Profile creation failed πŸ˜“'; +export const ERROR_LINK = (str: string) => `Unable to link with ${str}, Please check your login and try again`; +export const ERROR_LOGIN = 'There was a problem logging you in, please refresh and try again'; +export const ERROR_LOGIN_FAILED = 'Login failed. Check your username and passoword, and try again'; +export const ERROR_NEXT_PAGE = 'There was a problem while loading the next page πŸ˜“, try again in a couple minutes'; +export const ERROR_PROFILE_CREATION_SHORT = 'Profile creation failed πŸ˜“'; export const ERROR_PWD_ACCOUNT = (str: string) => `Please make sure that the email / username entered is registered with us. You may contact our customer support at ${str}`; export const ERROR_REGISTRATION = (str: string) => `Registration failed πŸ˜”, ${str}`; -export const ERROR_SELECT_CLASS_YEAR = 'Please select Class Year'; +export const ERROR_SELECT_CLASS_YEAR = 'Please select your Class Year'; export const ERROR_SERVER_DOWN = 'mhm, looks like our servers are down, please refresh and try again in a few mins'; -export const ERROR_SOMETHING_WENT_WRONG = "Something went wrong! We don't know what happened... Please give it another try"; +export const ERROR_SOMETHING_WENT_WRONG = "Oh dear, don’t worry someone will be held responsible for this error, In the meantime refresh the app"; export const ERROR_SOMETHING_WENT_WRONG_REFRESH = "Ha, looks like this one's on us, please refresh and try again"; export const ERROR_SOMETHING_WENT_WRONG_RELOAD = "You broke it, Just kidding! we don't know what happened... Please reload the app and try again"; -export const ERROR_UNABLE_TO_FIND_PROFILE = 'We were unable to find this profile πŸ˜”'; -export const ERROR_UNABLE_TO_VIEW_PROFILE = 'You cannot view this profile'; +export const ERROR_UNABLE_TO_FIND_PROFILE = 'We were unable to find this profile. Please check username and try again'; +export const ERROR_UNABLE_TO_VIEW_PROFILE = 'Unable to view this profile'; export const ERROR_UPLOAD = 'An error occurred while uploading. Please try again!'; -export const ERROR_UPLOAD_LARGE_PROFILE_PIC = 'Cant have the first image seen on the profile be blank, please upload a large picture '; -export const ERROR_UPLOAD_MOMENT = 'Unable to upload moment!'; -export const ERROR_UPLOAD_SMALL_PROFILE_PIC = 'Cant have a profile without a pic to represent you, please upload a small profile picture '; -export const ERROR_VERIFICATION_FAILED = 'Verification failed πŸ˜“'; +export const ERROR_UPLOAD_LARGE_PROFILE_PIC = "Can't have the first image seen on the profile be blank, please upload a large picture"; +export const ERROR_UPLOAD_MOMENT = 'Unable to upload moment. Please retry'; +export const ERROR_UPLOAD_SMALL_PROFILE_PIC = "Can't have a profile without a pic to represent you, please upload a small profile picture"; +export const ERROR_VERIFICATION_FAILED_SHORT = 'Verification failed πŸ˜“'; export const MARKED_AS_MSG = (str: string) => `Marked as ${str}`; -export const MOMENT_DELETED_MSG = 'Moment deleted!'; -export const SUCCESS_CATEGORY_DELETE = 'The category was successfully deleted!'; +export const MOMENT_DELETED_MSG = 'Moment deleted....Some moments have to go, to create space for greater ones'; +export const SUCCESS_CATEGORY_DELETE = 'Category successfully deleted, but its memory will live on'; export const SUCCESS_LINK = (str: string) => `Successfully linked ${str} πŸŽ‰`; -export const SUCCESS_PIC_UPLOAD = 'The picture was uploaded successfully!'; -export const SUCCESS_PWD_RESET = 'Your password was reset successfully'; +export const SUCCESS_PIC_UPLOAD = 'Beautiful, the picture was uploaded successfully!'; +export const SUCCESS_PWD_RESET = 'Your password was reset successfully!'; export const SUCCESS_VERIFICATION_CODE_SENT = 'New verification code sent! Check your phone messages for your code'; diff --git a/src/screens/onboarding/InvitationCodeVerification.tsx b/src/screens/onboarding/InvitationCodeVerification.tsx index 875523d3..903a9912 100644 --- a/src/screens/onboarding/InvitationCodeVerification.tsx +++ b/src/screens/onboarding/InvitationCodeVerification.tsx @@ -35,7 +35,7 @@ import { ERROR_DOUBLE_CHECK_CONNECTION, ERROR_INVALID_INVITATION_CODE, ERROR_INVLAID_CODE, - ERROR_VERIFICATION_FAILED, + ERROR_VERIFICATION_FAILED_SHORT, } from '../../constants/strings'; type InvitationCodeVerificationScreenNavigationProp = StackNavigationProp< @@ -78,7 +78,7 @@ const InvitationCodeVerification: React.FC = ({ Alert.alert(ERROR_INVALID_INVITATION_CODE); } } catch (error) { - Alert.alert(ERROR_VERIFICATION_FAILED, ERROR_DOUBLE_CHECK_CONNECTION); + Alert.alert(ERROR_VERIFICATION_FAILED_SHORT, ERROR_DOUBLE_CHECK_CONNECTION); return { name: 'Verification error', description: error, diff --git a/src/screens/onboarding/ProfileOnboarding.tsx b/src/screens/onboarding/ProfileOnboarding.tsx index d0a63a23..127cd9cd 100644 --- a/src/screens/onboarding/ProfileOnboarding.tsx +++ b/src/screens/onboarding/ProfileOnboarding.tsx @@ -34,7 +34,7 @@ import Animated from 'react-native-reanimated'; import {SCREEN_WIDTH} from '../../utils'; import { ERROR_DOUBLE_CHECK_CONNECTION, - ERROR_PROFILE_CREATION, + ERROR_PROFILE_CREATION_SHORT, ERROR_SELECT_CLASS_YEAR, ERROR_SOMETHING_WENT_WRONG_REFRESH, ERROR_UPLOAD_LARGE_PROFILE_PIC, @@ -374,7 +374,7 @@ const ProfileOnboarding: React.FC = ({ Alert.alert(ERROR_SOMETHING_WENT_WRONG_REFRESH); } } catch (error) { - Alert.alert(ERROR_PROFILE_CREATION, ERROR_DOUBLE_CHECK_CONNECTION); + Alert.alert(ERROR_PROFILE_CREATION_SHORT, ERROR_DOUBLE_CHECK_CONNECTION); return { name: 'Profile creation error', description: error, diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index 830fbbb9..37d00659 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -24,7 +24,7 @@ import { ERROR_PWD_ACCOUNT, ERROR_SOMETHING_WENT_WRONG, ERROR_SOMETHING_WENT_WRONG_REFRESH, - ERROR_VERIFICATION_FAILED, + ERROR_VERIFICATION_FAILED_SHORT, SUCCESS_PWD_RESET, SUCCESS_VERIFICATION_CODE_SENT, } from '../constants/strings'; @@ -291,7 +291,7 @@ export const verifyOtp = async (phone: string, otp: string) => { } } } catch (error) { - Alert.alert(ERROR_VERIFICATION_FAILED, ERROR_DOUBLE_CHECK_CONNECTION); + Alert.alert(ERROR_VERIFICATION_FAILED_SHORT, ERROR_DOUBLE_CHECK_CONNECTION); return { name: 'Verification error', description: error, -- cgit v1.2.3-70-g09d2