From a1cc412ef94c1794401a134743125f14daa4180a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Tue, 7 Apr 2026 21:48:24 +0000 Subject: [PATCH] nicolium: improve hidden follows display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- .../src/components/accounts/profile-stats.tsx | 73 ++++++++++++++----- packages/nicolium/src/locales/en.json | 2 + 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/packages/nicolium/src/components/accounts/profile-stats.tsx b/packages/nicolium/src/components/accounts/profile-stats.tsx index d524fb55a..4085ac03f 100644 --- a/packages/nicolium/src/components/accounts/profile-stats.tsx +++ b/packages/nicolium/src/components/accounts/profile-stats.tsx @@ -2,6 +2,7 @@ import { Link } from '@tanstack/react-router'; import React from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; +import { useCurrentAccount } from '@/contexts/current-account-context'; import { useSettings } from '@/stores/settings'; import { shortNumberFormat } from '@/utils/numbers'; @@ -27,7 +28,16 @@ interface IProfileStats { account: | Pick< Account, - 'acct' | 'followers_count' | 'following_count' | 'statuses_count' | 'subscribers_count' + | 'acct' + | 'followers_count' + | 'following_count' + | 'hide_followers' + | 'hide_followers_count' + | 'hide_follows' + | 'hide_follows_count' + | 'id' + | 'statuses_count' + | 'subscribers_count' > | undefined; onClickHandler?: React.MouseEventHandler; @@ -37,11 +47,20 @@ interface IProfileStats { const ProfileStats: React.FC = ({ account, onClickHandler }) => { const intl = useIntl(); const { demetricator } = useSettings(); + const me = useCurrentAccount(); + + const ownAccount = account?.id === me; if (!account) { return null; } + const showFollowers = ownAccount || !account.hide_followers_count || !account.hide_followers; + const showFollowing = ownAccount || !account.hide_follows_count || !account.hide_follows; + + const FollowersComponent = !account.hide_followers || ownAccount ? Link : 'div'; + const FollowingComponent = !account.hide_follows || ownAccount ? Link : 'div'; + return (
{!demetricator && ( @@ -51,27 +70,43 @@ const ProfileStats: React.FC = ({ account, onClickHandler }) => {
)} - - {!demetricator && {shortNumberFormat(account.followers_count)}} + {showFollowers ? ( + + {!demetricator && !(account.hide_followers_count && !ownAccount) && ( + {shortNumberFormat(account.followers_count)} + )} - - + + + ) : ( +
+ +
+ )} - - {!demetricator && {shortNumberFormat(account.following_count)}} + {showFollowing ? ( + + {!demetricator && !(account.hide_follows_count && !ownAccount) && ( + {shortNumberFormat(account.following_count)} + )} - - + + + ) : ( +
+ +
+ )} {account.subscribers_count > 0 && (