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

31 lines
899 B
Vue
Raw Normal View History

2022-11-14 01:05:32 +09:00
<script setup lang="ts">
const props = defineProps<{
modelValue?: boolean
}>()
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-24 15:18:05 +09:00
const paginator1 = masto.accounts.getStatusesIterable(account.id, { excludeReplies: true })
const paginator2 = masto.accounts.getStatusesIterable(account.id, { excludeReplies: false })
const paginator = $computed(() => {
2022-11-24 15:18:05 +09:00
return tab === 'Posts' ? paginator1 : paginator2
})
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>