Skip to content

Commit 9171644

Browse files
committed
Add amp log and fixiki
1 parent 7549d71 commit 9171644

File tree

2 files changed

+36
-26
lines changed

2 files changed

+36
-26
lines changed

components/modals/ODSModal.vue

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import { fetchBlockODS } from "@/services/api/block"
77
88
/** UI */
99
import Modal from "@/components/ui/Modal.vue"
10+
import Spinner from "@/components/ui/Spinner.vue"
1011
1112
/** Services */
1213
import amp from "@/services/amp"
13-
import { base64ToHex, capitalizeAndReplaceUnderscore, comma, getNamespaceIDFromBase64 } from "@/services/utils";
14+
import { capitalizeAndReplaceUnderscore, comma, getNamespaceIDFromBase64, shortHex } from "@/services/utils";
1415
1516
/** Store */
1617
import { useCacheStore } from "@/store/cache"
@@ -46,6 +47,7 @@ const cellSize = computed(() => {
4647
}
4748
})
4849
const svgWidth = computed(() => blockODS.value?.width ? cellSize.value * blockODS.value?.width : 0)
50+
const modalWidth = computed(() => svgWidth.value ? svgWidth.value + 250 : 350)
4951
5052
function generateCells(item, width) {
5153
const cells = []
@@ -103,7 +105,7 @@ function getColor(item) {
103105
}
104106
105107
const data = computed(() => {
106-
if (blockODS.value) {
108+
if (blockODS.value.items) {
107109
blockODS.value.items.forEach(item => {
108110
item.cells = generateCells(item, blockODS.value.width)
109111
item.color = getColor(item)
@@ -181,7 +183,7 @@ function dimOthers(index) {
181183
const elements = document.querySelectorAll('.ods_group')
182184
elements.forEach(el => {
183185
if (el.getAttribute('data-index') !== index.toString()) {
184-
el.style.filter = "brightness(0.7)"
186+
el.style.filter = "brightness(0.5)"
185187
}
186188
})
187189
}
@@ -206,14 +208,16 @@ function getNamespaceName(item) {
206208
207209
return $getDisplayName('namespaces', getNamespaceIDFromBase64(item.namespace))
208210
default:
209-
return item.namespace
211+
return shortHex(item.namespace)
210212
}
211213
}
212214
213215
watch(
214216
() => props.show,
215217
async () => {
216218
if (props.show) {
219+
amp.log("showODSModal")
220+
blockODS.value = {}
217221
nextTick(async () => {
218222
isLoading.value = true
219223
blockODS.value = await fetchBlockODS(cacheStore.current.block.height)
@@ -225,25 +229,23 @@ watch(
225229
</script>
226230
227231
<template>
228-
<Modal :show="show" @onClose="emit('onClose')" :width="svgWidth + 400" disable-trap>
229-
<Flex direction="column" gap="24" class="ods_wrap">
230-
<Text size="14" weight="600" color="primary">Original Data Square</Text>
231-
232-
<Flex align="start" justify="beetwen" gap="12">
233-
<Flex ref="svgEl" :class="$style.svg"/>
232+
<Modal :show="show" @onClose="emit('onClose')" :width="modalWidth" disable-trap>
233+
<Flex direction="column" gap="24">
234+
<Flex align="center" gap="6" :class="$style.legend_header">
235+
<Icon name="ods" size="14" color="secondary" />
236+
<Text size="14" weight="600" color="primary">Original Data Square</Text>
237+
<Text size="14" weight="600" color="primary">{{ comma(cacheStore.current.block.height) }}</Text>
238+
<CopyButton :text="cacheStore.current.block.height" size="12" />
239+
</Flex>
234240
235-
<Flex align="start" direction="column" gap="12">
236-
<Flex align="center" justify="start" wide>
237-
<Flex align="center" gap="6" :class="$style.legend_header">
238-
<Icon name="block" size="14" color="secondary" />
239-
<Text size="12" weight="600" color="primary"> Height </Text>
240-
<Text size="12" weight="600" color="primary">{{ comma(cacheStore.current.block.height) }}</Text>
241-
<CopyButton :text="cacheStore.current.block.height" size="10" />
242-
</Flex>
243-
</Flex>
241+
<Flex v-if="isLoading" align="center" justify="center" gap="8" wide :style="{ paddingTop: '16px' }">
242+
<Spinner size="14" />
244243
245-
<div :class="$style.horizontal_divider" />
244+
<Text size="13" weight="500" color="secondary"> Loading ODS </Text>
245+
</Flex>
246246
247+
<Flex align="start" justify="between" wide>
248+
<Flex align="start" direction="column" gap="12">
247249
<Flex v-for="(item, index) in data?.items"
248250
@click="handleGroupClick(item)"
249251
@mouseover="highlight(index)"
@@ -262,16 +264,14 @@ watch(
262264
</Flex>
263265
</Flex>
264266
</Flex>
267+
268+
<Flex ref="svgEl" />
265269
</Flex>
266270
</Flex>
267271
</Modal>
268272
</template>
269273
270274
<style module>
271-
.svg {
272-
padding-top: 28px;
273-
}
274-
275275
.legend_header {
276276
width: 100%;
277277
}

components/modules/block/BlockOverview.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ const handleViewRawTransactions = () => {
305305
</Flex>
306306

307307
<Flex align="center" gap="12">
308-
<Button v-if="block.stats.tx_count" @click="handleViewODSBlock" type="secondary" size="mini">
308+
<Button v-if="block.stats.tx_count" @click="handleViewODSBlock" type="secondary" size="mini" :class="$style.ods_btn">
309309
<Icon name="ods" size="12" color="primary" />
310310
ODS
311311
</Button>
@@ -417,7 +417,7 @@ const handleViewRawTransactions = () => {
417417
<Text size="12" weight="600" color="secondary"> {{ block.stats.tx_count }} </Text>
418418
</Flex>
419419
<Flex align="center" justify="between">
420-
<Text size="12" weight="600" color="tertiary"> Total Fees </Text>
420+
<Text size="12" weight="600" color="tertiary"> Transactions Fee </Text>
421421
<AmountInCurrency
422422
:amount="{ value: block.stats.fee, decimal: 6 }"
423423
:styles="{ amount: { color: 'secondary' }, currency: { color: 'secondary' } }"
@@ -427,6 +427,10 @@ const handleViewRawTransactions = () => {
427427
<Text size="12" weight="600" color="tertiary"> Bytes in block </Text>
428428
<Text size="12" weight="600" color="secondary"> {{ formatBytes(block.stats.bytes_in_block) }}</Text>
429429
</Flex>
430+
<Flex align="center" justify="between">
431+
<Text size="12" weight="600" color="tertiary"> Square size </Text>
432+
<Text size="12" weight="600" color="secondary"> {{ block.stats.square_size }}</Text>
433+
</Flex>
430434
</Flex>
431435
</Flex>
432436
</Flex>
@@ -926,6 +930,12 @@ const handleViewRawTransactions = () => {
926930
padding: 8px 16px 16px 16px;
927931
}
928932
933+
@media (max-width: 1000px) {
934+
.ods_btn {
935+
display: none;
936+
}
937+
}
938+
929939
@media (max-width: 800px) {
930940
.content {
931941
flex-direction: column;

0 commit comments

Comments
 (0)