Skip to content

Commit 4ca7c9f

Browse files
authored
Merge pull request #76 from celenium-io/dev
Fix totals on rollups page
2 parents bd845e7 + b113c8c commit 4ca7c9f

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

pages/rollups.vue

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Tooltip from "@/components/ui/Tooltip.vue"
1010
import AmountInCurrency from "@/components/AmountInCurrency.vue"
1111
1212
/** Services */
13-
import { comma, formatBytes, numToPercent } from "@/services/utils"
13+
import { formatBytes, comma, shareOfTotalString } from "@/services/utils"
1414
1515
/** API */
1616
import { fetchRollups, fetchRollupsCount } from "@/services/api/rollup"
@@ -70,6 +70,14 @@ const isRefetching = ref(false)
7070
const rollups = ref([])
7171
const count = ref(0)
7272
73+
const totalSize = computed(() => rollups.value.reduce((acc, rollup) => {
74+
return acc + rollup.size
75+
}, 0))
76+
77+
const totalFee = computed(() => rollups.value.reduce((acc, rollup) => {
78+
return acc + (+rollup.fee)
79+
}, 0))
80+
7381
const utiaPerMB = (rollup) => {
7482
let totalRollupMB = rollup.size / (1024 * 1024)
7583
@@ -293,14 +301,14 @@ const handleNext = () => {
293301
<Flex direction="column" gap="4">
294302
<Text size="13" weight="600" color="primary">{{ formatBytes(r.size) }}</Text>
295303

296-
<Text size="12" weight="600" color="tertiary">{{ numToPercent(r.size_pct, 2) }}</Text>
304+
<Text size="12" weight="600" color="tertiary">{{ shareOfTotalString(r.size, totalSize) }}%</Text>
297305
</Flex>
298306

299307
<template #content>
300308
<Flex align="end" gap="8">
301309
<Text size="12" weight="600" color="tertiary">Share of total size</Text>
302310

303-
<Text size="12" weight="600" color="primary">{{ numToPercent(r.size_pct, 2) }}</Text>
311+
<Text size="12" weight="600" color="primary">{{ shareOfTotalString(r.size, totalSize) }}%</Text>
304312
</Flex>
305313
</template>
306314
</Tooltip>
@@ -309,22 +317,8 @@ const handleNext = () => {
309317
</td>
310318
<td>
311319
<NuxtLink :to="`/rollup/${r.slug}`">
312-
<Flex align="start" justify="center" direction="column" gap="4">
313-
<Tooltip position="start" delay="400">
314-
<Flex direction="column" gap="4">
315-
<Text size="13" weight="600" color="primary">{{ comma(r.blobs_count) }}</Text>
316-
317-
<Text size="12" weight="600" color="tertiary">{{ numToPercent(r.blobs_count_pct, 2) }}</Text>
318-
</Flex>
319-
320-
<template #content>
321-
<Flex align="end" gap="8">
322-
<Text size="12" weight="600" color="tertiary">Share of total blobs count</Text>
323-
324-
<Text size="12" weight="600" color="primary">{{ numToPercent(r.blobs_count_pct, 2) }}</Text>
325-
</Flex>
326-
</template>
327-
</Tooltip>
320+
<Flex align="center">
321+
<Text size="13" weight="600" color="primary">{{ comma(r.blobs_count) }}</Text>
328322
</Flex>
329323
</NuxtLink>
330324
</td>
@@ -334,13 +328,13 @@ const handleNext = () => {
334328
<AmountInCurrency :amount="{ value: r.fee }" />
335329

336330
<Tooltip position="start" delay="400">
337-
<Text size="12" weight="600" color="tertiary">{{ numToPercent(r.fee_pct, 2) }}</Text>
331+
<Text size="12" weight="600" color="tertiary">{{ shareOfTotalString(r.fee, totalFee) }}%</Text>
338332

339333
<template #content>
340334
<Flex align="end" gap="8">
341335
<Text size="12" weight="600" color="tertiary">Share of total fee</Text>
342336

343-
<Text size="12" weight="600" color="primary">{{ numToPercent(r.fee_pct, 2) }}</Text>
337+
<Text size="12" weight="600" color="primary">{{ shareOfTotalString(r.fee, totalFee) }}%</Text>
344338
</Flex>
345339
</template>
346340
</Tooltip>
@@ -522,4 +516,4 @@ const handleNext = () => {
522516
padding: 16px;
523517
}
524518
}
525-
</style>
519+
</style>

0 commit comments

Comments
 (0)