2022-11-26 08:49:56 +09:00
|
|
|
<script setup lang="ts">
|
|
|
|
const params = useRoute().params
|
2022-11-28 02:34:45 +09:00
|
|
|
const accountName = $(computedEager(() => params.account as string))
|
2022-11-26 08:49:56 +09:00
|
|
|
|
|
|
|
const account = await fetchAccountByName(accountName)
|
2022-11-27 02:36:23 +09:00
|
|
|
const tabNames = ['Posts', 'Posts & replies', 'Media'] as const
|
2022-11-26 08:49:56 +09: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('Posts')
|
|
|
|
|
2022-11-27 00:42:58 +09:00
|
|
|
const paginatorPosts = useMasto().accounts.getStatusesIterable(account.id, { excludeReplies: true })
|
|
|
|
const paginatorPostsWithReply = useMasto().accounts.getStatusesIterable(account.id, { excludeReplies: false })
|
2022-11-27 02:36:23 +09:00
|
|
|
const paginatorMedia = useMasto().accounts.getStatusesIterable(account.id, { onlyMedia: true, excludeReplies: false })
|
2022-11-26 08:49:56 +09:00
|
|
|
|
|
|
|
const paginator = $computed(() => {
|
2022-11-27 02:36:23 +09:00
|
|
|
switch (tab) {
|
|
|
|
case 'Posts & replies':
|
|
|
|
return paginatorPostsWithReply
|
|
|
|
|
|
|
|
case 'Media':
|
|
|
|
return paginatorMedia
|
|
|
|
|
|
|
|
default:
|
|
|
|
return paginatorPosts
|
|
|
|
}
|
2022-11-26 08:49:56 +09:00
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<CommonTabs v-model="tab" :options="tabNames" />
|
|
|
|
<KeepAlive>
|
|
|
|
<TimelinePaginator :key="tab" :paginator="paginator" />
|
|
|
|
</KeepAlive>
|
|
|
|
</div>
|
|
|
|
</template>
|