elk/components/conversation/ConversationPaginator.vue

32 lines
898 B
Vue
Raw Normal View History

2022-11-18 10:37:22 +01:00
<script setup lang="ts">
2023-01-08 07:21:09 +01:00
import type { Paginator, mastodon } from 'masto'
2022-11-18 10:37:22 +01:00
const { paginator } = defineProps<{
2023-01-08 07:21:09 +01:00
paginator: Paginator<mastodon.v1.Conversation[], mastodon.DefaultPaginationParams>
2022-11-18 10:37:22 +01:00
}>()
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))
}
2022-11-18 10:37:22 +01:00
</script>
<template>
<CommonPaginator :paginator="paginator" :preprocess="preprocess">
2022-11-18 10:37:22 +01:00
<template #default="{ item }">
<ConversationCard
:conversation="item"
2022-11-23 03:16:31 +01:00
border="b base" py-1
2022-11-18 10:37:22 +01:00
/>
</template>
</CommonPaginator>
</template>