1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-15 15:18:00 +09:00
elk/pages/@[account]/index.vue

27 lines
876 B
Vue
Raw Normal View History

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