From 861a5063f1bb6e796cf4155567baa98821731b2c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 8 Apr 2025 18:28:14 +0200 Subject: [PATCH] [Glitch] Change unfollow button label from "Mutual" to "Unfollow" in web UI Port 0e5be63fb327403902076df602ec2dd410ada789 to glitch-soc Signed-off-by: Claire --- .../components/account_header.tsx | 99 +++---------------- 1 file changed, 13 insertions(+), 86 deletions(-) diff --git a/app/javascript/flavours/glitch/features/account_timeline/components/account_header.tsx b/app/javascript/flavours/glitch/features/account_timeline/components/account_header.tsx index ed0299f94d..da4f6af829 100644 --- a/app/javascript/flavours/glitch/features/account_timeline/components/account_header.tsx +++ b/app/javascript/flavours/glitch/features/account_timeline/components/account_header.tsx @@ -36,10 +36,10 @@ import { } from 'flavours/glitch/components/badge'; import { Button } from 'flavours/glitch/components/button'; import { CopyIconButton } from 'flavours/glitch/components/copy_icon_button'; +import { FollowButton } from 'flavours/glitch/components/follow_button'; import { FormattedDateWrapper } from 'flavours/glitch/components/formatted_date'; import { Icon } from 'flavours/glitch/components/icon'; import { IconButton } from 'flavours/glitch/components/icon_button'; -import { LoadingIndicator } from 'flavours/glitch/components/loading_indicator'; import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; import { DomainPill } from 'flavours/glitch/features/account/components/domain_pill'; import AccountNoteContainer from 'flavours/glitch/features/account/containers/account_note_container'; @@ -53,7 +53,6 @@ import { } from 'flavours/glitch/initial_state'; import type { Account } from 'flavours/glitch/models/account'; import type { DropdownMenu } from 'flavours/glitch/models/dropdown_menu'; -import type { Relationship } from 'flavours/glitch/models/relationship'; import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION, @@ -183,20 +182,6 @@ const titleFromAccount = (account: Account) => { return `${prefix} (@${acct})`; }; -const messageForFollowButton = (relationship?: Relationship) => { - if (!relationship) return messages.follow; - - if (relationship.get('requested')) { - return messages.cancel_follow_request; - } else if (relationship.get('following')) { - return messages.unfollow; - } else if (relationship.get('followed_by')) { - return messages.followBack; - } else { - return messages.follow; - } -}; - const dateFormatOptions: Intl.DateTimeFormatOptions = { month: 'short', day: 'numeric', @@ -219,20 +204,6 @@ export const AccountHeader: React.FC<{ const hidden = useAppSelector((state) => getAccountHidden(state, accountId)); const handleLinkClick = useLinks(); - const handleFollow = useCallback(() => { - if (!account) { - return; - } - - if (relationship?.following || relationship?.requested) { - dispatch( - openModal({ modalType: 'CONFIRM_UNFOLLOW', modalProps: { account } }), - ); - } else { - dispatch(followAccount(account.id)); - } - }, [dispatch, account, relationship]); - const handleBlock = useCallback(() => { if (!account) { return; @@ -369,23 +340,6 @@ export const AccountHeader: React.FC<{ ); }, [dispatch, account]); - const handleInteractionModal = useCallback(() => { - if (!account) { - return; - } - - dispatch( - openModal({ - modalType: 'INTERACTION', - modalProps: { - type: 'follow', - accountId: account.id, - url: account.uri, - }, - }), - ); - }, [dispatch, account]); - const handleOpenAvatar = useCallback( (e: React.MouseEvent) => { if (e.button !== 0 || e.ctrlKey || e.metaKey) { @@ -421,10 +375,6 @@ export const AccountHeader: React.FC<{ }); }, [account]); - const handleEditProfile = useCallback(() => { - window.open('/settings/profile', '_blank'); - }, []); - const handleMouseEnter = useCallback( ({ currentTarget }: React.MouseEvent) => { if (autoPlayGif) { @@ -684,9 +634,12 @@ export const AccountHeader: React.FC<{ return null; } - let actionBtn, bellBtn, lockedIcon, shareBtn; + let actionBtn: React.ReactNode, + bellBtn: React.ReactNode, + lockedIcon: React.ReactNode, + shareBtn: React.ReactNode; - const info = []; + const info: React.ReactNode[] = []; if (me !== account.id && relationship?.followed_by) { info.push( @@ -763,43 +716,17 @@ export const AccountHeader: React.FC<{ ); } - if (me !== account.id) { - if (signedIn && !relationship) { - // Wait until the relationship is loaded - actionBtn = ( - - ); - } else if (!relationship?.blocking) { - actionBtn = ( -