From 91f766a6876aa3c96ca29459fe61f9d7f5650b5b Mon Sep 17 00:00:00 2001 From: lukeacl Date: Fri, 30 Aug 2024 12:05:45 +1000 Subject: [PATCH] Provide full tooltips on counts when truncated and rounded. --- src/screens/Profile/Header/Metrics.tsx | 30 +++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/screens/Profile/Header/Metrics.tsx b/src/screens/Profile/Header/Metrics.tsx index 30686ef99c..68b5e12e93 100644 --- a/src/screens/Profile/Header/Metrics.tsx +++ b/src/screens/Profile/Header/Metrics.tsx @@ -29,16 +29,28 @@ export function ProfileHeaderMetrics({ other: 'following', }) + const tooltipFormattedCountIfNeeded = (count: number) => { + const standardCount = i18n.number(count, { + notation: 'standard', + }) + const formattedCount = formatCount(i18n, count) + return standardCount !== formattedCount ? {tooltip: standardCount} : {} + } + return ( - {followers} + + {followers}{' '} + {pluralizedFollowers} @@ -48,13 +60,21 @@ export function ProfileHeaderMetrics({ style={[a.flex_row, t.atoms.text]} to={makeProfileLink(profile, 'follows')} label={_(msg`${following} following`)}> - {following} + + {following}{' '} + {pluralizedFollowings} - - {formatCount(i18n, profile.postsCount || 0)}{' '} + + + {formatCount(i18n, profile.postsCount || 0)}{' '} + {plural(profile.postsCount || 0, {one: 'post', other: 'posts'})}