Skip to content

Commit aedfb99

Browse files
committed
fix(BlockOverview): txs pagination
1 parent 74ea958 commit aedfb99

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

components/modules/block/BlockOverview.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const transactions = ref([])
8888
const update = ref()
8989
9090
const page = ref(1)
91+
const pages = computed(() => Math.ceil(props.block.stats.tx_count / 10))
9192
const handleNext = () => {
9293
page.value += 1
9394
}
@@ -270,18 +271,17 @@ const getTransactions = async () => {
270271
271272
await getTransactions()
272273
273-
onBeforeMount(async () => {
274-
})
274+
onBeforeMount(async () => {})
275275
276276
onMounted(async () => {
277-
update.value = appStore.globalUpdates.find(upd => upd.block === props.height)
277+
update.value = appStore.globalUpdates.find((upd) => upd.block === props.height)
278278
if (update.value?.kind) {
279279
activeTab.value = "upcoming_update"
280280
} else {
281281
const preselectedTab = route.query.tab && ["transactions", "events"].includes(route.query.tab) ? route.query.tab : "transactions"
282282
activeTab.value = preselectedTab
283283
}
284-
284+
285285
router.replace({
286286
query: {
287287
tab: activeTab.value,
@@ -324,7 +324,7 @@ watch(
324324
watch(
325325
() => appStore.globalUpdates,
326326
() => {
327-
update.value = appStore.globalUpdates.find(upd => {
327+
update.value = appStore.globalUpdates.find((upd) => {
328328
return upd.block === props.height
329329
})
330330
},
@@ -582,8 +582,13 @@ const handleViewRawTransactions = () => {
582582
</Flex>
583583
584584
<UpcomingUpdate v-if="activeTab === 'upcoming_update'" :update="update" />
585-
586-
<Flex v-else-if="activeTab === 'transactions'" direction="column" justify="between" :class="[$style.table, isLoading && $style.disabled]">
585+
586+
<Flex
587+
v-else-if="activeTab === 'transactions'"
588+
direction="column"
589+
justify="between"
590+
:class="[$style.table, isLoading && $style.disabled]"
591+
>
587592
<Flex wrap="wrap" align="center" justify="start" gap="8" :class="$style.filters">
588593
<Popover :open="isStatusPopoverOpen" @on-close="onStatusPopoverClose" width="200">
589594
<Button @click="handleOpenStatusPopover" type="secondary" size="mini" :disabled="!transactions.length">
@@ -652,7 +657,7 @@ const handleViewRawTransactions = () => {
652657
.filter((f) => filters.message_type[f])[0]
653658
.replace("Msg", "")} and ${
654659
Object.keys(filters.message_type).filter((f) => filters.message_type[f]).length - 1
655-
} more`
660+
} more`
656661
}}
657662
</Text>
658663
@@ -928,10 +933,10 @@ const handleViewRawTransactions = () => {
928933
</Button>
929934
930935
<Button type="secondary" size="mini" disabled>
931-
<Text size="12" weight="600" color="primary">Page {{ page }}</Text>
936+
<Text size="12" weight="600" color="primary">Page {{ page }} of {{ pages }}</Text>
932937
</Button>
933938
934-
<Button @click="handleNext" type="secondary" size="mini" :disabled="transactions.length !== 10">
939+
<Button @click="handleNext" type="secondary" size="mini" :disabled="page === pages">
935940
<Icon name="arrow-right" size="12" color="primary" />
936941
</Button>
937942
</Flex>

0 commit comments

Comments
 (0)