Skip to content

Commit 6777d5c

Browse files
committed
refactor: expose has hability chart history flag from user store instead of dashboard overview store
`chart history seconds` is part of the `user` and `dashboard overview` data, but `rewards_history_seconds` is only part of `user` data See: BEDS-875
1 parent aa3f923 commit 6777d5c

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

frontend/components/dashboard/chart/DashboardChartSummaryFilter.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import { getGroupLabel } from '~/utils/dashboard/group'
1414
const { t: $t } = useTranslation()
1515
const validatorDashboardOverviewStore = useValidatorDashboardOverviewStore()
1616
const {
17-
hasAbilityCharthistory,
1817
overview,
1918
} = storeToRefs(validatorDashboardOverviewStore)
19+
const { hasAbilityChartHistory } = useUserStore()
2020
2121
const chartFilter = defineModel<SummaryChartFilter>({ required: true })
2222
@@ -25,7 +25,7 @@ const aggregation = ref<AggregationTimeframe>(chartFilter.value.aggregation)
2525
2626
const aggregationList = computed(() => {
2727
return AggregationTimeframes.map(timeframe => ({
28-
disabled: !hasAbilityCharthistory.value[timeframe],
28+
disabled: !hasAbilityChartHistory.value[timeframe],
2929
id: timeframe,
3030
label: $t(`time_frames.${timeframe}`),
3131
}))

frontend/stores/dashboard/useValidatorDashboardOverviewStore.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ export const useValidatorDashboardOverviewStore = defineStore('validator-dashboa
7373
)
7474
})
7575

76-
const hasAbilityCharthistory = computed(() => ({
77-
daily: (overview.value?.chart_history_seconds?.daily ?? 0) > 0,
78-
epoch: (overview.value?.chart_history_seconds?.epoch ?? 0) > 0,
79-
hourly: (overview.value?.chart_history_seconds?.hourly ?? 0) > 0,
80-
weekly: (overview.value?.chart_history_seconds?.weekly ?? 0) > 0,
81-
}))
82-
8376
const isLargeDashboard = computed(() => {
8477
if (!validatorCount.value) return false
8578

@@ -90,7 +83,6 @@ export const useValidatorDashboardOverviewStore = defineStore('validator-dashboa
9083
})
9184

9285
return {
93-
hasAbilityCharthistory,
9486
hasValidators,
9587
isLargeDashboard,
9688
loading,

frontend/stores/useUserStore.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,25 @@ export function useUserStore() {
5050

5151
const premium_perks = computed(() => user.value?.premium_perks)
5252

53+
const hasAbilityRewardsChartHistory = computed(() => ({
54+
daily: (user.value?.premium_perks.rewards_chart_history_seconds?.daily ?? 0) > 0,
55+
epoch: (user.value?.premium_perks.rewards_chart_history_seconds?.epoch ?? 0) > 0,
56+
hourly: (user.value?.premium_perks.rewards_chart_history_seconds?.hourly ?? 0) > 0,
57+
weekly: (user.value?.premium_perks.rewards_chart_history_seconds?.weekly ?? 0) > 0,
58+
}))
59+
60+
const hasAbilityChartHistory = computed(() => ({
61+
daily: (user.value?.premium_perks.chart_history_seconds?.daily ?? 0) > 0,
62+
epoch: (user.value?.premium_perks.chart_history_seconds?.epoch ?? 0) > 0,
63+
hourly: (user.value?.premium_perks.chart_history_seconds?.hourly ?? 0) > 0,
64+
weekly: (user.value?.premium_perks.chart_history_seconds?.weekly ?? 0) > 0,
65+
}))
66+
5367
return {
5468
doLogout,
5569
getUser,
70+
hasAbilityChartHistory,
71+
hasAbilityRewardsChartHistory,
5672
hasV1Notifications,
5773
isLoggedIn,
5874
premium_perks,

0 commit comments

Comments
 (0)