From 5d5cdebb56ce199310a46870761c4723efe1c420 Mon Sep 17 00:00:00 2001 From: patak Date: Sun, 20 Nov 2022 22:38:52 +0100 Subject: [PATCH] feat: posts and mentions in profile (#17) --- components/common/CommonTabs.vue | 21 +++++++++++++++++++++ pages/@[user]/index.vue | 15 +++++++++++++-- pages/notifications.vue | 15 ++++----------- 3 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 components/common/CommonTabs.vue diff --git a/components/common/CommonTabs.vue b/components/common/CommonTabs.vue new file mode 100644 index 00000000..c5ab6c6d --- /dev/null +++ b/components/common/CommonTabs.vue @@ -0,0 +1,21 @@ + + + diff --git a/pages/@[user]/index.vue b/pages/@[user]/index.vue index dbde0b47..466fc416 100644 --- a/pages/@[user]/index.vue +++ b/pages/@[user]/index.vue @@ -7,12 +7,23 @@ const params = useRoute().params const user = $computed(() => params.user as string) const masto = await useMasto() const { data: account } = await useAsyncData(`${user}:info`, () => masto.accounts.lookup({ acct: user })) -const paginator = masto.accounts.getStatusesIterable(account.value!.id!, {}) + +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) +}) diff --git a/pages/notifications.vue b/pages/notifications.vue index 49260327..e4062d4d 100644 --- a/pages/notifications.vue +++ b/pages/notifications.vue @@ -1,16 +1,15 @@ @@ -23,13 +22,7 @@ const paginator = $computed(() => {
-
- -
+