-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Show warning for high profile accounts based on follower count (#235)
* ✨ Show warning for high profile accounts based on follower count * 💄 Use better number formatting
- Loading branch information
Showing
3 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Alert } from '@/common/Alert' | ||
import { HIGH_PROFILE_FOLLOWER_THRESHOLD } from '@/lib/constants' | ||
import { AppBskyActorDefs } from '@atproto/api' | ||
|
||
const numberFormatter = new Intl.NumberFormat('en', { | ||
notation: 'compact', | ||
compactDisplay: 'short', | ||
}) | ||
|
||
export const HighProfileWarning = ({ | ||
profile, | ||
}: { | ||
profile: AppBskyActorDefs.ProfileViewDetailed | ||
}) => { | ||
const { followersCount } = profile | ||
|
||
if (!followersCount || followersCount < HIGH_PROFILE_FOLLOWER_THRESHOLD) { | ||
return null | ||
} | ||
|
||
return ( | ||
<Alert | ||
type="warning" | ||
title="High profile account" | ||
body={`This user has more than ${numberFormatter.format( | ||
HIGH_PROFILE_FOLLOWER_THRESHOLD, | ||
)} followers (${numberFormatter.format( | ||
followersCount, | ||
)} total). Please take caution when moderating this account.`} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters