File page: use compact follower count

This commit is contained in:
infinite-persistence 2022-01-10 11:13:07 +08:00
parent 1d4e1296ec
commit 0147af156c
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -10,6 +10,7 @@ import * as COLLECTIONS_CONSTS from 'constants/collections';
import { isChannelClaim } from 'util/claim'; import { isChannelClaim } from 'util/claim';
import { formatLbryUrlForWeb } from 'util/url'; import { formatLbryUrlForWeb } from 'util/url';
import { formatClaimPreviewTitle } from 'util/formatAriaLabel'; import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
import { toCompactNotation } from 'util/string';
import FileThumbnail from 'component/fileThumbnail'; import FileThumbnail from 'component/fileThumbnail';
import UriIndicator from 'component/uriIndicator'; import UriIndicator from 'component/uriIndicator';
import PreviewOverlayProperties from 'component/previewOverlayProperties'; import PreviewOverlayProperties from 'component/previewOverlayProperties';
@ -165,10 +166,12 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
if (channelSubCount === undefined) { if (channelSubCount === undefined) {
return <span />; return <span />;
} }
const formattedSubCount = Number(channelSubCount).toLocaleString();
return ( return (
<span className="claim-preview__channel-sub-count"> <span className="claim-preview__channel-sub-count">
{channelSubCount === 1 ? __('1 Follower') : __('%formattedSubCount% Followers', { formattedSubCount })} {channelSubCount === 1
? __('1 Follower')
: __('%formattedSubCount% Followers', { formattedSubCount: toCompactNotation(channelSubCount) })}
</span> </span>
); );
}, [channelSubCount]); }, [channelSubCount]);