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;
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,
}
}

View file

@ -148,6 +148,10 @@
<span class="value">{{ profile.following_count }}</span>
<span class="label">following</span>
</component>
<div class="stats-item" v-if="isSubscriptionsFeatureEnabled()">
<span class="value">{{ profile.subscribers_count }}</span>
<span class="label">subscribers</span>
</div>
</div>
</div>
<div class="tab-bar">
@ -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()