Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 53 additions & 24 deletions components/data/BlocksTimeline/BlocksTimelineTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Tooltip from "@/components/ui/Tooltip.vue"
import { tia, comma, space, formatBytes, getNamespaceID } from "@/services/utils"

/** API */
import { fetchBlockNamespaces } from "@/services/api/block"
import { fetchBlockBlobs } from "@/services/api/block"
import { fetchTransactionsByBlock } from "@/services/api/tx"

/** Store */
Expand All @@ -27,7 +27,7 @@ const preview = reactive({
transactions: [],
pfbs: [],

isLoadingPfbs: true,
isLoadingNamespaces: true,
})

const autoSelect = ref(true)
Expand All @@ -38,7 +38,7 @@ const handleSelectBlock = (b, isUser) => {
if (preview.block.height === b.height) return

preview.block = b
preview.pfbs = []
preview.namespaces = []
}

const getTransactionsByBlock = async () => {
Expand Down Expand Up @@ -104,7 +104,7 @@ watch(
() => preview.block,
async () => {
if (preview.block.stats.tx_count) {
if (preview.block.stats.blobs_size) preview.isLoadingPfbs = true
if (preview.block.stats.blobs_size) preview.isLoadingNamespaces = true

getTransactionsByBlock()
}
Expand All @@ -115,13 +115,19 @@ watch(
() => preview.transactions,
async () => {
if (preview.block.stats.blobs_size === 0) {
preview.isLoadingPfbs = false
preview.isLoadingNamespaces = false
return
}

const data = await fetchBlockNamespaces({ height: preview.block.height })
preview.pfbs = data
preview.isLoadingPfbs = false
const data = await fetchBlockBlobs({ height: preview.block.height })
let namespaces = []

data.forEach(blob => {
namespaces.push(blob.namespace)
});

preview.namespaces = Array.from(new Map(namespaces.map(item => [item.id, item])).values());
preview.isLoadingNamespaces = false
},
)

Expand Down Expand Up @@ -200,9 +206,11 @@ watch(
<table>
<thead>
<tr>
<th><Text size="12" weight="600" color="tertiary">Height</Text></th>
<th><Text size="12" weight="600" color="tertiary">Block Height</Text></th>
<th><Text size="12" weight="600" color="tertiary">Time</Text></th>
<th><Text size="12" weight="600" color="tertiary">Proposer</Text></th>
<th><Text size="12" weight="600" color="tertiary">Txs</Text></th>
<th><Text size="12" weight="600" color="tertiary">Blobs</Text></th>
<th><Text size="12" weight="600" color="tertiary">Total Fees</Text></th>
</tr>
</thead>
Expand All @@ -225,17 +233,14 @@ watch(
</NuxtLink>
</td>
<td>
<Flex direction="column" gap="4">
<Flex align="center">
<Text size="12" weight="600" color="primary">
{{
DateTime.fromISO(block.time)
.plus({ seconds: block.stats.block_time / 1_000 })
.toRelative({ locale: "en", style: "short" })
}}
</Text>
<Text size="12" weight="500" color="tertiary">
{{ DateTime.fromISO(block.time).setLocale("en").toFormat("LLL d, t") }}
</Text>
</Flex>
</td>
<td>
Expand Down Expand Up @@ -274,6 +279,20 @@ watch(
</template>
</Tooltip>
</td>
<td>
<Flex align="center">
<Text size="13" weight="600" color="primary">
{{ block.stats.tx_count }}
</Text>
</Flex>
</td>
<td>
<Flex align="center">
<Text size="13" weight="600" color="primary">
{{ block.stats.blobs_count }}
</Text>
</Flex>
</td>
<td>
<Flex align="center" gap="4">
<Text size="13" weight="600" :color="parseFloat(block.stats.fee) ? 'primary' : 'tertiary'">
Expand Down Expand Up @@ -447,12 +466,12 @@ watch(
<Flex align="center" justify="between">
<Text size="12" weight="600" color="tertiary">Namespaces</Text>
<Text size="12" weight="600" color="secondary">
{{ preview.pfbs?.length > 3 ? "3 /" : "" }} {{ preview.pfbs?.length }}
{{ preview.namespaces?.length > 3 ? "3 /" : "" }} {{ preview.namespaces?.length }}
</Text>
</Flex>

<Text
v-if="preview.isLoadingPfbs"
v-if="preview.isLoadingNamespaces"
size="12"
weight="600"
color="tertiary"
Expand All @@ -461,27 +480,27 @@ watch(
>
Loading namespaces..
</Text>
<Flex v-else-if="preview.pfbs?.length" direction="column" gap="8">
<NuxtLink v-for="pfb in preview.pfbs.slice(0, 3)" :to="`/namespace/${pfb.namespace.namespace_id}`">
<Flex v-else-if="preview.namespaces?.length" direction="column" gap="8">
<NuxtLink v-for="ns in preview.namespaces.slice(0, 3)" :to="`/namespace/${ns.namespace_id}`">
<Outline wide height="32" padding="8" radius="6">
<Flex align="center" justify="between" wide>
<Flex align="center" gap="8">
<Icon name="folder" size="12" color="secondary" />

<Text size="13" weight="600" color="primary" mono>
{{ getNamespaceID(pfb.namespace.namespace_id).slice(0, 4) }}
{{ getNamespaceID(ns.namespace_id).slice(0, 4) }}
</Text>

<Flex align="center" gap="3">
<div v-for="dot in 3" class="dot" />
</Flex>

<Text size="13" weight="600" color="primary" mono>
{{ getNamespaceID(pfb.namespace.namespace_id).slice(-4) }}
{{ getNamespaceID(ns.namespace_id).slice(-4) }}
</Text>
</Flex>

<Text size="12" weight="600" color="tertiary">{{ formatBytes(pfb.namespace.size) }}</Text>
<Text size="12" weight="600" color="tertiary">{{ formatBytes(ns.size) }}</Text>
</Flex>
</Outline>
</NuxtLink>
Expand Down Expand Up @@ -605,7 +624,11 @@ watch(
text-align: left;
padding: 0;
padding-bottom: 8px;
padding-left: 16px;
padding-right: 24px;

&:first-child {
padding-left: 16px;
}

& span {
display: flex;
Expand All @@ -614,14 +637,19 @@ watch(

& tr td {
padding: 0;
padding-right: 24px;
padding-left: 16px;
padding-right: 16px;
padding-top: 8px;
padding-bottom: 8px;

white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

border-right: 2px solid transparent;

&:first-child {
padding-left: 16px;
}
}
}
}
Expand Down Expand Up @@ -680,7 +708,7 @@ watch(
}

.proposer_moniker {
max-width: 190px;
max-width: 150px;

text-overflow: ellipsis;
overflow: hidden;
Expand Down Expand Up @@ -720,6 +748,7 @@ watch(
}

.table {
width: 604px;
border-radius: 4px 4px 8px 8px;
}
}
Expand Down
10 changes: 5 additions & 5 deletions components/data/LatestPFBTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Tooltip from "@/components/ui/Tooltip.vue"
import Spinner from "@/components/ui/Spinner.vue"

/** Services */
import { tia, space, comma } from "@/services/utils"
import { comma, space, splitAddress, tia } from "@/services/utils"

/** API */
import { fetchLatestPFBs } from "@/services/api/tx"
Expand Down Expand Up @@ -36,8 +36,8 @@ isLoading.value = false
<thead>
<tr>
<th><Text size="12" weight="600" color="tertiary" noWrap>Hash</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Height</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Time</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Block Height</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Signer</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Fee</Text></th>
</tr>
</thead>
Expand Down Expand Up @@ -105,7 +105,7 @@ isLoading.value = false
<NuxtLink :to="`/tx/${pfb.hash}`">
<Flex align="center">
<Text size="12" weight="600" color="primary">
{{ DateTime.fromISO(pfb.time).toRelative({ locale: "en", style: "short" }) }}
{{ splitAddress(pfb.signers[0]) }}
</Text>
</Flex>
</NuxtLink>
Expand Down Expand Up @@ -208,7 +208,7 @@ isLoading.value = false

min-height: 40px;

padding-right: 24px;
padding-right: 16px;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/data/RecentNamespacesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const handleSort = (by) => {
<thead>
<tr>
<th><Text size="12" weight="600" color="tertiary">Namespace</Text></th>
<th><Text size="12" weight="600" color="tertiary">Height</Text></th>
<th><Text size="12" weight="600" color="tertiary">Block Height</Text></th>
<th @click="handleSort('time')" :class="$style.sortable">
<Flex align="center" gap="6">
<Text size="12" weight="600" color="tertiary">Time</Text>
Expand Down
10 changes: 10 additions & 0 deletions pages/blocks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ const handleLast = async () => {
<th><Text size="12" weight="600" color="tertiary" noWrap>Hash</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Txs</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Events</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Blobs</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Blobs Size</Text></th>
<th><Text size="12" weight="600" color="tertiary" noWrap>Total Fees</Text></th>
</tr>
Expand Down Expand Up @@ -289,6 +290,15 @@ const handleLast = async () => {
</Flex>
</NuxtLink>
</td>
<td>
<NuxtLink :to="`/block/${block.height}`">
<Flex align="center">
<Text size="13" weight="600" color="primary">
{{ block.stats.tx_count }}
</Text>
</Flex>
</NuxtLink>
</td>
<td>
<NuxtLink :to="`/block/${block.height}`">
<Flex align="center">
Expand Down