feat: reorder and filter account timeline

This commit is contained in:
Ayo 2023-01-21 21:03:13 +01:00
parent ff211ea77e
commit 73a6678cb3
2 changed files with 6 additions and 2 deletions

View file

@ -3,7 +3,7 @@ import type { mastodon } from 'masto'
const paginator = useMastoClient().v1.timelines.listHome({ limit: 30 }) const paginator = useMastoClient().v1.timelines.listHome({ limit: 30 })
const stream = $(useStreaming(client => client.v1.stream.streamUser())) const stream = $(useStreaming(client => client.v1.stream.streamUser()))
const reorderAndFilter = (items: mastodon.v1.Status[]) => reorderedTimeline(items, 'home') const reorderAndFilter = (items: mastodon.v1.Status[]) => reorderedTimeline(items, 'account')
</script> </script>
<template> <template>

View file

@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { mastodon } from 'masto'
const params = useRoute().params const params = useRoute().params
const handle = $(computedEager(() => params.account as string)) const handle = $(computedEager(() => params.account as string))
@ -8,6 +10,8 @@ const { t } = useI18n()
const account = await fetchAccountByHandle(handle) const account = await fetchAccountByHandle(handle)
const reorderAndFilter = (items: mastodon.v1.Status[]) => reorderedTimeline(items, 'home')
const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { limit: 30, excludeReplies: true }) const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { limit: 30, excludeReplies: true })
if (account) { if (account) {
@ -20,6 +24,6 @@ if (account) {
<template> <template>
<div> <div>
<AccountTabs /> <AccountTabs />
<TimelinePaginator :paginator="paginator" :preprocess="reorderedTimeline" context="account" :account="account" /> <TimelinePaginator :paginator="paginator" :preprocess="reorderAndFilter" context="account" :account="account" />
</div> </div>
</template> </template>