3
3
import { DateTime } from " luxon"
4
4
5
5
/** Services */
6
- import { comma , formatBytes , abbreviate } from " @/services/utils"
6
+ import { abbreviate , comma , formatBytes , isMainnet , roundTo } from " @/services/utils"
7
+ import { getRankCategory } from " @/services/constants/rollups"
7
8
8
9
/** UI */
9
10
import Tooltip from " @/components/ui/Tooltip.vue"
@@ -13,7 +14,9 @@ import { fetchPriceSeries } from "@/services/api/stats"
13
14
14
15
/** Store */
15
16
import { useAppStore } from " @/store/app"
17
+ import { useRollupsRankingStore } from " @/store/rollupsrank"
16
18
const appStore = useAppStore ()
19
+ const rollupRankingStore = useRollupsRankingStore ()
17
20
18
21
const head = computed (() => appStore .lastHead )
19
22
const currentPrice = computed (() => appStore .currentPrice )
@@ -22,6 +25,18 @@ const totalSupply = computed(() => head.value.total_supply / 1_000_000)
22
25
const totalSupplyUSD = computed (() => totalSupply .value * currentPrice .value ? .close )
23
26
const totalFees = computed (() => head .value .total_fee / 1_000_000 )
24
27
const totalFeesUSD = computed (() => totalFees .value * currentPrice .value ? .close )
28
+ const topRollup = computed (() => {
29
+ let rankCategory = getRankCategory (roundTo (rollupRankingStore? .rollups_ranking ? .top_rollup ? .rank / 10 , 0 ))
30
+ return {
31
+ slug: rollupRankingStore? .rollups_ranking ? .top_rollup ? .slug ,
32
+ name: rollupRankingStore? .rollups_ranking ? .top_rollup ? .name ,
33
+ rank: {
34
+ name: rankCategory? .name ,
35
+ score: rollupRankingStore? .rollups_ranking ? .top_rollup ? .rank ,
36
+ color: rankCategory? .color ,
37
+ }
38
+ }
39
+ })
25
40
26
41
const series = ref ([])
27
42
const price = reactive ({
@@ -49,14 +64,46 @@ onMounted(async () => {
49
64
< template>
50
65
< Flex tag= " section" justify= " center" wide : class = " $style.wrapper" >
51
66
< Flex align= " center" justify= " between" gap= " 24" wide : class = " $style.container" >
52
- < Flex align= " center" gap= " 20" : class = " $style.stats" >
67
+ < Flex align= " center" gap= " 8" : class = " $style.stats" >
68
+ < template v- if = " isMainnet()" >
69
+ < NuxtLink : to= " `/rollup/rank/${topRollup?.slug}`" >
70
+ < Tooltip>
71
+ < Flex align= " center" gap= " 6" : class = " $style.stat" >
72
+ < Icon v- if = " topRollup?.name" name= " laurel" size= " 14" : color= " topRollup?.rank?.color" : style= " {marginTop: '1px'}" / >
73
+ < Icon v- else name= " laurel" size= " 14" color= " tertiary" : class = " $style.icon" : style= " {marginTop: '1px'}" / >
74
+ < Flex align= " center" gap= " 4" >
75
+ < Text size= " 12" weight= " 500" color= " tertiary" noWrap : class = " $style.key" > Top Rollup: < / Text >
76
+
77
+ < Text v- if = " topRollup?.name" size= " 12" weight= " 600" color= " secondary" noWrap : class = " $style.value" > {{ topRollup? .name }} < / Text >
78
+ < Skeleton v- else w= " 40" h= " 12" / >
79
+ < / Flex>
80
+ < / Flex>
81
+
82
+ < template #content>
83
+ < Flex direction= " column" gap= " 8" >
84
+ < Flex align= " center" justify= " between" gap= " 8" >
85
+ < Text size= " 12" weight= " 500" color= " tertiary" > Rank: < / Text >
86
+ < Text size= " 12" weight= " 600" : color= " topRollup?.rank?.color" > {{ topRollup? .rank ? .name }} < / Text >
87
+ < / Flex>
88
+ < Flex align= " center" justify= " between" gap= " 8" >
89
+ < Text size= " 12" weight= " 500" color= " tertiary" > Score: < / Text >
90
+ < Text size= " 12" weight= " 600" color= " secondary" > {{ topRollup? .rank ? .score }}% < / Text >
91
+ < / Flex>
92
+ < / Flex>
93
+ < / template>
94
+ < / Tooltip>
95
+ < / NuxtLink>
96
+
97
+ < div : class = " $style.dot" / >
98
+ < / template>
99
+
53
100
< Tooltip>
54
101
< Flex align= " center" gap= " 6" : class = " $style.stat" >
55
102
< Icon name= " tx" size= " 12" color= " secondary" : class = " $style.icon" / >
56
103
< Flex align= " center" gap= " 4" >
57
104
< Text size= " 12" weight= " 500" color= " tertiary" noWrap : class = " $style.key" > Total Txs: < / Text >
58
105
59
- < Text v- if = " head" size= " 12" weight= " 600" noWrap : class = " $style.value" > {{ abbreviate (head .total_tx ) }}< / Text >
106
+ < Text v- if = " head.total_tx " size= " 12" weight= " 600" noWrap : class = " $style.value" > {{ abbreviate (head .total_tx ) }}< / Text >
60
107
< Skeleton v- else w= " 40" h= " 12" / >
61
108
< / Flex>
62
109
< / Flex>
@@ -74,10 +121,10 @@ onMounted(async () => {
74
121
< Flex align= " center" gap= " 4" >
75
122
< Text size= " 12" weight= " 500" color= " tertiary" noWrap : class = " $style.key" > Total Supply: < / Text >
76
123
77
- < Text v- if = " head" size= " 12" weight= " 600" noWrap : class = " $style.value" >
124
+ < Text v- if = " head.total_supply " size= " 12" weight= " 600" noWrap : class = " $style.value" >
78
125
{{ abbreviate (totalSupply, 2 ) }} TIA
79
126
< / Text >
80
- < Skeleton v- else w= " 55 " h= " 12" / >
127
+ < Skeleton v- else w= " 40 " h= " 12" / >
81
128
< / Flex>
82
129
< / Flex>
83
130
@@ -92,10 +139,10 @@ onMounted(async () => {
92
139
< Flex align= " center" gap= " 4" >
93
140
< Text size= " 12" weight= " 500" color= " tertiary" noWrap : class = " $style.key" > Total Blobs Size: < / Text >
94
141
95
- < Text v- if = " head" size= " 12" weight= " 600" noWrap : class = " $style.value" > {{
142
+ < Text v- if = " head.total_blobs_size " size= " 12" weight= " 600" noWrap : class = " $style.value" > {{
96
143
formatBytes (head .total_blobs_size )
97
144
}}< / Text >
98
- < Skeleton v- else w= " 60 " h= " 12" / >
145
+ < Skeleton v- else w= " 40 " h= " 12" / >
99
146
< / Flex>
100
147
< / Flex>
101
148
@@ -110,10 +157,10 @@ onMounted(async () => {
110
157
< Flex align= " center" gap= " 4" >
111
158
< Text size= " 12" weight= " 500" color= " tertiary" noWrap : class = " $style.key" > Total Fees: < / Text >
112
159
113
- < Text v- if = " head" size= " 12" weight= " 600" noWrap : class = " $style.value" >
160
+ < Text v- if = " head.total_fee " size= " 12" weight= " 600" noWrap : class = " $style.value" >
114
161
{{ abbreviate (parseInt (totalFees)) }} TIA
115
162
< / Text >
116
- < Skeleton v- else w= " 55 " h= " 12" / >
163
+ < Skeleton v- else w= " 40 " h= " 12" / >
117
164
< / Flex>
118
165
< / Flex>
119
166
@@ -132,7 +179,7 @@ onMounted(async () => {
132
179
< Skeleton v- else w= " 36" h= " 12" / >
133
180
< / Flex>
134
181
135
- < Flex v- if = " !isNaN( price.diff) " align= " center" gap= " 4" >
182
+ < Flex v- if = " price.diff" align= " center" gap= " 4" >
136
183
< Icon v- if = " price.side === 'rise'" name= " arrow-circle-right-up" size= " 12" color= " neutral-green" / >
137
184
< Icon v- else - if = " price.side === 'fall'" name= " arrow-circle-right-down" size= " 12" color= " red" / >
138
185
@@ -167,18 +214,20 @@ onMounted(async () => {
167
214
< style module >
168
215
.wrapper {
169
216
height: 32px ;
217
+ max- width: var (-- base- width);
170
218
171
219
border- top: 1px solid var (-- op- 5 );
172
220
border- bottom: 1px solid var (-- op- 5 );
173
-
174
221
background: var (-- feed- background);
175
222
}
176
223
177
224
.container {
178
225
max- width: var (-- base- width);
179
226
height: 100 % ;
227
+ overflow: hidden;
228
+ overflow- x: scroll;
180
229
181
- margin: 0 24px ;
230
+ margin: 0 12px ;
182
231
183
232
& :: - webkit- scrollbar {
184
233
display: none;
@@ -199,7 +248,7 @@ onMounted(async () => {
199
248
}
200
249
201
250
.value {
202
- color: var (-- op - 40 );
251
+ color: var (-- txt - secondary );
203
252
}
204
253
205
254
.stat : hover {
@@ -212,7 +261,7 @@ onMounted(async () => {
212
261
}
213
262
214
263
.value {
215
- color: var (-- txt- secondary );
264
+ color: var (-- txt- primary );
216
265
}
217
266
}
218
267
0 commit comments