From 8799e30b9adffec1fc8f78490bbb9d234eb32a88 Mon Sep 17 00:00:00 2001 From: silverpill Date: Tue, 13 Sep 2022 17:38:27 +0000 Subject: [PATCH] Show subscriber count at profile page --- src/api/users.ts | 2 ++ src/views/Profile.vue | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/api/users.ts b/src/api/users.ts index 9f48879..a229ba3 100644 --- a/src/api/users.ts +++ b/src/api/users.ts @@ -37,6 +37,7 @@ export interface Profile { followers_count: number; following_count: number; + subscribers_count: number; statuses_count: number; } @@ -55,6 +56,7 @@ export function guest() { fields: [], followers_count: 0, following_count: 0, + subscribers_count: 0, statuses_count: 0, } } diff --git a/src/views/Profile.vue b/src/views/Profile.vue index 2f8b723..e159cfa 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -148,6 +148,10 @@ {{ profile.following_count }} following +
+ {{ profile.subscribers_count }} + subscribers +
@@ -433,20 +437,22 @@ async function onVerifyEthereumAddress() { } } -function canManageSubscriptions(): boolean { - // Only users with verified address can configure subscription +function isSubscriptionsFeatureEnabled(): boolean { const blockchain = instance?.blockchains[0] + return Boolean(blockchain?.features.subscriptions) +} + +function canManageSubscriptions(): boolean { return ( - Boolean(blockchain?.features.subscriptions) && + isSubscriptionsFeatureEnabled() && profile !== null && isCurrentUser() ) } function canSubscribe(): boolean { - const blockchain = instance?.blockchains[0] return ( - Boolean(blockchain?.features.subscriptions) && + isSubscriptionsFeatureEnabled() && profile !== null && profile.getSubscriptionPageLocation() !== null && !isCurrentUser()