diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-20 17:49:38 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-04-20 17:49:38 -0400 |
commit | c4e76811cae6cf14d5cc8daed9317f808087ed77 (patch) | |
tree | c162da11dcf70f565d20a9d69071f0cbb5b077b3 /src | |
parent | bae0136cb1939302b758249a1978251bd37aaee8 (diff) |
linted
Diffstat (limited to 'src')
-rw-r--r-- | src/components/common/AvatarTitle.tsx | 2 | ||||
-rw-r--r-- | src/components/common/TaggLoadingIndicator.tsx | 2 | ||||
-rw-r--r-- | src/components/suggestedPeople/SPTaggsBar.tsx | 3 | ||||
-rw-r--r-- | src/screens/badge/BadgeItem.tsx | 12 | ||||
-rw-r--r-- | src/screens/badge/BadgeSelection.tsx | 12 | ||||
-rw-r--r-- | src/screens/chat/ChatSearchBar.tsx | 3 | ||||
-rw-r--r-- | src/screens/main/NotificationsScreen.tsx | 9 | ||||
-rw-r--r-- | src/screens/onboarding/OnboardingStepThree.tsx | 4 | ||||
-rw-r--r-- | src/screens/onboarding/ProfileOnboarding.tsx | 2 | ||||
-rw-r--r-- | src/screens/onboarding/RegistrationThree.tsx | 26 | ||||
-rw-r--r-- | src/screens/onboarding/SocialMedia.tsx | 3 | ||||
-rw-r--r-- | src/screens/profile/EditProfile.tsx | 78 | ||||
-rw-r--r-- | src/screens/profile/SocialMediaTaggs.tsx | 38 |
13 files changed, 84 insertions, 110 deletions
diff --git a/src/components/common/AvatarTitle.tsx b/src/components/common/AvatarTitle.tsx index a38f46fa..81351327 100644 --- a/src/components/common/AvatarTitle.tsx +++ b/src/components/common/AvatarTitle.tsx @@ -8,7 +8,7 @@ type AvatarTitleProps = { }; const AvatarTitle: React.FC<AvatarTitleProps> = ({avatar}) => { return ( - <View style={[styles.container]}> + <View style={styles.container}> <LinearGradient colors={[TAGGS_GRADIENT.start, TAGGS_GRADIENT.end]} useAngle={true} diff --git a/src/components/common/TaggLoadingIndicator.tsx b/src/components/common/TaggLoadingIndicator.tsx index 91c68622..a829cb6f 100644 --- a/src/components/common/TaggLoadingIndicator.tsx +++ b/src/components/common/TaggLoadingIndicator.tsx @@ -3,7 +3,7 @@ import {Image, StyleSheet, View} from 'react-native'; import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; interface TaggLoadingIndicatorProps { - fullscreen: boolean; + fullscreen?: boolean; } const TaggLoadingIndicator: React.FC<TaggLoadingIndicatorProps> = ({ diff --git a/src/components/suggestedPeople/SPTaggsBar.tsx b/src/components/suggestedPeople/SPTaggsBar.tsx index 6fe8cef4..3ab33da1 100644 --- a/src/components/suggestedPeople/SPTaggsBar.tsx +++ b/src/components/suggestedPeople/SPTaggsBar.tsx @@ -1,13 +1,12 @@ import React, {useEffect, useState} from 'react'; import {StyleSheet} from 'react-native'; import Animated from 'react-native-reanimated'; -import {useDispatch, useSelector, useStore} from 'react-redux'; +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 {canViewProfile} from '../../utils'; import Tagg from '../taggs/Tagg'; const {View, ScrollView} = Animated; diff --git a/src/screens/badge/BadgeItem.tsx b/src/screens/badge/BadgeItem.tsx index 1994ce2a..1051d4a7 100644 --- a/src/screens/badge/BadgeItem.tsx +++ b/src/screens/badge/BadgeItem.tsx @@ -32,7 +32,9 @@ const BadgeItem: React.FC<BadgeItemProps> = ({ useAngle={true} angle={136.69} style={styles.border}> - <TouchableOpacity onPress={() => onSelection(title)} style={button}> + <TouchableOpacity + onPress={() => onSelection(title)} + style={styles.button}> <LinearGradient colors={index === 0 ? BADGE_GRADIENT_FIRST : BADGE_GRADIENT_REST} // BACKGROUND_GRADIENT_MAP @@ -72,14 +74,6 @@ const styles = StyleSheet.create({ borderRadius: 8, borderColor: 'transparent', }, - selectedDetailContainer: { - flexGrow: 1, - justifyContent: 'center', - alignItems: 'center', - borderWidth: 3, - borderColor: 'white', - borderRadius: 8, - }, imageStyles: { width: 40, height: 40, diff --git a/src/screens/badge/BadgeSelection.tsx b/src/screens/badge/BadgeSelection.tsx index deaefb52..640a9ea1 100644 --- a/src/screens/badge/BadgeSelection.tsx +++ b/src/screens/badge/BadgeSelection.tsx @@ -1,26 +1,26 @@ import {RouteProp} from '@react-navigation/core'; +import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; import {Alert, SafeAreaView, StatusBar, StyleSheet, View} from 'react-native'; import {Text} from 'react-native-animatable'; import {TouchableOpacity} from 'react-native-gesture-handler'; import LinearGradient from 'react-native-linear-gradient'; import {useDispatch, useSelector} from 'react-redux'; +import {BACKGROUND_GRADIENT_MAP} from '../../constants'; +import {BADGE_DATA} from '../../constants/badges'; +import {ERROR_BADGES_EXCEED_LIMIT} from '../../constants/strings'; import {MainStackParams} from '../../routes'; import { addBadgesService, getSuggestedPeopleProfile, updateBadgesService, } from '../../services'; -import {BACKGROUND_GRADIENT_MAP} from '../../constants'; -import {BADGE_DATA} from '../../constants/badges'; -import {ERROR_BADGES_EXCEED_LIMIT} from '../../constants/strings'; import {suggestedPeopleBadgesFinished} from '../../store/actions'; -import {BackgroundGradientType, UniversityType} from '../../types'; +import {RootState} from '../../store/rootReducer'; +import {BackgroundGradientType} from '../../types'; import {SCREEN_HEIGHT, StatusBarHeight} from '../../utils'; import BadgeList from './BadgeList'; import BadgeScreenHeader from './BadgeScreenHeader'; -import {useNavigation} from '@react-navigation/native'; -import {RootState} from '../../store/rootReducer'; /** * Home Screen for displaying Tagg Badge Selections diff --git a/src/screens/chat/ChatSearchBar.tsx b/src/screens/chat/ChatSearchBar.tsx index 4916ec45..d8aff567 100644 --- a/src/screens/chat/ChatSearchBar.tsx +++ b/src/screens/chat/ChatSearchBar.tsx @@ -26,7 +26,6 @@ const ChatSearchBar: React.FC<SearchBarProps> = ({ onChangeText, value, onCancel, - searching, animationProgress, onLayout, placeholder, @@ -53,7 +52,7 @@ const ChatSearchBar: React.FC<SearchBarProps> = ({ <Text style={styles.searchTextStyes}>To:</Text> </Animated.View> <TextInput - style={[styles.input]} + style={styles.input} placeholderTextColor={'#828282'} onSubmitEditing={handleSubmit} clearButtonMode="always" diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index 71199c9b..3efd9af8 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -1,6 +1,5 @@ import AsyncStorage from '@react-native-community/async-storage'; import {useFocusEffect, useNavigation} from '@react-navigation/native'; -import FindFriendsBlueIcon from '../../assets/icons/findFriends/find-friends-blue-icon.svg'; import moment from 'moment'; import React, {useCallback, useEffect, useState} from 'react'; import { @@ -18,12 +17,10 @@ import {checkPermission} from 'react-native-contacts'; import {TouchableOpacity} from 'react-native-gesture-handler'; import {SafeAreaView} from 'react-native-safe-area-context'; import {useDispatch, useSelector} from 'react-redux'; -import {PrivateAccountsPrompt} from '../../components/notifications/NotificationPrompts'; +import FindFriendsBlueIcon from '../../assets/icons/findFriends/find-friends-blue-icon.svg'; import {TabsGradient} from '../../components'; -import { - InviteFriendsPrompt, - Notification, -} from '../../components/notifications'; +import {Notification} from '../../components/notifications'; +import {PrivateAccountsPrompt} from '../../components/notifications/NotificationPrompts'; import { loadUserNotifications, updateNewNotificationReceived, diff --git a/src/screens/onboarding/OnboardingStepThree.tsx b/src/screens/onboarding/OnboardingStepThree.tsx index 5cf7993e..638f0889 100644 --- a/src/screens/onboarding/OnboardingStepThree.tsx +++ b/src/screens/onboarding/OnboardingStepThree.tsx @@ -61,7 +61,7 @@ const OnboardingStepThree: React.FC<OnboardingStepThreeProps> = ({ route, navigation, }) => { - const {userId, username} = route.params; + const {userId} = route.params; const [form, setForm] = React.useState<FormType>({ smallPic: '', university: UniversityType.Empty, @@ -135,7 +135,7 @@ const OnboardingStepThree: React.FC<OnboardingStepThreeProps> = ({ }; const handleClassYearUpdate = (value: string) => { - const classYear = Number.parseInt(value); + const classYear = parseInt(value, 10); setForm({ ...form, classYear, diff --git a/src/screens/onboarding/ProfileOnboarding.tsx b/src/screens/onboarding/ProfileOnboarding.tsx index c173c8e3..03ca858e 100644 --- a/src/screens/onboarding/ProfileOnboarding.tsx +++ b/src/screens/onboarding/ProfileOnboarding.tsx @@ -242,7 +242,7 @@ const ProfileOnboarding: React.FC<ProfileOnboardingProps> = ({ }; const handleClassYearUpdate = (value: string) => { - const classYear = Number.parseInt(value); + const classYear = parseInt(value, 10); setForm({ ...form, classYear, diff --git a/src/screens/onboarding/RegistrationThree.tsx b/src/screens/onboarding/RegistrationThree.tsx index 03348e6b..1f4266ff 100644 --- a/src/screens/onboarding/RegistrationThree.tsx +++ b/src/screens/onboarding/RegistrationThree.tsx @@ -3,38 +3,36 @@ * Purpose : Add a new screen to allow the user to enter first and last name */ -import React, {useState, useRef} from 'react'; +import AsyncStorage from '@react-native-community/async-storage'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; +import React, {useRef, useState} from 'react'; import { - View, - Text, - StyleSheet, - StatusBar, Alert, + KeyboardAvoidingView, Platform, + StatusBar, + StyleSheet, + Text, TouchableOpacity, - KeyboardAvoidingView, - ActivityIndicator, + View, } from 'react-native'; - -import {OnboardingStackParams} from '../../routes'; import { ArrowButton, + Background, + LoadingIndicator, RegistrationWizard, TaggInput, TermsConditions, - Background, - LoadingIndicator, } from '../../components'; -import {passwordRegex, usernameRegex, REGISTER_ENDPOINT} from '../../constants'; -import AsyncStorage from '@react-native-community/async-storage'; -import {BackgroundGradientType} from '../../types'; +import {passwordRegex, REGISTER_ENDPOINT, usernameRegex} from '../../constants'; import { ERROR_DOUBLE_CHECK_CONNECTION, ERROR_REGISTRATION, ERROR_SOMETHING_WENT_WRONG_REFRESH, } from '../../constants/strings'; +import {OnboardingStackParams} from '../../routes'; +import {BackgroundGradientType} from '../../types'; type RegistrationScreenThreeRouteProp = RouteProp< OnboardingStackParams, diff --git a/src/screens/onboarding/SocialMedia.tsx b/src/screens/onboarding/SocialMedia.tsx index 2a978f94..0ded7d3e 100644 --- a/src/screens/onboarding/SocialMedia.tsx +++ b/src/screens/onboarding/SocialMedia.tsx @@ -10,7 +10,6 @@ import { TouchableOpacity, View, } from 'react-native'; -import {useDispatch} from 'react-redux'; import { BackgroundGradientType, CategorySelectionScreenType, @@ -21,7 +20,7 @@ import { LinkSocialMedia, RegistrationWizard, } from '../../components'; -import {SOCIAL_LIST, MOMENT_CATEGORIES} from '../../constants/'; +import {SOCIAL_LIST} from '../../constants/'; import {OnboardingStackParams} from '../../routes'; /** diff --git a/src/screens/profile/EditProfile.tsx b/src/screens/profile/EditProfile.tsx index 8b658043..36abb146 100644 --- a/src/screens/profile/EditProfile.tsx +++ b/src/screens/profile/EditProfile.tsx @@ -199,12 +199,12 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { /* * Handles changes to the website field value and verifies the input by updating state and running a validation function. */ - const handleWebsiteUpdate = (website: string) => { - website = website.trim(); - let isValidWebsite: boolean = websiteRegex.test(website); + const handleWebsiteUpdate = (newWebsite: string) => { + newWebsite = newWebsite.trim(); + let isValidWebsite: boolean = websiteRegex.test(newWebsite); setForm({ ...form, - website, + website: newWebsite, isValidWebsite, }); }; @@ -212,27 +212,27 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { /* * Handles changes to the bio field value and verifies the input by updating state and running a validation function. */ - const handleBioUpdate = (bio: string) => { - let isValidBio: boolean = bioRegex.test(bio); + const handleBioUpdate = (newBio: string) => { + let isValidBio: boolean = bioRegex.test(newBio); setForm({ ...form, - bio, + bio: newBio, isValidBio, }); }; - const handleGenderUpdate = (gender: string) => { - if (gender === 'custom') { - setForm({...form, gender}); + const handleGenderUpdate = (newGender: string) => { + if (newGender === 'custom') { + setForm({...form, gender: newGender}); setIsCustomGender(true); - } else if (gender === null) { + } else if (newGender === null) { // not doing anything will make the picker "bounce back" } else { setIsCustomGender(false); let isValidGender: boolean = true; setForm({ ...form, - gender, + gender: newGender, isValidGender, }); } @@ -383,8 +383,8 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { headerRight: () => ( <Button title={'Save'} - buttonStyle={{backgroundColor: 'transparent', marginRight: 15}} - titleStyle={{fontWeight: 'bold'}} + buttonStyle={styles.headerRightButton} + titleStyle={styles.boldFont} onPress={() => { setLoading(true); handleSubmit().then(() => setLoading(false)); @@ -409,22 +409,13 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { alwaysBounceVertical contentContainerStyle={{paddingBottom: SCREEN_HEIGHT / 15}}> <StatusBar barStyle="light-content" translucent={false} /> - <View - style={{ - position: 'relative', - alignSelf: 'center', - }}> + <View style={styles.relativeCenter}> <View> <View style={styles.profile}> <LargeProfilePic /> <SmallProfilePic /> </View> - <View - style={{ - position: 'relative', - width: 280, - alignSelf: 'center', - }}> + <View style={styles.relativeCenterWithWidth}> <TaggInput accessibilityHint="Enter a website." accessibilityLabel="Website input field." @@ -540,7 +531,7 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { <SocialIcon social={'TikTok'} style={styles.icon} - screenType={ScreenType.Profile} + whiteRing={undefined} /> <View style={styles.taggInput}> <TaggInput @@ -631,20 +622,6 @@ const styles = StyleSheet.create({ width: 110, borderRadius: 55, }, - submitBtn: { - backgroundColor: '#8F01FF', - justifyContent: 'center', - alignItems: 'center', - width: 150, - height: 40, - borderRadius: 5, - marginTop: '5%', - }, - submitBtnLabel: { - fontSize: 16, - fontWeight: '500', - color: '#fff', - }, customGenderInput: { width: '100%', height: 40, @@ -666,7 +643,26 @@ const styles = StyleSheet.create({ aspectRatio: 1, flex: 1, }, - taggInput: {flex: 6.5, marginLeft: '3%'}, + taggInput: { + flex: 6.5, + marginLeft: '3%', + }, + headerRightButton: { + backgroundColor: 'transparent', + marginRight: 15, + }, + boldFont: { + fontWeight: 'bold', + }, + relativeCenter: { + position: 'relative', + alignSelf: 'center', + }, + relativeCenterWithWidth: { + position: 'relative', + width: 280, + alignSelf: 'center', + }, }); export default EditProfile; diff --git a/src/screens/profile/SocialMediaTaggs.tsx b/src/screens/profile/SocialMediaTaggs.tsx index 466ba509..9186f187 100644 --- a/src/screens/profile/SocialMediaTaggs.tsx +++ b/src/screens/profile/SocialMediaTaggs.tsx @@ -3,6 +3,7 @@ import {StackNavigationProp} from '@react-navigation/stack'; import React, {useEffect, useState} from 'react'; import {ScrollView, StatusBar, StyleSheet, View} from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; +import {useSelector} from 'react-redux'; import { AvatarTitle, SocialMediaInfo, @@ -10,26 +11,17 @@ import { TaggPost, TwitterTaggPost, } from '../../components'; +import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator'; import {AVATAR_GRADIENT} from '../../constants'; -import {ProfileStackParams} from '../../routes'; -import { - SimplePostType, - TwitterPostType, - SocialAccountType, - ScreenType, -} from '../../types'; -import {AvatarHeaderHeight, SCREEN_HEIGHT} from '../../utils'; -import {useSelector} from 'react-redux'; +import {MainStackParams} from '../../routes'; import {RootState} from '../../store/rootReducer'; -import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator'; +import {SimplePostType, SocialAccountType, TwitterPostType} from '../../types'; +import {AvatarHeaderHeight, SCREEN_HEIGHT} from '../../utils'; -type SocialMediaTaggsRouteProp = RouteProp< - ProfileStackParams, - 'SocialMediaTaggs' ->; +type SocialMediaTaggsRouteProp = RouteProp<MainStackParams, 'SocialMediaTaggs'>; type SocialMediaTaggsNavigationProp = StackNavigationProp< - ProfileStackParams, + MainStackParams, 'SocialMediaTaggs' >; @@ -49,13 +41,13 @@ const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({ const { avatar, profile: {name}, - } = userXId - ? useSelector((state: RootState) => state.userX[screenType][userXId]) - : useSelector((state: RootState) => state.user); + } = useSelector((state: RootState) => + userXId ? state.userX[screenType][userXId] : state.user, + ); - const {socialAccounts} = userXId - ? useSelector((state: RootState) => state.userX[screenType][userXId]) - : useSelector((state: RootState) => state.socialAccounts); + const {socialAccounts} = useSelector((state: RootState) => + userXId ? state.userX[screenType][userXId] : state.socialAccounts, + ); useEffect(() => { const currentSocialData = {...socialAccounts[socialMediaType]}; @@ -67,7 +59,7 @@ const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({ useEffect(() => { navigation.setOptions({ headerTitle: () => { - return <AvatarTitle avatar={avatar} />; + return <AvatarTitle avatar={avatar ?? null} />; }, }); }, [avatar, navigation]); @@ -114,7 +106,7 @@ const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({ <TabsGradient /> </View> ) : ( - <TaggLoadingIndicator color="white" /> + <TaggLoadingIndicator /> )} </LinearGradient> ); |