-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathLargestChainsTable.vue
More file actions
208 lines (172 loc) · 4.63 KB
/
Copy pathLargestChainsTable.vue
File metadata and controls
208 lines (172 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<script setup>
/** UI */
import Button from "@/components/ui/Button.vue"
/** Constants */
import { IbcChainName } from "@/services/constants/ibc"
/** Services */
import { abbreviate } from "@/services/utils"
const props = defineProps({
chainsStats: {
type: Array,
default: [],
},
})
const largestChains = computed(() => props.chainsStats.slice(0, 5))
</script>
<template>
<Flex wide direction="column" gap="4">
<Flex align="center" gap="8" :class="$style.header">
<Icon name="globe" size="14" color="tertiary" />
<Text size="13" weight="600" color="primary">Largest chains</Text>
</Flex>
<Flex direction="column" gap="16" :class="$style.transfers_body">
<div v-if="largestChains?.length" :class="$style.table_scroller">
<table>
<thead>
<tr>
<th><Text size="12" weight="600" color="tertiary">Chain</Text></th>
<th><Text size="12" weight="600" color="tertiary">Sent</Text></th>
<th><Text size="12" weight="600" color="tertiary"></Text></th>
<th><Text size="12" weight="600" color="tertiary">Received</Text></th>
<th><Text size="12" weight="600" color="tertiary"></Text></th>
<th><Text size="12" weight="600" color="tertiary">Flow</Text></th>
</tr>
</thead>
<tbody>
<tr v-for="chain in largestChains" @click="navigateTo(`/ibc/chain/${chain.chain}`)">
<td>
<NuxtLink>
<Flex align="center">
<Text size="13" weight="600" color="primary">
{{ IbcChainName[chain.chain] ?? chain.chain }}
</Text>
</Flex>
</NuxtLink>
</td>
<td>
<NuxtLink>
<Flex align="center" gap="6">
<Icon name="arrow-narrow-up-right-circle" size="14" color="purple" />
<Text size="13" weight="600" color="primary" mono>
{{ abbreviate(chain.sent / 1_000_000) }} <Text color="secondary">TIA</Text>
</Text>
</Flex>
</NuxtLink>
</td>
<td>
<Text size="13" weight="600" color="tertiary" mono>+</Text>
</td>
<td>
<NuxtLink>
<Flex align="center" gap="6">
<Icon name="arrow-narrow-up-right-circle" size="14" color="brand" style="transform: scale(1, -1)" />
<Text size="13" weight="600" color="primary" mono>
{{ abbreviate(chain.received / 1_000_000) }} <Text color="tertiary">TIA</Text>
</Text>
</Flex>
</NuxtLink>
</td>
<td>
<Text size="13" weight="600" color="tertiary" mono>=</Text>
</td>
<td>
<NuxtLink>
<Flex align="center" gap="6">
<Icon name="coins" size="14" color="secondary" />
<Text size="13" weight="600" color="primary" mono>
{{ abbreviate(chain.flow / 1_000_000) }} <Text color="tertiary">TIA</Text>
</Text>
</Flex>
</NuxtLink>
</td>
</tr>
</tbody>
</table>
</div>
<Flex v-else align="center" justify="center" direction="column" gap="8" wide :class="$style.empty">
<Text size="13" weight="600" color="secondary" align="center"> Largest chains not found </Text>
<Text size="12" weight="500" height="160" color="tertiary" align="center" style="max-width: 220px">
This data is temporarily unavailable
</Text>
</Flex>
<div :class="$style.bottom">
<Button link="/ibc/chains" type="secondary" size="small" wide>
<Icon name="table" size="12" color="secondary" />
<Text size="12" weight="600" color="primary">View All Chains</Text>
</Button>
</div>
</Flex>
</Flex>
</template>
<style module>
.header {
height: 40px;
border-radius: 8px 8px 4px 4px;
background: var(--card-background);
padding: 0 12px;
}
.transfers_body {
flex: 1;
border-radius: 4px 4px 8px 8px;
background: var(--card-background);
& table {
width: 100%;
border-spacing: 0px;
& tbody {
& tr {
cursor: pointer;
transition: all 0.05s ease;
&:hover {
background: var(--op-5);
}
&:active {
background: var(--op-8);
}
}
}
& tr th {
text-align: left;
padding: 0;
padding-right: 16px;
padding-top: 16px;
padding-bottom: 8px;
&:first-child {
padding-left: 16px;
}
& span {
display: flex;
}
&.sortable {
cursor: pointer;
}
&.sortable:hover {
& span {
color: var(--txt-secondary);
}
}
}
& tr td {
padding: 0;
white-space: nowrap;
&:first-child {
padding-left: 16px;
}
& > a {
display: flex;
min-height: 40px;
padding-right: 16px;
}
}
}
}
.empty {
margin: 32px 0 16px 0;
}
.bottom {
padding: 0 16px 16px 16px;
}
.table_scroller {
flex: 1;
overflow-x: auto;
}
</style>