2022-11-26 02:49:56 +03:00
|
|
|
<script setup lang="ts">
|
2023-01-23 22:33:21 +03:00
|
|
|
import type { mastodon } from 'masto'
|
|
|
|
|
2022-11-26 02:49:56 +03:00
|
|
|
const params = useRoute().params
|
2024-02-24 15:24:21 +03:00
|
|
|
const handle = computed(() => params.account as string)
|
2022-11-26 02:49:56 +03:00
|
|
|
|
2022-11-30 20:15:18 +03:00
|
|
|
definePageMeta({ name: 'account-index' })
|
|
|
|
|
2022-12-14 00:01:25 +03:00
|
|
|
const { t } = useI18n()
|
|
|
|
|
2024-02-21 18:20:08 +03:00
|
|
|
const account = await fetchAccountByHandle(handle.value)
|
2022-11-26 02:49:56 +03:00
|
|
|
|
2024-12-19 07:19:20 +03:00
|
|
|
// we need to ensure `pinned === true` on status
|
|
|
|
// because this prop is appeared only on current account's posts
|
|
|
|
function applyPinned(statuses: mastodon.v1.Status[]) {
|
|
|
|
return statuses.map((status) => {
|
|
|
|
status.pinned = true
|
|
|
|
return status
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-03-30 22:01:24 +03:00
|
|
|
function reorderAndFilter(items: mastodon.v1.Status[]) {
|
|
|
|
return reorderedTimeline(items, 'account')
|
|
|
|
}
|
2023-01-23 22:33:21 +03:00
|
|
|
|
2024-12-19 07:19:20 +03:00
|
|
|
const pinnedPaginator = useMastoClient().v1.accounts.$select(account.id).statuses.list({ pinned: true })
|
|
|
|
const postPaginator = useMastoClient().v1.accounts.$select(account.id).statuses.list({ limit: 30, excludeReplies: true })
|
2022-11-26 20:36:23 +03:00
|
|
|
|
2022-12-14 00:01:25 +03:00
|
|
|
if (account) {
|
2023-04-16 22:33:51 +03:00
|
|
|
useHydratedHead({
|
2023-01-02 03:00:13 +03:00
|
|
|
title: () => `${t('account.posts')} | ${getDisplayName(account)} (@${account.acct})`,
|
2022-12-14 00:01:25 +03:00
|
|
|
})
|
|
|
|
}
|
2022-11-26 02:49:56 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-12-03 08:42:00 +03:00
|
|
|
<div>
|
2022-12-14 00:01:25 +03:00
|
|
|
<AccountTabs />
|
2024-12-19 07:19:20 +03:00
|
|
|
<TimelinePaginator :paginator="pinnedPaginator" :preprocess="applyPinned" context="account" :account="account" :end-message="false" />
|
|
|
|
<!-- Upper border -->
|
|
|
|
<div h="1px" w-auto bg-border mb-1 />
|
|
|
|
<TimelinePaginator :paginator="postPaginator" :preprocess="reorderAndFilter" context="account" :account="account" />
|
2022-11-26 02:49:56 +03:00
|
|
|
</div>
|
|
|
|
</template>
|