elk/pages/@[account]/index.vue

27 lines
876 B
Vue
Raw Normal View History

2022-11-13 16:05:32 +00:00
<script setup lang="ts">
const params = useRoute().params
2022-11-24 05:47:14 +00:00
const accountName = $computed(() => params.account as string)
2022-11-24 05:47:14 +00:00
const account = await fetchAccountByName(accountName)
const tabNames = ['Posts', 'Posts and replies'] as const
// 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-25 09:50:49 +00:00
const paginatorPosts = masto.accounts.getStatusesIterable(account.id, { excludeReplies: true })
const paginatorPostsWithReply = masto.accounts.getStatusesIterable(account.id, { excludeReplies: false })
2022-11-24 06:18:05 +00:00
const paginator = $computed(() => {
2022-11-25 09:50:49 +00:00
return tab === 'Posts' ? paginatorPosts : paginatorPostsWithReply
})
2022-11-13 16:05:32 +00:00
</script>
<template>
2022-11-24 06:18:05 +00:00
<div>
2022-11-23 17:16:10 +00:00
<CommonTabs v-model="tab" :options="tabNames" />
2022-11-24 06:18:05 +00:00
<KeepAlive>
<TimelinePaginator :key="tab" :paginator="paginator" />
</KeepAlive>
</div>
2022-11-13 16:05:32 +00:00
</template>