aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/ProfileBody.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/profile/ProfileBody.tsx')
-rw-r--r--src/components/profile/ProfileBody.tsx100
1 files changed, 16 insertions, 84 deletions
diff --git a/src/components/profile/ProfileBody.tsx b/src/components/profile/ProfileBody.tsx
index 106b20a7..646be3e0 100644
--- a/src/components/profile/ProfileBody.tsx
+++ b/src/components/profile/ProfileBody.tsx
@@ -1,28 +1,24 @@
import React from 'react';
-import {StyleSheet, View, Text, LayoutChangeEvent, Linking} from 'react-native';
-import {Button, normalize} from 'react-native-elements';
+import {LayoutChangeEvent, Linking, StyleSheet, Text, View} from 'react-native';
+import {normalize} from 'react-native-elements';
+import {useDispatch, useSelector, useStore} from 'react-redux';
import {
TAGG_DARK_BLUE,
TAGG_LIGHT_BLUE,
TOGGLE_BUTTON_TYPE,
} from '../../constants';
-import ToggleButton from './ToggleButton';
-import {RootState} from '../../store/rootReducer';
-import {useDispatch, useSelector, useStore} from 'react-redux';
-import {ScreenType} from '../../types';
-import {NO_PROFILE, NO_USER} from '../../store/initialStates';
-import {
- getUserAsProfilePreviewType,
- handleFriendUnfriend,
- SCREEN_WIDTH,
-} from '../../utils';
-import {AcceptDeclineButtons, FriendsButton} from '../common';
import {
acceptFriendRequest,
declineFriendRequest,
updateUserXFriends,
updateUserXProfileAllScreens,
} from '../../store/actions';
+import {NO_PROFILE, NO_USER} from '../../store/initialStates';
+import {RootState} from '../../store/rootReducer';
+import {ScreenType} from '../../types';
+import {getUserAsProfilePreviewType, SCREEN_WIDTH} from '../../utils';
+import {FriendsButton} from '../common';
+import ToggleButton from './ToggleButton';
interface ProfileBodyProps {
onLayout: (event: LayoutChangeEvent) => void;
@@ -99,37 +95,13 @@ const ProfileBody: React.FC<ProfileBodyProps> = ({
)}
{userXId && !isBlocked && (
<View style={styles.buttonsContainer}>
- <FriendsButton userXId={userXId} screenType={screenType} />
- {(friendship_status === 'requested' &&
- friendship_requester_id !== userXId && (
- <Button
- title={'Requested'}
- buttonStyle={styles.requestedButton}
- titleStyle={styles.requestedButtonTitle}
- onPress={() =>
- handleFriendUnfriend(
- screenType,
- user,
- profile,
- dispatch,
- state,
- loggedInUser,
- )
- } // delete request, no record status
- />
- )) ||
- (friendship_status === 'requested' &&
- friendship_requester_id === userXId && (
- <AcceptDeclineButtons
- requester={getUserAsProfilePreviewType(
- {userId: userXId, username},
- profile,
- )}
- onAccept={handleAcceptRequest}
- onReject={handleDeclineFriendRequest}
- externalStyles={{container: styles.acceptRejectContainer}}
- />
- ))}
+ <FriendsButton
+ userXId={userXId}
+ screenType={screenType}
+ friendship_requester_id={friendship_requester_id}
+ onAcceptRequest={handleAcceptRequest}
+ onRejectRequest={handleDeclineFriendRequest}
+ />
</View>
)}
</View>
@@ -143,11 +115,7 @@ const styles = StyleSheet.create({
paddingTop: '3.5%',
paddingBottom: '2%',
},
- acceptRejectContainer: {
- flexDirection: 'row',
- },
buttonsContainer: {
- flexDirection: 'row',
flex: 1,
paddingTop: '3.5%',
paddingBottom: '2%',
@@ -171,42 +139,6 @@ const styles = StyleSheet.create({
color: TAGG_DARK_BLUE,
marginBottom: '1%',
},
- requestedButton: {
- justifyContent: 'center',
- alignItems: 'center',
- width: SCREEN_WIDTH * 0.4,
- height: SCREEN_WIDTH * 0.075,
- borderColor: TAGG_LIGHT_BLUE,
- borderWidth: 2,
- borderRadius: 3,
- marginRight: '2%',
- padding: 0,
- backgroundColor: 'transparent',
- },
- requestedButtonTitle: {
- color: TAGG_LIGHT_BLUE,
- padding: 0,
- fontSize: 14,
- fontWeight: '700',
- },
- buttonTitle: {
- color: 'white',
- padding: 0,
- fontSize: 14,
- fontWeight: '700',
- },
- button: {
- justifyContent: 'center',
- alignItems: 'center',
- width: SCREEN_WIDTH * 0.4,
- height: SCREEN_WIDTH * 0.075,
- padding: 0,
- borderWidth: 2,
- borderColor: TAGG_LIGHT_BLUE,
- borderRadius: 3,
- marginRight: '2%',
- backgroundColor: TAGG_LIGHT_BLUE,
- },
});
export default ProfileBody;