[Glitch] Profile redesign: Follow button and menu reorg

Port 346ca87ee8 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo authored and Claire committed 2026-02-03 15:57:49 +01:00
1 parent 3c2a06dc24
commit 82f7cdcb48
9 files changed
+714 -271

No files matched your search

@@ -71,10 +71,15 @@ export const DropdownMenuItemContent: React.FC<{ item: MenuItem }> = ({
return null;
}
const { text, description, icon } = item;
const { text, description, icon, iconId } = item;
return (
<>
{icon && <Icon icon={icon} id={`${text}-icon`} />}
{icon && (
<Icon
icon={icon}
id={iconId ?? text.toLowerCase().replaceAll(/[^a-z]+/g, '-')}
/>
)}
<span className='dropdown-menu__item-content'>
{text}
{Boolean(description) && (
@@ -5,6 +5,7 @@ import { useIntl, defineMessages } from 'react-intl';
import classNames from 'classnames';
import { useIdentity } from '@/flavours/glitch/identity_context';
import { isClientFeatureEnabled } from '@/flavours/glitch/utils/environment';
import {
fetchRelationships,
followAccount,
@@ -94,7 +95,17 @@ export const FollowButton: React.FC<{
if (accountId === me) {
return;
} else if (relationship.muting) {
} else if (relationship.blocking) {
dispatch(
openModal({
modalType: 'CONFIRM_UNBLOCK',
modalProps: { account },
}),
);
} else if (
relationship.muting &&
!isClientFeatureEnabled('profile_redesign')
) {
dispatch(unmuteAccount(accountId));
} else if (account && relationship.following) {
dispatch(
@@ -107,13 +118,6 @@ export const FollowButton: React.FC<{
modalProps: { account },
}),
);
} else if (relationship.blocking) {
dispatch(
openModal({
modalType: 'CONFIRM_UNBLOCK',
modalProps: { account },
}),
);
} else {
dispatch(followAccount(accountId));
}
@@ -136,7 +140,10 @@ export const FollowButton: React.FC<{
label = intl.formatMessage(messages.edit_profile);
} else if (!relationship) {
label = <LoadingIndicator />;
} else if (relationship.muting) {
} else if (
relationship.muting &&
!isClientFeatureEnabled('profile_redesign')
) {
label = intl.formatMessage(messages.unmute);
} else if (relationship.following) {
label = intl.formatMessage(messages.unfollow);
@@ -173,7 +180,7 @@ export const FollowButton: React.FC<{
(!(relationship?.following || relationship?.requested) &&
(account?.suspended || !!account?.moved))
}
secondary={following}
secondary={following || relationship?.blocking}
compact={compact}
className={classNames(className, { 'button--destructive': following })}
>