mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
[Glitch] feat: Add relationship info to hover card
Port 975db93e3f to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -45,6 +45,19 @@ export const HoverCardAccount = forwardRef<
|
||||
|
||||
const { familiarFollowers } = useFetchFamiliarFollowers({ accountId });
|
||||
|
||||
const relationship = useAppSelector((state) =>
|
||||
accountId ? state.relationships.get(accountId) : undefined,
|
||||
);
|
||||
const isMutual = relationship?.followed_by && relationship.following;
|
||||
const isFollower = relationship?.followed_by;
|
||||
const hasRelationshipLoaded = !!relationship;
|
||||
|
||||
const shouldDisplayFamiliarFollowers =
|
||||
familiarFollowers.length > 0 &&
|
||||
hasRelationshipLoaded &&
|
||||
!isMutual &&
|
||||
!isFollower;
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
@@ -89,7 +102,7 @@ export const HoverCardAccount = forwardRef<
|
||||
value={account.followers_count}
|
||||
renderer={FollowersCounter}
|
||||
/>
|
||||
{familiarFollowers.length > 0 && (
|
||||
{shouldDisplayFamiliarFollowers && (
|
||||
<>
|
||||
·
|
||||
<div className='hover-card__familiar-followers'>
|
||||
@@ -105,6 +118,22 @@ export const HoverCardAccount = forwardRef<
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{(isMutual || isFollower) && (
|
||||
<>
|
||||
·
|
||||
{isMutual ? (
|
||||
<FormattedMessage
|
||||
id='account.mutual'
|
||||
defaultMessage='You follow each other'
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id='account.follows_you'
|
||||
defaultMessage='Follows you'
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<FollowButton accountId={accountId} />
|
||||
|
||||
Reference in New Issue
Block a user