@@ -7,10 +7,11 @@ import { fetchBlockODS } from "@/services/api/block"
77
88/** UI */
99import Modal from " @/components/ui/Modal.vue"
10+ import Spinner from " @/components/ui/Spinner.vue"
1011
1112/** Services */
1213import 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 */
1617import { useCacheStore } from " @/store/cache"
@@ -46,6 +47,7 @@ const cellSize = computed(() => {
4647 }
4748})
4849const svgWidth = computed (() => blockODS .value ? .width ? cellSize .value * blockODS .value ? .width : 0 )
50+ const modalWidth = computed (() => svgWidth .value ? svgWidth .value + 250 : 350 )
4951
5052function generateCells (item , width ) {
5153 const cells = []
@@ -103,7 +105,7 @@ function getColor(item) {
103105}
104106
105107const 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
213215watch (
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}
0 commit comments