import {View} from 'react-native' import {type AppBskyActorDefs} from '@atproto/api' import {msg, plural} from '@lingui/macro' import {useLingui} from '@lingui/react' import {makeProfileLink} from '#/lib/routes/links' import {type Shadow} from '#/state/cache/types' import {useDisableFollowersMetrics} from '#/state/preferences/disable-followers-metrics' import {useDisableFollowingMetrics} from '#/state/preferences/disable-following-metrics' import {useDisablePostsMetrics} from '#/state/preferences/disable-posts-metrics' import {formatCount} from '#/view/com/util/numeric/format' import {atoms as a, useTheme} from '#/alf' import {InlineLinkText} from '#/components/Link' import {Text} from '#/components/Typography' export function ProfileHeaderMetrics({ profile, }: { profile: Shadow }) { const t = useTheme() const {_, i18n} = useLingui() const following = formatCount(i18n, profile.followsCount || 0) const followers = formatCount(i18n, profile.followersCount || 0) const pluralizedFollowers = plural(profile.followersCount || 0, { one: 'follower', other: 'followers', }) const pluralizedFollowings = plural(profile.followsCount || 0, { one: 'following', other: 'following', }) // disable metrics const disableFollowersMetrics = useDisableFollowersMetrics() const disableFollowingMetrics = useDisableFollowingMetrics() const disablePostsMetrics = useDisablePostsMetrics() return ( <> {disableFollowersMetrics && disableFollowingMetrics && disablePostsMetrics ? ( null ) : {!disableFollowersMetrics ? ( {followers} {pluralizedFollowers} ) : null} {!disableFollowingMetrics ? ( {following} {pluralizedFollowings} ) : null} {!disablePostsMetrics ? ( {formatCount(i18n, profile.postsCount || 0)}{' '} {plural(profile.postsCount || 0, {one: 'skeet', other: 'skeets'})} ) : null} } ) }