Skip to content

Commit 3fb0209

Browse files
committed
fix: use current effective balance from dashboards data
See: BEDS-1258 See: BEDS-1271
1 parent 6c725e9 commit 3fb0209

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

frontend/components/dashboard/DashboardValidatorManagementModal.vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,17 @@ const {
273273
displayCurrencyDefault,
274274
formatAmount,
275275
} = useCurrency()
276+
const userDashboardStore = useUserDashboardStore()
277+
const {
278+
dashboards,
279+
} = storeToRefs(userDashboardStore)
280+
281+
const currentEffectiveBalance = computed(() => {
282+
const currentDashboard = dashboards.value?.validator_dashboards.find(
283+
validatorDashboard => `${validatorDashboard.id}` === dashboardKey.value,
284+
)
285+
return currentDashboard?.effective_balance
286+
})
276287
277288
const EFFECTIVE_BALANCE_LIMIT_GUEST_DASHBOARD_IN_ETH = '640'
278289
const effectiveBalanceLimitGuestDashboard = formatAmount(EFFECTIVE_BALANCE_LIMIT_GUEST_DASHBOARD_IN_ETH, {
@@ -293,8 +304,10 @@ const effectiveBalanceLimitPerDashboard = computed(() => {
293304
})
294305
295306
const hasReachedLimit = computed(() => {
296-
if (!overview.value?.balances) return false
297-
return effectiveBalanceLimitPerDashboard.value <= overview.value?.balances.effective
307+
if (!currentEffectiveBalance.value || !effectiveBalanceLimitPerDashboard.value) {
308+
return false
309+
}
310+
return currentEffectiveBalance.value >= effectiveBalanceLimitPerDashboard.value
298311
})
299312
300313
const hasPremiumPerkBulkAdding = computed(() => !!premium_perks.value?.bulk_adding)
@@ -582,7 +595,7 @@ const inputValidator = ref('')
582595
>
583596
<span>
584597
<BcFormatAmount
585-
:value="overview?.balances.effective ?? '0'"
598+
:value="currentEffectiveBalance ?? '0'"
586599
:maximum-fraction-digits="0"
587600
:source-currency="displayCurrencyDefault.main"
588601
/>
@@ -659,6 +672,7 @@ const inputValidator = ref('')
659672
flex-direction: column;
660673
overflow-y: hidden;
661674
justify-content: space-between;
675+
padding-bottom: var(--padding-medium);
662676
663677
:deep(.p-datatable-wrapper) {
664678
flex-grow: 1;

frontend/pages/dashboard/[[id]]/index.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,20 @@ const {
9797
refreshOverview,
9898
} = validatorDashboardOverviewStore
9999
100-
const hasReachedSubscriptionLimit = computed(() => {
101-
if (!premium_perks.value?.effective_balance_per_dashboard || !overview.value) {
100+
const currentEffectiveBalance = computed(() => {
101+
const currentDashboard = dashboards.value?.validator_dashboards.find(
102+
validatorDashboard => `${validatorDashboard.id}` === dashboardKey.value,
103+
)
104+
return currentDashboard?.effective_balance
105+
})
106+
107+
const hasReachedLimit = computed(() => {
108+
if (!currentEffectiveBalance.value || !premium_perks.value?.effective_balance_per_dashboard) {
102109
return false
103110
}
104-
return premium_perks.value?.effective_balance_per_dashboard
105-
<= overview.value?.balances.effective
111+
112+
return currentEffectiveBalance.value
113+
>= premium_perks.value?.effective_balance_per_dashboard
106114
})
107115
108116
await useAsyncData('user_dashboards', () => refreshDashboards(), { watch: [ isLoggedIn ] })
@@ -218,7 +226,7 @@ watch(
218226
<BcPageWrapper>
219227
<template #banner>
220228
<BcNotificationBanner
221-
v-if="hasReachedSubscriptionLimit"
229+
v-if="hasReachedLimit"
222230
:title="$t('dashboard.subsciprion_limit_reached_title')"
223231
>
224232
<BcTranslation

0 commit comments

Comments
 (0)