Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Format large numbers (#556)

authored by

Ollie H and committed by
GitHub
0ec98c77 7171d040

+11 -4
+3 -2
src/view/com/profile/ProfileHeader.tsx
··· 33 33 import {isDesktopWeb} from 'platform/detection' 34 34 import {FollowState} from 'state/models/cache/my-follows' 35 35 import {shareUrl} from 'lib/sharing' 36 + import {formatCount} from '../util/numeric/format' 36 37 37 38 const BACK_HITSLOP = {left: 30, top: 30, right: 30, bottom: 30} 38 39 ··· 364 365 style={[s.flexRow, s.mr10]} 365 366 onPress={onPressFollowers}> 366 367 <Text type="md" style={[s.bold, s.mr2, pal.text]}> 367 - {view.followersCount} 368 + {formatCount(view.followersCount)} 368 369 </Text> 369 370 <Text type="md" style={[pal.textLight]}> 370 371 {pluralize(view.followersCount, 'follower')} ··· 375 376 style={[s.flexRow, s.mr10]} 376 377 onPress={onPressFollows}> 377 378 <Text type="md" style={[s.bold, s.mr2, pal.text]}> 378 - {view.followsCount} 379 + {formatCount(view.followsCount)} 379 380 </Text> 380 381 <Text type="md" style={[pal.textLight]}> 381 382 following
+5
src/view/com/util/numeric/format.ts
··· 1 + export const formatCount = (num: number) => 2 + Intl.NumberFormat('en-US', { 3 + notation: 'compact', 4 + maximumFractionDigits: 1, 5 + }).format(num)
+3 -2
src/view/shell/Drawer.tsx
··· 39 39 import {NavigationProp} from 'lib/routes/types' 40 40 import {useNavigationTabState} from 'lib/hooks/useNavigationTabState' 41 41 import {isWeb} from 'platform/detection' 42 + import {formatCount} from 'view/com/util/numeric/format' 42 43 43 44 export const DrawerContent = observer(() => { 44 45 const theme = useTheme() ··· 133 134 type="xl" 134 135 style={[pal.textLight, styles.profileCardFollowers]}> 135 136 <Text type="xl-medium" style={pal.text}> 136 - {store.me.followersCount || 0} 137 + {formatCount(store.me.followersCount ?? 0)} 137 138 </Text>{' '} 138 139 {pluralize(store.me.followersCount || 0, 'follower')} &middot;{' '} 139 140 <Text type="xl-medium" style={pal.text}> 140 - {store.me.followsCount || 0} 141 + {formatCount(store.me.followsCount ?? 0)} 141 142 </Text>{' '} 142 143 following 143 144 </Text>