Show remaining count if exceed the avatars limit

This commit is contained in:
Lim Chee Aun 2023-09-16 23:42:49 +08:00
parent 887503e40b
commit dafff4b635

View file

@ -61,6 +61,8 @@ const contentText = {
'admin.report': 'reported a post.', 'admin.report': 'reported a post.',
}; };
const AVATARS_LIMIT = 50;
function Notification({ notification, instance, reload, isStatic }) { function Notification({ notification, instance, reload, isStatic }) {
const { id, status, account, _accounts, _statuses } = notification; const { id, status, account, _accounts, _statuses } = notification;
let { type } = notification; let { type } = notification;
@ -207,7 +209,7 @@ function Notification({ notification, instance, reload, isStatic }) {
)} )}
{_accounts?.length > 1 && ( {_accounts?.length > 1 && (
<p class="avatars-stack"> <p class="avatars-stack">
{_accounts.slice(0, 50).map((account, i) => ( {_accounts.slice(0, AVATARS_LIMIT).map((account, i) => (
<> <>
<a <a
href={account.url} href={account.url}
@ -254,6 +256,8 @@ function Notification({ notification, instance, reload, isStatic }) {
class="small plain" class="small plain"
onClick={handleOpenGenericAccounts} onClick={handleOpenGenericAccounts}
> >
{_accounts.length > AVATARS_LIMIT &&
`+${_accounts.length - AVATARS_LIMIT}`}
<Icon icon="chevron-down" /> <Icon icon="chevron-down" />
</button> </button>
</p> </p>