Handle very-popular cases

- Shorten number
- Limit avatars to 50 since we have the Accounts sheet now
This commit is contained in:
Lim Chee Aun 2023-09-12 18:50:46 +08:00
parent 3fc3641437
commit 641d274d7b

View file

@ -1,3 +1,4 @@
import shortenNumber from '../utils/shorten-number';
import states from '../utils/states'; import states from '../utils/states';
import store from '../utils/store'; import store from '../utils/store';
@ -169,7 +170,10 @@ function Notification({ notification, instance, reload, isStatic }) {
{_accounts?.length > 1 ? ( {_accounts?.length > 1 ? (
<> <>
<b tabIndex="0" onClick={handleOpenGenericAccounts}> <b tabIndex="0" onClick={handleOpenGenericAccounts}>
{_accounts.length} people <span title={_accounts.length}>
{shortenNumber(_accounts.length)}
</span>{' '}
people
</b>{' '} </b>{' '}
</> </>
) : ( ) : (
@ -203,7 +207,7 @@ function Notification({ notification, instance, reload, isStatic }) {
)} )}
{_accounts?.length > 1 && ( {_accounts?.length > 1 && (
<p class="avatars-stack"> <p class="avatars-stack">
{_accounts.map((account, i) => ( {_accounts.slice(0, 50).map((account, i) => (
<> <>
<a <a
href={account.url} href={account.url}
@ -219,11 +223,11 @@ function Notification({ notification, instance, reload, isStatic }) {
size={ size={
_accounts.length <= 10 _accounts.length <= 10
? 'xxl' ? 'xxl'
: _accounts.length < 100 : _accounts.length < 20
? 'xl' ? 'xl'
: _accounts.length < 1000 : _accounts.length < 30
? 'l' ? 'l'
: _accounts.length < 2000 : _accounts.length < 40
? 'm' ? 'm'
: 's' // My god, this person is popular! : 's' // My god, this person is popular!
} }