From e09f37e73b45a58c0a6ebf8ad8b5216c91713f26 Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Mon, 24 May 2021 14:03:32 -0700 Subject: Fix yarn lint issues --- src/screens/main/NotificationsScreen.tsx | 5 +- src/screens/profile/MomentCommentsScreen.tsx | 10 +- src/screens/profile/MomentUploadPromptScreen.tsx | 8 +- src/screens/profile/SocialMediaTaggs.tsx | 6 +- src/screens/suggestedPeople/MutualBadgeHolders.tsx | 5 +- .../SuggestedPeopleUploadPictureScreen.tsx | 245 ++++++++++----------- 6 files changed, 135 insertions(+), 144 deletions(-) (limited to 'src/screens') diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index bce48ef2..ebcccc8e 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -36,9 +36,8 @@ const NotificationsScreen: React.FC = () => { ); const [refreshing, setRefreshing] = useState(false); // used for figuring out which ones are unread - const [lastViewed, setLastViewed] = useState( - undefined, - ); + const [lastViewed, setLastViewed] = + useState(undefined); const {notifications} = useSelector( (state: RootState) => state.notifications, ); diff --git a/src/screens/profile/MomentCommentsScreen.tsx b/src/screens/profile/MomentCommentsScreen.tsx index 4b332b56..402e5f44 100644 --- a/src/screens/profile/MomentCommentsScreen.tsx +++ b/src/screens/profile/MomentCommentsScreen.tsx @@ -44,14 +44,12 @@ const MomentCommentsScreen: React.FC = ({route}) => { //Receives comment length from child CommentsContainer const [commentsLength, setCommentsLength] = useState(0); - const [shouldUpdateAllComments, setShouldUpdateAllComments] = React.useState( - true, - ); + const [shouldUpdateAllComments, setShouldUpdateAllComments] = + React.useState(true); //Keeps track of the current comments object in focus so that the application knows which comment to post a reply to - const [commentTapped, setCommentTapped] = useState< - CommentType | CommentThreadType | undefined - >(); + const [commentTapped, setCommentTapped] = + useState(); useEffect(() => { navigation.setOptions({ diff --git a/src/screens/profile/MomentUploadPromptScreen.tsx b/src/screens/profile/MomentUploadPromptScreen.tsx index f0aaffc4..7e04063c 100644 --- a/src/screens/profile/MomentUploadPromptScreen.tsx +++ b/src/screens/profile/MomentUploadPromptScreen.tsx @@ -28,12 +28,8 @@ const MomentUploadPromptScreen: React.FC = ({ route, navigation, }) => { - const { - screenType, - momentCategory, - profileBodyHeight, - socialsBarHeight, - } = route.params; + const {screenType, momentCategory, profileBodyHeight, socialsBarHeight} = + route.params; return ( = ({ type={socialMediaType} handle={accountData?.handle} /> - {(accountData?.posts as Array< - SimplePostType | TwitterPostType - >).map((post, index) => + {( + accountData?.posts as Array + ).map((post, index) => socialMediaType === 'Twitter' ? ( = ({ useEffect(() => { const getUsers = async () => { - let localUsers: - | ProfilePreviewType[] - | undefined = await getMutualBadgeHolders(badge_id); + let localUsers: ProfilePreviewType[] | undefined = + await getMutualBadgeHolders(badge_id); setUsers(localUsers); }; diff --git a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx index af5fd579..f5a9f280 100644 --- a/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx +++ b/src/screens/suggestedPeopleOnboarding/SuggestedPeopleUploadPictureScreen.tsx @@ -38,139 +38,138 @@ type SuggestedPeopleUploadPictureScreenProps = { route: SuggestedPeopleUploadPictureScreenRouteProp; }; -const SuggestedPeopleUploadPictureScreen: React.FC = ({ - route, -}) => { - const {editing} = route.params; - const [image, setImage] = useState(undefined); - const [oldImage, setOldImage] = useState(undefined); - const [loading, setLoading] = useState(false); - const dispatch = useDispatch(); - const navigation = useNavigation(); - const { - user: {userId: loggedInUserId}, - } = useSelector((state: RootState) => state.user); +const SuggestedPeopleUploadPictureScreen: React.FC = + ({route}) => { + const {editing} = route.params; + const [image, setImage] = useState(undefined); + const [oldImage, setOldImage] = useState(undefined); + const [loading, setLoading] = useState(false); + const dispatch = useDispatch(); + const navigation = useNavigation(); + const { + user: {userId: loggedInUserId}, + } = useSelector((state: RootState) => state.user); - useEffect(() => { - const loadData = async () => { - const response = await getSuggestedPeopleProfile(loggedInUserId); - if (response) { - setImage(response.suggested_people_url); - setOldImage(response.suggested_people_url); + useEffect(() => { + const loadData = async () => { + const response = await getSuggestedPeopleProfile(loggedInUserId); + if (response) { + setImage(response.suggested_people_url); + setOldImage(response.suggested_people_url); + } + }; + // if we're in edit SP, attempt to load current sp image + if (editing) { + loadData(); } - }; - // if we're in edit SP, attempt to load current sp image - if (editing) { - loadData(); - } - }, []); + }, []); - const openImagePicker = () => { - ImagePicker.openPicker({ - smartAlbums: [ - 'Favorites', - 'RecentlyAdded', - 'SelfPortraits', - 'Screenshots', - 'UserLibrary', - ], - width: SP_WIDTH, - height: SP_HEIGHT, - cropping: true, - cropperToolbarTitle: 'Select Photo', - mediaType: 'photo', - }) - .then((picture) => { - if ('path' in picture) { - setImage(picture.path); - } + const openImagePicker = () => { + ImagePicker.openPicker({ + smartAlbums: [ + 'Favorites', + 'RecentlyAdded', + 'SelfPortraits', + 'Screenshots', + 'UserLibrary', + ], + width: SP_WIDTH, + height: SP_HEIGHT, + cropping: true, + cropperToolbarTitle: 'Select Photo', + mediaType: 'photo', }) - .catch((_) => {}); - }; + .then((picture) => { + if ('path' in picture) { + setImage(picture.path); + } + }) + .catch((_) => {}); + }; - const uploadImage = async () => { - // Uploading image only if initially loaded image is not the same as the image being uploaded - if (image && oldImage !== image) { - setLoading(true); - const success = await sendSuggestedPeoplePhoto(image); - if (success) { - dispatch(uploadedSuggestedPeoplePhoto(image)); - if (!editing) { - navigation.navigate('BadgeSelection', {editing: false}); + const uploadImage = async () => { + // Uploading image only if initially loaded image is not the same as the image being uploaded + if (image && oldImage !== image) { + setLoading(true); + const success = await sendSuggestedPeoplePhoto(image); + if (success) { + dispatch(uploadedSuggestedPeoplePhoto(image)); + if (!editing) { + navigation.navigate('BadgeSelection', {editing: false}); + } + } else { + Alert.alert(ERROR_UPLOAD); + } + setLoading(false); + // Navigated back to Profile if user is editing their Suggested People Picture + if (editing) { + navigation.goBack(); + setTimeout(() => { + Alert.alert(success ? SUCCESS_PIC_UPLOAD : ERROR_UPLOAD_SP_PHOTO); + }, 500); } - } else { - Alert.alert(ERROR_UPLOAD); - } - setLoading(false); - // Navigated back to Profile if user is editing their Suggested People Picture - if (editing) { - navigation.goBack(); - setTimeout(() => { - Alert.alert(success ? SUCCESS_PIC_UPLOAD : ERROR_UPLOAD_SP_PHOTO); - }, 500); } - } - }; + }; - return ( - <> - {loading && } - - - - {editing ? 'Edit Suggested' : 'PHOTO'} - - {image ? ( - - {editing - ? 'Tap to upload new photo' - : 'Tap again to choose another photo'} + return ( + <> + {loading && } + + + + {editing ? 'Edit Suggested' : 'PHOTO'} - ) : ( - - Upload a photo, this is what other users will see - - )} - {image ? ( - - - + {editing + ? 'Tap to upload new photo' + : 'Tap again to choose another photo'} + + ) : ( + + Upload a photo, this is what other users will see + + )} + {image ? ( + + + + + + ) : ( + + - - - ) : ( - - - - Upload Photo - - - )} - {image && ( - - )} - - - ); -}; + style={[styles.imageContainer, styles.overlay]}> + + Upload Photo + + + )} + {image && ( + + )} + + + ); + }; const styles = StyleSheet.create({ container: { -- cgit v1.2.3-70-g09d2