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

27 lines
876 B
Vue
Raw Normal View History

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