forked from Mirrors/elk
feat: reduce amount of big cards for follow notifications
This commit is contained in:
parent
089890677f
commit
1f5b0cf5ef
2 changed files with 40 additions and 18 deletions
|
@ -16,21 +16,33 @@ const isExpanded = ref(false)
|
||||||
<article flex flex-col relative>
|
<article flex flex-col relative>
|
||||||
<div flex items-center top-0 left-2 pt-2 px-3>
|
<div flex items-center top-0 left-2 pt-2 px-3>
|
||||||
<div i-ri:user-follow-fill mr-3 color-primary aria-hidden="true" />
|
<div i-ri:user-follow-fill mr-3 color-primary aria-hidden="true" />
|
||||||
<template v-if="addSR">
|
<template v-if="count > 1">
|
||||||
<span
|
<template v-if="addSR">
|
||||||
aria-hidden="true"
|
<span
|
||||||
>
|
aria-hidden="true"
|
||||||
{{ $t('notification.followed_you_count', count, { named: { followers: formatHumanReadableNumber(count) } }) }}
|
>
|
||||||
</span>
|
{{ $t('notification.followed_you_count', count, { named: { followers: formatHumanReadableNumber(count) } }) }}
|
||||||
<span sr-only>
|
</span>
|
||||||
|
<span sr-only>
|
||||||
|
{{ $t('notification.followed_you_count', count, { named: { followers: count } }) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<span v-else>
|
||||||
{{ $t('notification.followed_you_count', count, { named: { followers: count } }) }}
|
{{ $t('notification.followed_you_count', count, { named: { followers: count } }) }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<span v-else>
|
<template v-else>
|
||||||
{{ $t('notification.followed_you_count', count, { named: { followers: count } }) }}
|
<ContentRich
|
||||||
</span>
|
text-primary mr-1 font-bold line-clamp-1 ws-pre-wrap break-all
|
||||||
|
:content="getDisplayName(items.items[0]?.account, { rich: true })"
|
||||||
|
:emojis="items.items[0]?.account.emojis"
|
||||||
|
/>
|
||||||
|
<span mr-1 ws-nowrap>
|
||||||
|
{{ $t('notification.followed_you') }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div pt-1 pb-2>
|
<div pb-2>
|
||||||
<div v-if="isExpanded">
|
<div v-if="isExpanded">
|
||||||
<AccountCard
|
<AccountCard
|
||||||
v-for="item in items.items"
|
v-for="item in items.items"
|
||||||
|
@ -39,7 +51,7 @@ const isExpanded = ref(false)
|
||||||
p3
|
p3
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else flex="~ wrap gap-1" p4>
|
<div v-else flex="~ wrap gap-2" p4>
|
||||||
<AccountHoverWrapper
|
<AccountHoverWrapper
|
||||||
v-for="item in items.items"
|
v-for="item in items.items"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
|
|
@ -40,12 +40,22 @@ function groupItems(items: Notification[]): NotificationSlot[] {
|
||||||
// Only group follow notifications when there are too many in a row
|
// Only group follow notifications when there are too many in a row
|
||||||
// This normally happens when you transfer an account, if not, show
|
// This normally happens when you transfer an account, if not, show
|
||||||
// a big profile card for each follow
|
// a big profile card for each follow
|
||||||
if (group[0].type === 'follow' && group.length > minFollowGroupSize) {
|
if (group[0].type === 'follow') {
|
||||||
results.push({
|
const toGroup = []
|
||||||
id: `grouped-${id++}`,
|
for (const item of group) {
|
||||||
type: `grouped-${group[0].type}`,
|
const hasHeader = !item.account.header.endsWith('/original/missing.png')
|
||||||
items: group,
|
if (hasHeader && (item.account.followersCount > 250 || (group.length === 1 && item.account.followersCount > 25)))
|
||||||
})
|
results.push(item)
|
||||||
|
else
|
||||||
|
toGroup.push(item)
|
||||||
|
}
|
||||||
|
if (toGroup.length > 0) {
|
||||||
|
results.push({
|
||||||
|
id: `grouped-${id++}`,
|
||||||
|
type: `grouped-${group[0].type}`,
|
||||||
|
items: toGroup,
|
||||||
|
})
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue