Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32558088
D12600.1767261540.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D12600.1767261540.diff
View Options
diff --git a/native/chat/relationship-prompt.react.js b/native/chat/relationship-prompt.react.js
--- a/native/chat/relationship-prompt.react.js
+++ b/native/chat/relationship-prompt.react.js
@@ -1,15 +1,14 @@
// @flow
-import Icon from '@expo/vector-icons/FontAwesome5.js';
import * as React from 'react';
-import { Text, View } from 'react-native';
+import { View } from 'react-native';
import { useRelationshipPrompt } from 'lib/hooks/relationship-prompt.js';
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
import { userRelationshipStatus } from 'lib/types/relationship-types.js';
import type { UserInfo } from 'lib/types/user-types.js';
-import Button from '../components/button.react.js';
+import RelationshipButton from '../components/relationship-button.react.js';
import { useStyles } from '../themes/colors.js';
import { unknownErrorAlertDetails } from '../utils/alert-messages.js';
import Alert from '../utils/alert.js';
@@ -34,6 +33,12 @@
const {
otherUserInfo,
callbacks: { blockUser, unblockUser, friendUser, unfriendUser },
+ loaders: {
+ isLoadingBlockUser,
+ isLoadingUnblockUser,
+ isLoadingFriendUser,
+ isLoadingUnfriendUser,
+ },
} = useRelationshipPrompt(
threadInfo,
onErrorCallback,
@@ -54,10 +59,14 @@
) {
return (
<View style={styles.container}>
- <Button style={[styles.button, styles.redButton]} onPress={blockUser}>
- <Icon name="user-shield" size={12} color="white" />
- <Text style={styles.buttonText}>Block User</Text>
- </Button>
+ <View style={styles.buttonContainer}>
+ <RelationshipButton
+ type="block"
+ onPress={blockUser}
+ isLoading={isLoadingBlockUser}
+ size="S"
+ />
+ </View>
</View>
);
}
@@ -70,13 +79,14 @@
) {
return (
<View style={styles.container}>
- <Button
- style={[styles.button, styles.greenButton]}
- onPress={unblockUser}
- >
- <Icon name="user-shield" size={12} color="white" />
- <Text style={styles.buttonText}>Unblock User</Text>
- </Button>
+ <View style={styles.buttonContainer}>
+ <RelationshipButton
+ type="unblock"
+ onPress={unblockUser}
+ isLoading={isLoadingUnblockUser}
+ size="S"
+ />
+ </View>
</View>
);
}
@@ -87,20 +97,22 @@
) {
return (
<View style={styles.container}>
- <Button
- style={[styles.button, styles.greenButton]}
- onPress={friendUser}
- >
- <Icon name="user-plus" size={12} color="white" />
- <Text style={styles.buttonText}>Accept Friend Request</Text>
- </Button>
- <Button
- style={[styles.button, styles.redButton]}
- onPress={unfriendUser}
- >
- <Icon name="user-slash" size={12} color="white" />
- <Text style={styles.buttonText}>Reject Friend Request</Text>
- </Button>
+ <View style={styles.buttonContainer}>
+ <RelationshipButton
+ type="accept"
+ onPress={friendUser}
+ isLoading={isLoadingFriendUser}
+ size="S"
+ />
+ </View>
+ <View style={styles.buttonContainer}>
+ <RelationshipButton
+ type="reject"
+ onPress={unfriendUser}
+ isLoading={isLoadingUnfriendUser}
+ size="S"
+ />
+ </View>
</View>
);
}
@@ -110,30 +122,36 @@
) {
return (
<View style={styles.container}>
- <Button
- style={[styles.button, styles.redButton]}
- onPress={unfriendUser}
- >
- <Icon name="user-minus" size={12} color="white" />
- <Text style={styles.buttonText}>Withdraw Friend Request</Text>
- </Button>
+ <View style={styles.buttonContainer}>
+ <RelationshipButton
+ type="withdraw"
+ onPress={unfriendUser}
+ isLoading={isLoadingUnfriendUser}
+ size="S"
+ />
+ </View>
</View>
);
}
return (
<View style={styles.container}>
- <Button
- style={[styles.button, styles.greenButton]}
- onPress={friendUser}
- >
- <Icon name="user-plus" size={12} color="white" />
- <Text style={styles.buttonText}>Add Friend</Text>
- </Button>
- <Button style={[styles.button, styles.redButton]} onPress={blockUser}>
- <Icon name="user-shield" size={12} color="white" />
- <Text style={styles.buttonText}>Block User</Text>
- </Button>
+ <View style={styles.buttonContainer}>
+ <RelationshipButton
+ type="add"
+ onPress={friendUser}
+ isLoading={isLoadingFriendUser}
+ size="S"
+ />
+ </View>
+ <View style={styles.buttonContainer}>
+ <RelationshipButton
+ type="block"
+ onPress={blockUser}
+ isLoading={isLoadingBlockUser}
+ size="S"
+ />
+ </View>
</View>
);
},
@@ -146,6 +164,11 @@
backgroundColor: 'panelBackground',
flexDirection: 'row',
},
+ buttonContainer: {
+ flex: 1,
+ height: 33,
+ marginHorizontal: 4,
+ },
button: {
padding: 10,
borderRadius: 5,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 1, 9:59 AM (9 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5875697
Default Alt Text
D12600.1767261540.diff (5 KB)
Attached To
Mode
D12600: [native] introduce loading logic to RelationshipPrompt
Attached
Detach File
Event Timeline
Log In to Comment