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

30 lines
973 B
Vue
Raw Normal View History

2022-11-13 19:05:32 +03:00
<script setup lang="ts">
const props = defineProps<{
modelValue?: boolean
}>()
const params = useRoute().params
2022-11-15 15:08:49 +03:00
const user = $computed(() => params.user as string)
2022-11-15 06:26:52 +03:00
const masto = await useMasto()
2022-11-15 15:08:49 +03:00
const { data: account } = await useAsyncData(`${user}:info`, () => masto.accounts.lookup({ acct: user }))
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')
const paginator = $computed(() => {
// bug in Masto.js, it should convert `excludeReplies` to `exclude_replies`
// https://github.com/neet/masto.js/issues/689
return masto.accounts.getStatusesIterable(account.value!.id!, { exclude_replies: tab === 'Posts' } as any)
})
2022-11-13 19:05:32 +03:00
</script>
<template>
<div>
2022-11-15 06:26:52 +03:00
<AccountHeader :account="account" />
2022-11-13 19:05:32 +03:00
</div>
<CommonTabs v-model="tab" :options="tabNames" />
<TimelinePaginator :key="tab" :paginator="paginator" />
2022-11-13 19:05:32 +03:00
</template>