Skip to content

Commit

Permalink
hide add validator, center notification (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
MauserBitfly authored Jun 4, 2024
1 parent 3d5dc09 commit e0b2f4b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion frontend/components/dashboard/DashboardHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const editDashboard = () => {
<div class="dashboard-buttons">
<Menubar :class="menuBarClass" :model="items" breakpoint="0px">
<template #item="{ item }">
<BcTooltip v-if="item.disabledTooltip" :text="item.disabledTooltip" @click.stop.prevent="() => undefined">
<BcTooltip v-if="item.disabledTooltip" :text="item.disabledTooltip" class="button-content" @click.stop.prevent="() => undefined">
<span class="text-disabled">{{ item.label }}</span>
</BcTooltip>
<BcLink v-else-if="item.route" :to="item.route" class="pointer" :class="{ 'p-active': item.active }">
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/dashboard/table/DashboardTableBlocks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const { blocks, query: lastQuery, isLoading, getBlocks } = useValidatorDashboard
const { value: query, temp: tempQuery, bounce: setQuery } = useDebounceValue<TableQueryParams | undefined>(undefined, 500)
const { groups } = useValidatorDashboardGroups()
const { hasValidators } = useValidatorDashboardOverviewStore()
const { width } = useWindowSize()
const colsVisible = computed(() => {
Expand Down Expand Up @@ -263,7 +264,7 @@ const isRowExpandable = (row: VDBBlocksTableRow) => {
</div>
</template>
<template #empty>
<DashboardTableAddValidator />
<DashboardTableAddValidator v-if="!hasValidators" />
</template>
</BcTable>
</ClientOnly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const { slotToEpoch } = useNetwork()
const { deposits, query: lastQuery, getDeposits, getTotalAmount, totalAmount, isLoadingDeposits, isLoadingTotal } = useValidatorDashboardClDepositsStore()
const { value: query, bounce: setQuery } = useDebounceValue<TableQueryParams | undefined>(undefined, 500)
const { overview } = useValidatorDashboardOverviewStore()
const { overview, hasValidators } = useValidatorDashboardOverviewStore()
const { groups } = useValidatorDashboardGroups()
const { width } = useWindowSize()
Expand Down Expand Up @@ -303,7 +303,7 @@ const isRowExpandable = (row: VDBConsensusDepositsTableRow) => {
</div>
</template>
<template #empty>
<DashboardTableAddValidator />
<DashboardTableAddValidator v-if="!hasValidators" />
</template>
</BcTable>
</ClientOnly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { t: $t } = useI18n()
const { deposits, query: lastQuery, getDeposits, getTotalAmount, totalAmount, isLoadingDeposits, isLoadingTotal } = useValidatorDashboardElDepositsStore()
const { value: query, bounce: setQuery } = useDebounceValue<TableQueryParams | undefined>(undefined, 500)
const { overview } = useValidatorDashboardOverviewStore()
const { overview, hasValidators } = useValidatorDashboardOverviewStore()
const { groups } = useValidatorDashboardGroups()
const { width } = useWindowSize()
Expand Down Expand Up @@ -286,7 +286,7 @@ const isRowExpandable = (row: VDBExecutionDepositsTableRow) => {
</div>
</template>
<template #empty>
<DashboardTableAddValidator />
<DashboardTableAddValidator v-if="!hasValidators" />
</template>
</BcTable>
</ClientOnly>
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/dashboard/table/DashboardTableRewards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const { value: query, temp: tempQuery, bounce: setQuery } = useDebounceValue<Tab
const { slotViz } = useValidatorSlotVizStore()
const { groups } = useValidatorDashboardGroups()
const { overview } = useValidatorDashboardOverviewStore()
const { overview, hasValidators } = useValidatorDashboardOverviewStore()
const { width } = useWindowSize()
const colsVisible = computed(() => {
Expand Down Expand Up @@ -247,7 +247,7 @@ const wrappedRewards = computed(() => {
/>
</template>
<template #empty>
<DashboardTableAddValidator />
<DashboardTableAddValidator v-if="!hasValidators" />
</template>
</BcTable>
</ClientOnly>
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/dashboard/table/DashboardTableSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const showInDevelopment = Boolean(useRuntimeConfig().public.showInDevelopment)
const { summary, query: lastQuery, isLoading, getSummary } = useValidatorDashboardSummaryStore()
const { value: query, temp: tempQuery, bounce: setQuery } = useDebounceValue<TableQueryParams | undefined>(undefined, 500)
const { overview } = useValidatorDashboardOverviewStore()
const { overview, hasValidators } = useValidatorDashboardOverviewStore()
const { groups } = useValidatorDashboardGroups()
const { width } = useWindowSize()
Expand Down Expand Up @@ -167,7 +167,7 @@ const getRowClass = (row: VDBSummaryTableRow) => {
<DashboardTableSummaryDetails :row="slotProps.data" />
</template>
<template #empty>
<DashboardTableAddValidator />
<DashboardTableAddValidator v-if="!hasValidators" />
</template>
</BcTable>
</ClientOnly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const { withdrawals, query: lastQuery, getWithdrawals, totalAmount, getTotalAmou
const { value: query, temp: tempQuery, bounce: setQuery } = useDebounceValue<TableQueryParams | undefined>(undefined, 500)
const totalIdentifier = 'total'
const { hasValidators } = useValidatorDashboardOverviewStore()
const { groups } = useValidatorDashboardGroups()
const { width } = useWindowSize()
Expand Down Expand Up @@ -333,7 +334,7 @@ const isRowInFuture = (row: ExtendedVDBWithdrawalsTableRow) => {
</div>
</template>
<template #empty>
<DashboardTableAddValidator />
<DashboardTableAddValidator v-if="!hasValidators" />
</template>
</BcTable>
</ClientOnly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,12 @@ export function useValidatorDashboardOverviewStore () {
clearRewardDetails()
}

return { overview, refreshOverview }
const hasValidators = computed<boolean>(() => {
if (!overview.value?.validators) {
return false
}
return !!overview.value.validators.online || !!overview.value.validators.exited || !!overview.value.validators.offline || !!overview.value.validators.pending || !!overview.value.validators.slashed
})

return { overview, refreshOverview, hasValidators }
}

0 comments on commit e0b2f4b

Please sign in to comment.