Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32241943
D5100.1765227455.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D5100.1765227455.diff
View Options
diff --git a/web/modals/threads/settings/thread-settings-relationship-button.react.js b/web/modals/threads/settings/thread-settings-relationship-button.react.js
--- a/web/modals/threads/settings/thread-settings-relationship-button.react.js
+++ b/web/modals/threads/settings/thread-settings-relationship-button.react.js
@@ -12,7 +12,10 @@
getRelationshipDispatchAction,
} from 'lib/shared/relationship-utils';
import type { SetState } from 'lib/types/hook-types';
-import { type RelationshipButton } from 'lib/types/relationship-types';
+import {
+ relationshipButtons,
+ type RelationshipButton,
+} from 'lib/types/relationship-types';
import type { UserInfo } from 'lib/types/user-types';
import {
useDispatchActionPromise,
@@ -40,10 +43,31 @@
const { username } = otherUserInfo;
invariant(username, 'Other username should be specified');
- const { text, action } = React.useMemo(() => {
+ const { text, action, variant } = React.useMemo(() => {
+ let buttonVariant;
+
+ if (relationshipButton === relationshipButtons.FRIEND) {
+ buttonVariant = 'success';
+ } else if (relationshipButton === relationshipButtons.UNFRIEND) {
+ buttonVariant = 'danger';
+ } else if (relationshipButton === relationshipButtons.BLOCK) {
+ buttonVariant = 'danger';
+ } else if (relationshipButton === relationshipButtons.UNBLOCK) {
+ buttonVariant = 'success';
+ } else if (relationshipButton === relationshipButtons.ACCEPT) {
+ buttonVariant = 'success';
+ } else if (relationshipButton === relationshipButtons.REJECT) {
+ buttonVariant = 'danger';
+ } else if (relationshipButton === relationshipButtons.WITHDRAW) {
+ buttonVariant = 'danger';
+ } else {
+ buttonVariant = 'primary';
+ }
+
return {
text: getRelationshipActionText(relationshipButton, username),
action: getRelationshipDispatchAction(relationshipButton),
+ variant: buttonVariant,
};
}, [relationshipButton, username]);
@@ -70,7 +94,7 @@
}, [dispatchActionPromise, updateRelationshipsActionPromise]);
return (
- <Button variant="primary" onClick={onClick} disabled={disabled}>
+ <Button variant={variant} onClick={onClick} disabled={disabled}>
{text}
</Button>
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 8, 8:57 PM (9 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5848329
Default Alt Text
D5100.1765227455.diff (2 KB)
Attached To
Mode
D5100: [web] Introduce colors for relationship action buttons
Attached
Detach File
Event Timeline
Log In to Comment