-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathSignalsTable.vue
More file actions
180 lines (150 loc) · 3.72 KB
/
SignalsTable.vue
File metadata and controls
180 lines (150 loc) · 3.72 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
<script setup>
/** UI */
import Tooltip from "@/components/ui/Tooltip.vue"
/** Components */
import AmountInCurrency from "@/components/AmountInCurrency.vue"
/** Services */
import { comma, shareOfTotalString, shortHex } from "@/services/utils"
const props = defineProps({
signals: {
type: Array,
required: true,
},
totalStake: {
type: String,
required: true,
}
})
</script>
<template>
<div :class="$style.wrapper_signals">
<table :class="$style.table">
<thead>
<tr>
<th><Text size="12" weight="600" color="tertiary">Validator</Text></th>
<th><Text size="12" weight="600" color="tertiary">Voting Power</Text></th>
<th><Text size="12" weight="600" color="tertiary">Block</Text></th>
<th><Text size="12" weight="600" color="tertiary">Transaction</Text></th>
</tr>
</thead>
<tbody>
<tr v-for="s in signals">
<td>
<NuxtLink :to="`/validator/${s.validator.id}`">
<Flex align="center" wide>
<Text size="13" weight="600" color="primary" mono style="text-overflow: ellipsis; overflow: hidden;">
{{ s.validator.moniker ? s.validator.moniker : shortHex(s.validator.cons_address) }}
</Text>
</Flex>
</NuxtLink>
</td>
<td>
<NuxtLink :to="`/tx/${s.tx_hash}`">
<Flex justify="center" direction="column" gap="4">
<AmountInCurrency :amount="{ value: s.voting_power, decimal: 0 }" />
<Tooltip position="start" delay="400">
<Text size="12" weight="600" color="tertiary">
{{ shareOfTotalString(parseFloat(s.voting_power) / 1_000_000, parseFloat(totalStake)) }}%
</Text>
<template #content>
<Flex align="center" justify="between" gap="8">
<Text size="12" color="secondary">Validator Share</Text>
<Text size="12" weight="600" color="primary">
{{ shareOfTotalString(parseFloat(s.voting_power) / 1_000_000, parseFloat(totalStake)) }}%
</Text>
</Flex>
</template>
</Tooltip>
</Flex>
</NuxtLink>
</td>
<td>
<NuxtLink :to="`/block/${s.height}`">
<Flex align="center">
<Outline>
<Flex align="center" gap="6">
<Icon name="block" size="14" color="secondary" />
<Text size="13" weight="600" color="primary" tabular>{{ comma(s.height) }}</Text>
</Flex>
</Outline>
</Flex>
</NuxtLink>
</td>
<td>
<NuxtLink :to="`/tx/${s.tx_hash}`">
<Flex align="center" gap="8">
<Icon
name="check-circle"
size="13"
color="green"
/>
<Text size="12" weight="600" color="primary" mono class="table_column_alias">
{{ $getDisplayName('txs', s.tx_hash) }}
</Text>
<CopyButton :text="s.tx_hash" />
</Flex>
</NuxtLink>
</td>
</tr>
</tbody>
</table>
</div>
</template>
<style module>
.wrapper_signals {
min-width: 100%;
width: 0;
height: 100%;
overflow-x: auto;
}
.table {
width: 100%;
height: fit-content;
border-spacing: 0px;
padding-bottom: 2px;
& 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;
}
}
& tr td {
padding: 0;
padding-top: 2px;
padding-bottom: 2px;
padding-right: 16px;
white-space: nowrap;
cursor: default;
&:first-child {
padding-left: 16px;
max-width: 220px;
}
&:last-child {
padding-right: 16px;
}
& > a {
display: flex;
min-height: 40px;
}
}
}
</style>