Skip to content

Commit db7576b

Browse files
committed
wip
1 parent 7f5396c commit db7576b

38 files changed

+852
-384
lines changed

frontend/components/BcNavigation.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,9 @@ useApi('/api/bff/latest-state', {
1717
immediate: true,
1818
watch: [ counter ],
1919
})
20-
const {
21-
data: userData,
22-
} = await useApi('/api/bff/users/me', {
23-
key: 'user',
24-
})
2520
2621
const {
22+
isLoggedIn,
2723
logout,
2824
} = useUser()
2925
@@ -144,7 +140,7 @@ const loginUrl = useLoginUrl()
144140
:show-currency-icon="!isMobileScreen"
145141
/>
146142
<div
147-
v-if="!userData"
143+
v-if="!isLoggedIn"
148144
class="logged-out"
149145
>
150146
<BcLink

frontend/components/DashboardIndex.vue

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// isGuestDashboardKey, isSharedDashboardKey,
55
// } from '~/utils/dashboard/key'
66
import type { HashTab } from '~/components/bc/tab/BcTabList.vue'
7+
import type { ValidatorDashboard } from '~/types/api/dashboard'
78
import type { SlotVizEpoch } from '~/types/api/slot_viz'
89
import type { VDBOverviewData } from '~/types/api/validator_dashboard'
910
// import type { TableQueryParams } from '~/types/datatable'
@@ -207,6 +208,7 @@ const tabs: HashTab[] = [
207208
defineProps<{
208209
overview: null | VDBOverviewData,
209210
slotVizEpochs: null | SlotVizEpoch[],
211+
validatorDashboards: null | ValidatorDashboard[],
210212
}>()
211213
const visible = ref(false)
212214
const onShowCreation = () => {
@@ -227,40 +229,42 @@ const emit = defineEmits<{
227229
// const onTabChange = (value: string) => {
228230
// tab.value = value
229231
// }
232+
const { key } = useDashboard()
230233
</script>
231234

232235
<template>
233236
<!-- <NuxtLayout v-if="!dashboardKey && !dashboards?.validator_dashboards?.length">
234-
<DashboardCreationController
235-
class="panel-controller"
236-
:display-mode="'panel'"
237-
:initially-visible="true"
238-
/>
239-
</NuxtLayout> -->
237+
<DashboardCreationController
238+
class="panel-controller"
239+
:display-mode="'panel'"
240+
:initially-visible="true"
241+
/>
242+
</NuxtLayout> -->
240243
<NuxtLayout name="default">
241244
<BcDialog v-model="visible">
242-
<DashboardCreationController
245+
<LazyDashboardCreationController
243246
v-if="visible"
244247
ref="dashboardCreationControllerModal"
245248
class="modal-controller"
246249
/>
247250
</BcDialog>
248251
<template #banner>
249-
<BcNotificationBanner
252+
<LazyBcNotificationBanner
250253
v-if=" overview?.is_above_effective_balance_limit"
251254
:title="$t('dashboard.subsciprion_limit_reached_title')"
252255
>
253-
<BcTranslation
256+
<LazyBcTranslation
257+
v-if=" overview?.is_above_effective_balance_limit"
254258
keypath="dashboard.subsciprion_limit_reached.template"
255259
linkpath="dashboard.subsciprion_limit_reached._link"
256260
to="/pricing"
257261
/>
258-
</BcNotificationBanner>
262+
</LazyBcNotificationBanner>
259263
</template>
260264
<DashboardHeader @show-creation="onShowCreation()" />
261265
<DashboardControls
262266
v-model:is-visible-management-modal="isVisibleManagementModal"
263-
:dashboard-title="overview?.name"
267+
:validator-dashboards
264268
@change-validators=" emit('change-validators', $event)"
265269
/>
266270
<DashboardValidatorOverview
@@ -278,54 +282,54 @@ const emit = defineEmits<{
278282
class="dashboard-tab-view"
279283
panels-class="dashboard-tab-panels"
280284
>
281-
<template #tab-panel-summary>
282-
<DashboardTableSummary
283-
@add-validator="onAddValidator"
285+
<template #tab-panel-summary="{ isActive }">
286+
<LazyDashboardTableSummary
287+
v-if="key && isActive"
284288
/>
285289
</template>
286-
<template #tab-panel-rewards>
287-
<DashboardTableRewards
288-
@add-validator="onAddValidator"
290+
<template #tab-panel-rewards="{ isActive }">
291+
<LazyDashboardTableRewards
292+
v-if="key && isActive"
289293
/>
290294
</template>
291-
<template #tab-panel-blocks>
292-
<DashboardTableBlocks
293-
@add-validator="onAddValidator"
295+
<template #tab-panel-blocks="{ isActive }">
296+
<LazyDashboardTableBlocks
297+
v-if="key && isActive"
294298
/>
295299
</template>
296-
<template #tab-panel-deposits>
297-
<DashboardTableElDeposits
298-
@add-validator="onAddValidator"
299-
/>
300-
<BcIcon
301-
name="arrow-down"
302-
class="down_icon"
303-
/>
304-
<DashboardTableClDeposits
305-
@add-validator="onAddValidator"
306-
/>
300+
<template #tab-panel-deposits="{ isActive }">
301+
<div v-if="key && isActive">
302+
<LazyDashboardTableElDeposits />
303+
<LazyBcIcon
304+
name="arrow-down"
305+
class="down_icon"
306+
/>
307+
<LazyDashboardTableClDeposits />
308+
</div>
307309
</template>
308-
<template #tab-panel-withdrawals>
309-
<DashboardTableElWithdrawals
310-
@add-validator="onAddValidator"
311-
/>
312-
<BcIcon
313-
name="arrow-down"
314-
class="down_icon"
315-
/>
316-
<DashboardTableClWithdrawals
317-
@add-validator="onAddValidator"
318-
/>
310+
<template #tab-panel-withdrawals="{ isActive }">
311+
<div v-if="key && isActive">
312+
<LazyDashboardTableElWithdrawals />
313+
<LazyBcIcon
314+
name="arrow-down"
315+
class="down_icon"
316+
/>
317+
<LazyDashboardTableClWithdrawals />
318+
</div>
319319
</template>
320-
<template #tab-panel-consolidations>
321-
<DashboardTableElConsolidations
322-
@add-validator="onAddValidator"
323-
/>
324-
<BcIcon
325-
name="arrow-down"
326-
class="down_icon"
327-
/>
328-
<DashboardTableClConsolidations
320+
<template #tab-panel-consolidations="{ isActive }">
321+
<div v-if="key && isActive">
322+
<LazyDashboardTableElConsolidations />
323+
<LazyBcIcon
324+
name="arrow-down"
325+
class="down_icon"
326+
/>
327+
<LazyDashboardTableClConsolidations />
328+
</div>
329+
</template>
330+
<template #empty>
331+
<LazyDashboardTableAddValidator
332+
v-if="!key"
329333
@add-validator="onAddValidator"
330334
/>
331335
</template>

frontend/components/bc/BcButtonIcon.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const { variant = 'plain' } = defineProps<{
1010
*
1111
* ♿️ screenreader text
1212
* every button with just an icon has to describe what it does
13+
*
1314
*/
1415
screenreaderText: TranslationInput,
1516
variant?: 'flat' | 'plain',

frontend/components/bc/tab/BcTabList.vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,35 @@ const onUpdateValue = () => {
6767
<TabPanel
6868
v-for="tab in tabs"
6969
:key="tab.key"
70+
class="tab-panel"
7071
:value="tab.key"
7172
>
72-
<slot :name="`tab-panel-${tab.key}`">
73+
<slot
74+
:name="`tab-panel-${tab.key}`"
75+
v-bind="{ isActive: activeTab === tab.key }"
76+
>
7377
<component
7478
:is="tab.component"
7579
v-if="tab.component"
7680
/>
7781
<div v-else-if="tab.placeholder">
7882
{{ tab.placeholder }}
7983
</div>
80-
<div v-else>
84+
<slot
85+
v-else
86+
name="empty"
87+
>
8188
tab-panel-{{ tab.key }}
82-
</div>
89+
</slot>
8390
</slot>
8491
</TabPanel>
8592
</TabPanels>
8693
</Tabs>
8794
</template>
95+
96+
<style lang="scss" scoped>
97+
:deep(.tab-panel) {
98+
min-height: inherit;
99+
display: grid;
100+
}
101+
</style>

frontend/components/bc/table/BcTable.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const changeCursor = (value: string | undefined) => {
103103
const query = defineModel<Query>('query', {
104104
required: true,
105105
})
106+
106107
const onSort = (event: DataTableSortEvent) => {
107108
const {
108109
sortField,
@@ -112,18 +113,23 @@ const onSort = (event: DataTableSortEvent) => {
112113
query.value.sort = `${sortField}:${sortOrder === -1 ? 'asc' : 'desc'}`
113114
}
114115
}
116+
117+
// to correctly display the initial sort order
118+
const sortField = computed(() => query.value.sort?.split(':')[0] ?? '')
119+
const sortOrder = computed(() => query.value.sort?.split(':')[1] === 'desc' ? 1 : -1)
115120
</script>
116121

117122
<template>
118123
<DataTable
119124
v-model:expanded-rows="expandedRows"
120125
class="bc-table"
121126
sort-mode="single"
122-
lazy
123127
:value="data?.data"
124128
:data-key
125129
:loading="isLoading"
126130
:table-class
131+
:sort-field
132+
:sort-order
127133
@sort="onSort"
128134
>
129135
<Column

0 commit comments

Comments
 (0)