From 0187200d794d54c1d9954dd86a6a156132dedcac Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Mon, 22 Mar 2021 12:18:12 -0700 Subject: TMA 642 Touchable Opacity redirection --- src/components/moments/MomentPostHeader.tsx | 20 ++++++++++++++++---- src/components/profile/Content.tsx | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/moments/MomentPostHeader.tsx b/src/components/moments/MomentPostHeader.tsx index aad776e8..56b073d6 100644 --- a/src/components/moments/MomentPostHeader.tsx +++ b/src/components/moments/MomentPostHeader.tsx @@ -1,5 +1,11 @@ import React, {useState} from 'react'; -import {StyleSheet, Text, View, ViewProps} from 'react-native'; +import { + StyleSheet, + Text, + TouchableOpacity, + View, + ViewProps, +} from 'react-native'; import {MomentMoreInfoDrawer} from '../profile'; import {loadUserMoments} from '../../store/actions'; import {useDispatch, useSelector} from 'react-redux'; @@ -29,17 +35,23 @@ const MomentPostHeader: React.FC = ({ (state: RootState) => state.user.user, ); const isOwnProfile = loggedInUserName === username; - return ( - + { + navigation.navigate('Profile', { + userXId: isOwnProfile ? undefined : userXId, + screenType, + }); + }} + style={styles.header}> {username} - + = ({y, userXId, screenType}) => { isBlocked, }} /> - + {userXId && moments.length === 0 && ( -- cgit v1.2.3-70-g09d2 From b2c3242021348274fc518a7e716dc9e0d6d1586d Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Mon, 22 Mar 2021 12:25:39 -0700 Subject: TMA 642 Refactoring --- src/components/moments/MomentPostHeader.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/components/moments/MomentPostHeader.tsx b/src/components/moments/MomentPostHeader.tsx index 56b073d6..9abf7fce 100644 --- a/src/components/moments/MomentPostHeader.tsx +++ b/src/components/moments/MomentPostHeader.tsx @@ -30,21 +30,21 @@ const MomentPostHeader: React.FC = ({ }) => { const [drawerVisible, setDrawerVisible] = useState(false); const dispatch = useDispatch(); + const navigation = useNavigation(); const {userId: loggedInUserId, username: loggedInUserName} = useSelector( (state: RootState) => state.user.user, ); const isOwnProfile = loggedInUserName === username; + const navigateToProfile = () => { + navigation.navigate('Profile', { + userXId: isOwnProfile ? undefined : userXId, + screenType, + }); + }; return ( - { - navigation.navigate('Profile', { - userXId: isOwnProfile ? undefined : userXId, - screenType, - }); - }} - style={styles.header}> + Date: Tue, 23 Mar 2021 11:59:00 -0700 Subject: User not present check --- src/components/notifications/Notification.tsx | 45 ++++++++++++++++++++------- src/components/profile/Content.tsx | 12 ++++--- 2 files changed, 41 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index c8a8aa06..8143e396 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -205,11 +205,22 @@ const Notification: React.FC = (props) => { dispatch(loadUserNotifications()); }; + const isOwnProfile = id === loggedInUser.userId; + const navigateToProfile = async () => { + if (!userXInStore(state, screenType, id)) { + await fetchUserX(dispatch, {userId: id, username: username}, screenType); + } + navigation.navigate('Profile', { + userXId: isOwnProfile ? undefined : id, + screenType, + }); + }; + const renderContent = () => ( - - + + = (props) => { : require('../../assets/images/avatar-placeholder.png') } /> - + - - {first_name} {last_name} - - {verbage} + + + {first_name} {last_name} + + + + {verbage} + {notification_type === 'FRD_REQ' && ( @@ -238,9 +253,13 @@ const Notification: React.FC = (props) => { notification_type === 'MOM_3+' || notification_type === 'MOM_FRIEND') && notification_object && ( - + + + )} - + ); return unread ? ( @@ -284,7 +303,6 @@ const styles = StyleSheet.create({ fontWeight: '700', }, moment: { - position: 'absolute', height: 42, width: 42, right: '5%', @@ -292,6 +310,9 @@ const styles = StyleSheet.create({ buttonsContainer: { height: '80%', }, + imageFlex: { + flex: 1, + }, }); export default Notification; diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index 7f922bd9..1a5a205c 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -109,9 +109,10 @@ const Content: React.FC = ({y, userXId, screenType}) => { const [isStageOnePromptClosed, setIsStageOnePromptClosed] = useState( false, ); - const [isStageThreePromptClosed, setIsStageThreePromptClosed] = useState< - boolean - >(false); + const [ + isStageThreePromptClosed, + setIsStageThreePromptClosed, + ] = useState(false); const onRefresh = useCallback(() => { const refrestState = async () => { @@ -308,7 +309,10 @@ const Content: React.FC = ({y, userXId, screenType}) => { isBlocked, }} /> - + {userXId && moments.length === 0 && ( -- cgit v1.2.3-70-g09d2 From ef3e601ba92a91334245c48b0a8d03e3b1cacc7a Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Tue, 23 Mar 2021 12:03:37 -0700 Subject: User not present check --- src/components/moments/MomentPostHeader.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/components/moments/MomentPostHeader.tsx b/src/components/moments/MomentPostHeader.tsx index 9abf7fce..ff324c4a 100644 --- a/src/components/moments/MomentPostHeader.tsx +++ b/src/components/moments/MomentPostHeader.tsx @@ -8,11 +8,12 @@ import { } from 'react-native'; import {MomentMoreInfoDrawer} from '../profile'; import {loadUserMoments} from '../../store/actions'; -import {useDispatch, useSelector} from 'react-redux'; +import {useDispatch, useSelector, useStore} from 'react-redux'; import {ScreenType} from '../../types'; import Avatar from '../profile/Avatar'; import {useNavigation} from '@react-navigation/native'; import {RootState} from '../../store/rootReducer'; +import {fetchUserX, userXInStore} from '../../utils'; interface MomentPostHeaderProps extends ViewProps { userXId?: string; @@ -30,18 +31,26 @@ const MomentPostHeader: React.FC = ({ }) => { const [drawerVisible, setDrawerVisible] = useState(false); const dispatch = useDispatch(); - + const state: RootState = useStore().getState(); const navigation = useNavigation(); const {userId: loggedInUserId, username: loggedInUserName} = useSelector( (state: RootState) => state.user.user, ); const isOwnProfile = loggedInUserName === username; - const navigateToProfile = () => { + const navigateToProfile = async () => { + if (userXId && !userXInStore(state, screenType, userXId)) { + await fetchUserX( + dispatch, + {userId: userXId, username: username}, + screenType, + ); + } navigation.navigate('Profile', { userXId: isOwnProfile ? undefined : userXId, screenType, }); }; + return ( -- cgit v1.2.3-70-g09d2