2022-11-25 23:49:56 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
const params = useRoute().params
|
2022-11-27 17:34:45 +00:00
|
|
|
const accountName = $(computedEager(() => params.account as string))
|
2022-11-25 23:49:56 +00:00
|
|
|
|
|
|
|
const account = await fetchAccountByName(accountName)
|
2022-11-29 07:18:28 +00:00
|
|
|
const { t } = useI18n()
|
2022-11-25 23:49:56 +00:00
|
|
|
|
2022-11-26 15:42:58 +00:00
|
|
|
const paginatorPosts = useMasto().accounts.getStatusesIterable(account.id, { excludeReplies: true })
|
|
|
|
const paginatorPostsWithReply = useMasto().accounts.getStatusesIterable(account.id, { excludeReplies: false })
|
2022-11-26 17:36:23 +00:00
|
|
|
const paginatorMedia = useMasto().accounts.getStatusesIterable(account.id, { onlyMedia: true, excludeReplies: false })
|
2022-11-25 23:49:56 +00:00
|
|
|
|
2022-11-29 07:18:28 +00:00
|
|
|
const tabs = $computed(() => [
|
|
|
|
{
|
|
|
|
name: 'posts',
|
|
|
|
display: t('tab.posts'),
|
2022-11-29 08:15:05 +00:00
|
|
|
icon: 'i-ri:file-list-2-line',
|
2022-11-29 07:18:28 +00:00
|
|
|
paginator: paginatorPosts,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'relies',
|
|
|
|
display: t('tab.posts_with_replies'),
|
2022-11-29 08:15:05 +00:00
|
|
|
icon: 'i-ri:chat-3-line',
|
2022-11-29 07:18:28 +00:00
|
|
|
paginator: paginatorPostsWithReply,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'media',
|
|
|
|
display: t('tab.media'),
|
2022-11-29 08:15:05 +00:00
|
|
|
icon: 'i-ri:camera-2-line',
|
2022-11-29 07:18:28 +00:00
|
|
|
paginator: paginatorMedia,
|
|
|
|
},
|
|
|
|
] as const)
|
2022-11-26 17:36:23 +00:00
|
|
|
|
2022-11-29 07:18:28 +00:00
|
|
|
// Don't use local storage because it is better to default to Posts every time you visit a user's profile.
|
|
|
|
const tab = $ref(tabs[0].name)
|
|
|
|
const paginator = $computed(() => tabs.find(t => t.name === tab)!.paginator)
|
2022-11-25 23:49:56 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
2022-11-29 08:15:05 +00:00
|
|
|
<CommonTabs v-model="tab" :options="tabs" command />
|
2022-11-25 23:49:56 +00:00
|
|
|
<KeepAlive>
|
|
|
|
<TimelinePaginator :key="tab" :paginator="paginator" />
|
|
|
|
</KeepAlive>
|
|
|
|
</div>
|
|
|
|
</template>
|