Use SI notation for view_count in tiles (locale aware)
This commit is contained in:
parent
579230d135
commit
bbcdcfe4c1
2 changed files with 8 additions and 2 deletions
|
@ -1,12 +1,14 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { makeSelectViewCountForUri } from 'lbryinc';
|
||||
import { selectLanguage } from 'redux/selectors/settings';
|
||||
import FileViewCountInline from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
return {
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
viewCount: makeSelectViewCountForUri(props.uri)(state),
|
||||
lang: selectLanguage(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -7,11 +7,15 @@ type Props = {
|
|||
// --- select ---
|
||||
claim: ?StreamClaim,
|
||||
viewCount: string,
|
||||
lang: ?string,
|
||||
};
|
||||
|
||||
export default function FileViewCountInline(props: Props) {
|
||||
const { isLivestream, claim, viewCount } = props;
|
||||
const formattedViewCount = Number(viewCount).toLocaleString();
|
||||
const { isLivestream, claim, viewCount, lang } = props;
|
||||
const formattedViewCount = Number(viewCount).toLocaleString(lang || 'en', {
|
||||
compactDisplay: 'short',
|
||||
notation: 'compact',
|
||||
});
|
||||
|
||||
if (!viewCount || (claim && claim.repost_url) || isLivestream) {
|
||||
// (1) Currently, makeSelectViewCountForUri doesn't differentiate between
|
||||
|
|
Loading…
Add table
Reference in a new issue