Show subscriber count at profile page

This commit is contained in:
silverpill 2022-09-13 17:38:27 +00:00
parent 349e500494
commit 8799e30b9a
2 changed files with 13 additions and 5 deletions

View file

@ -37,6 +37,7 @@ export interface Profile {
followers_count: number; followers_count: number;
following_count: number; following_count: number;
subscribers_count: number;
statuses_count: number; statuses_count: number;
} }
@ -55,6 +56,7 @@ export function guest() {
fields: [], fields: [],
followers_count: 0, followers_count: 0,
following_count: 0, following_count: 0,
subscribers_count: 0,
statuses_count: 0, statuses_count: 0,
} }
} }

View file

@ -148,6 +148,10 @@
<span class="value">{{ profile.following_count }}</span> <span class="value">{{ profile.following_count }}</span>
<span class="label">following</span> <span class="label">following</span>
</component> </component>
<div class="stats-item" v-if="isSubscriptionsFeatureEnabled()">
<span class="value">{{ profile.subscribers_count }}</span>
<span class="label">subscribers</span>
</div>
</div> </div>
</div> </div>
<div class="tab-bar"> <div class="tab-bar">
@ -433,20 +437,22 @@ async function onVerifyEthereumAddress() {
} }
} }
function canManageSubscriptions(): boolean { function isSubscriptionsFeatureEnabled(): boolean {
// Only users with verified address can configure subscription
const blockchain = instance?.blockchains[0] const blockchain = instance?.blockchains[0]
return Boolean(blockchain?.features.subscriptions)
}
function canManageSubscriptions(): boolean {
return ( return (
Boolean(blockchain?.features.subscriptions) && isSubscriptionsFeatureEnabled() &&
profile !== null && profile !== null &&
isCurrentUser() isCurrentUser()
) )
} }
function canSubscribe(): boolean { function canSubscribe(): boolean {
const blockchain = instance?.blockchains[0]
return ( return (
Boolean(blockchain?.features.subscriptions) && isSubscriptionsFeatureEnabled() &&
profile !== null && profile !== null &&
profile.getSubscriptionPageLocation() !== null && profile.getSubscriptionPageLocation() !== null &&
!isCurrentUser() !isCurrentUser()