2022-11-30 08:47:54 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { GroupedNotifications } from '~/types'
|
|
|
|
|
|
|
|
const { items } = defineProps<{
|
|
|
|
items: GroupedNotifications
|
|
|
|
}>()
|
|
|
|
|
2025-01-25 00:21:57 +09:00
|
|
|
const maxVisibleFollows = 5
|
|
|
|
const follows = computed(() => items.items)
|
|
|
|
const visibleFollows = computed(() => follows.value.slice(0, maxVisibleFollows))
|
|
|
|
const count = computed(() => follows.value.length)
|
|
|
|
const countPlus = computed(() => Math.max(count.value - maxVisibleFollows, 0))
|
2022-11-30 08:47:54 +08:00
|
|
|
const isExpanded = ref(false)
|
2024-02-21 16:20:08 +01:00
|
|
|
const lang = computed(() => {
|
|
|
|
return (count.value > 1 || count.value === 0) ? undefined : items.items[0].status?.language
|
2022-12-27 22:04:52 +01:00
|
|
|
})
|
2022-11-30 08:47:54 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-01-01 16:29:11 +02:00
|
|
|
<article flex flex-col relative :lang="lang ?? undefined">
|
2022-12-06 12:07:17 +01:00
|
|
|
<div flex items-center top-0 left-2 pt-2 px-3>
|
2023-09-08 18:14:19 +02:00
|
|
|
<div :class="count > 1 ? 'i-ri-group-line' : 'i-ri-user-3-line'" me-3 color-blue text-xl aria-hidden="true" />
|
2022-12-14 00:06:53 +01:00
|
|
|
<template v-if="count > 1">
|
2025-01-25 00:21:57 +09:00
|
|
|
<AccountHoverWrapper
|
|
|
|
:account="follows[0].account"
|
|
|
|
>
|
|
|
|
<NuxtLink :to="getAccountRoute(follows[0].account)">
|
|
|
|
<AccountDisplayName
|
|
|
|
:account="follows[0].account"
|
|
|
|
text-primary font-bold line-clamp-1 ws-pre-wrap break-all hover:underline
|
|
|
|
/>
|
|
|
|
</NuxtLink>
|
|
|
|
</AccountHoverWrapper>
|
|
|
|
{{ $t('notification.and') }}
|
2023-01-09 13:24:26 +02:00
|
|
|
<CommonLocalizedNumber
|
2025-01-25 00:21:57 +09:00
|
|
|
keypath="notification.others"
|
|
|
|
:count="count - 1"
|
|
|
|
text-primary font-bold line-clamp-1 ws-pre-wrap break-all
|
2023-01-09 13:24:26 +02:00
|
|
|
/>
|
2025-01-25 00:21:57 +09:00
|
|
|
{{ $t('notification.followed_you') }}
|
2022-12-02 03:18:36 +01:00
|
|
|
</template>
|
2024-04-07 01:29:38 -07:00
|
|
|
<template v-else-if="count === 1">
|
2025-01-25 00:21:57 +09:00
|
|
|
<NuxtLink :to="getAccountRoute(follows[0].account)">
|
2024-04-07 01:29:38 -07:00
|
|
|
<AccountDisplayName
|
2025-01-25 00:21:57 +09:00
|
|
|
:account="follows[0].account"
|
|
|
|
text-primary me-1 font-bold line-clamp-1 ws-pre-wrap break-all hover:underline
|
2024-04-07 01:29:38 -07:00
|
|
|
/>
|
|
|
|
</NuxtLink>
|
2023-01-01 16:29:11 +02:00
|
|
|
<span me-1 ws-nowrap>
|
2022-12-14 00:06:53 +01:00
|
|
|
{{ $t('notification.followed_you') }}
|
|
|
|
</span>
|
|
|
|
</template>
|
2022-11-30 08:47:54 +08:00
|
|
|
</div>
|
2023-09-08 18:14:19 +02:00
|
|
|
<div pb-2 ps8>
|
2025-01-25 00:21:57 +09:00
|
|
|
<div
|
|
|
|
v-if="!isExpanded && count > 1"
|
|
|
|
flex="~ wrap gap-1.75" p4 items-center cursor-pointer
|
|
|
|
@click="isExpanded = !isExpanded"
|
|
|
|
>
|
|
|
|
<AccountHoverWrapper
|
|
|
|
v-for="follow in visibleFollows"
|
|
|
|
:key="follow.id"
|
|
|
|
:account="follow.account"
|
|
|
|
>
|
|
|
|
<NuxtLink :to="getAccountRoute(follow.account)">
|
|
|
|
<AccountAvatar :account="follow.account" w-12 h-12 />
|
|
|
|
</NuxtLink>
|
|
|
|
</AccountHoverWrapper>
|
|
|
|
<div flex="~ 1" items-center>
|
|
|
|
<span v-if="countPlus > 0" ps-2 text="base lg">+{{ countPlus }}</span>
|
|
|
|
<div i-ri:arrow-down-s-line mx-1 text-secondary text-xl aria-hidden="true" />
|
|
|
|
</div>
|
2022-12-06 12:07:17 +01:00
|
|
|
</div>
|
2025-01-25 00:21:57 +09:00
|
|
|
<div v-else>
|
|
|
|
<div v-if="count > 1" flex p-4 pb-2 cursor-pointer @click="isExpanded = !isExpanded">
|
|
|
|
<div i-ri:arrow-up-s-line ms-2 text-secondary text-xl aria-hidden="true" />
|
|
|
|
<span ps-2 text-base>Hide</span>
|
|
|
|
</div>
|
2022-12-06 12:07:17 +01:00
|
|
|
<AccountHoverWrapper
|
2025-01-25 00:21:57 +09:00
|
|
|
v-for="follow in follows"
|
|
|
|
:key="follow.id"
|
|
|
|
:account="follow.account"
|
2022-12-06 12:07:17 +01:00
|
|
|
>
|
2025-01-25 00:21:57 +09:00
|
|
|
<NuxtLink :to="getAccountRoute(follow.account)" flex gap-4 px-4 py-2>
|
|
|
|
<AccountAvatar :account="follow.account" w-12 h-12 />
|
|
|
|
<StatusAccountDetails :account="follow.account" />
|
2022-12-06 12:07:17 +01:00
|
|
|
</NuxtLink>
|
|
|
|
</AccountHoverWrapper>
|
|
|
|
</div>
|
2022-11-30 08:47:54 +08:00
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
</template>
|