elk/components/conversation/ConversationPaginator.vue

31 lines
898 B
Vue

<script setup lang="ts">
import type { Paginator, mastodon } from 'masto'
const { paginator } = defineProps<{
paginator: Paginator<mastodon.v1.Conversation[], mastodon.DefaultPaginationParams>
}>()
function preprocess(items: mastodon.v1.Conversation[]) {
const filteredIndices = items.map(
(items, index) => (
{
status: items.lastStatus,
index,
}))
.filter(item => !!item.status?.filtered?.find(filter => filter.filter.filterAction === 'hide' && filter.filter.context.includes('thread')))
.map(item => item.index)
return items.filter((_, index) => !filteredIndices.includes(index))
}
</script>
<template>
<CommonPaginator :paginator="paginator" :preprocess="preprocess">
<template #default="{ item }">
<ConversationCard
:conversation="item"
border="b base" py-1
/>
</template>
</CommonPaginator>
</template>