Skip to content

Commit f63ad9a

Browse files
committed
Rework blocks timeline table
1 parent f2e3134 commit f63ad9a

1 file changed

Lines changed: 52 additions & 7 deletions

File tree

components/data/BlocksTimeline/BlocksTimelineTable.vue

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const preview = reactive({
2727
block: blocks.value[0],
2828
transactions: [],
2929
pfbs: [],
30+
blobs: [],
3031
3132
isLoadingNamespaces: true,
3233
})
@@ -46,6 +47,7 @@ const getTransactionsByBlock = async () => {
4647
const { data } = await fetchTransactionsByBlock({
4748
height: preview.block.height,
4849
from: parseInt(DateTime.fromISO(preview.block.time) / 1000),
50+
limit: 5,
4951
})
5052
preview.transactions = data.value
5153
}
@@ -120,14 +122,16 @@ watch(
120122
return
121123
}
122124
123-
const data = await fetchBlockBlobs({ height: preview.block.height })
124-
let namespaces = []
125+
const data = await fetchBlockBlobs({ height: preview.block.height, limit: 3 })
126+
// let namespaces = []
125127
126-
data.forEach(blob => {
127-
namespaces.push(blob.namespace)
128-
});
128+
// data.forEach(blob => {
129+
// namespaces.push(blob.namespace)
130+
// });
129131
130-
preview.namespaces = Array.from(new Map(namespaces.map(item => [item.id, item])).values());
132+
// preview.namespaces = Array.from(new Map(namespaces.map(item => [item.id, item])).values());
133+
134+
preview.blobs = data
131135
preview.isLoadingNamespaces = false
132136
},
133137
)
@@ -456,7 +460,48 @@ watch(
456460
</Text>
457461
</Flex>
458462
463+
459464
<Flex direction="column" gap="12">
465+
<Flex align="center" justify="between">
466+
<Text size="12" weight="600" color="tertiary">Blobs</Text>
467+
<Text size="12" weight="600" color="secondary">
468+
{{ preview.block.stats.blobs_count > 3 ? "3 /" : "" }} {{ preview.block.stats.blobs_count }}
469+
</Text>
470+
</Flex>
471+
472+
<Text
473+
v-if="preview.isLoadingNamespaces"
474+
size="12"
475+
weight="600"
476+
color="tertiary"
477+
align="center"
478+
:class="$style.empty_state"
479+
>
480+
Loading blobs..
481+
</Text>
482+
<Flex v-else-if="preview.block.stats.blobs_count" direction="column" gap="8">
483+
<NuxtLink v-for="b in preview.blobs" :to="`/blob?commitment=${b.commitment}&hash=${b.namespace.hash}&height=${b.height}`" target="_blank">
484+
<Outline wide height="32" padding="8" radius="6">
485+
<Flex align="center" justify="between" wide>
486+
<Flex align="center" gap="8">
487+
<Icon name="blob" size="12" color="secondary" />
488+
489+
<Text size="13" weight="600" color="primary" mono class="overflow_ellipsis" style="max-width: 250px">
490+
{{ shortHex(b.commitment) }}
491+
</Text>
492+
</Flex>
493+
494+
<Text size="12" weight="600" color="tertiary">{{ formatBytes(b.size) }}</Text>
495+
</Flex>
496+
</Outline>
497+
</NuxtLink>
498+
</Flex>
499+
<Text v-else size="12" weight="600" color="tertiary" align="center" :class="$style.empty_state">
500+
No blobs
501+
</Text>
502+
</Flex>
503+
504+
<!-- <Flex direction="column" gap="12">
460505
<Flex align="center" justify="between">
461506
<Text size="12" weight="600" color="tertiary">Namespaces</Text>
462507
<Text size="12" weight="600" color="secondary">
@@ -494,7 +539,7 @@ watch(
494539
<Text v-else size="12" weight="600" color="tertiary" align="center" :class="$style.empty_state">
495540
No namespaces
496541
</Text>
497-
</Flex>
542+
</Flex> -->
498543
499544
<Flex direction="column" gap="16">
500545
<Text size="12" weight="600" color="secondary">Details</Text>

0 commit comments

Comments
 (0)