Skip to content

Commit 19f816a

Browse files
authored
Merge pull request #530 from khaihkd/master
Optimze UI
2 parents b5d5f83 + 56cd45f commit 19f816a

File tree

6 files changed

+43
-33
lines changed

6 files changed

+43
-33
lines changed

client/assets/scss/components/_table.scss

+18-18
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
padding: 0 20px;
2424
}
2525
}
26-
26+
2727
@include media-breakpoint-up(xl) {
2828
tr {
2929
padding: 0 30px;
@@ -40,7 +40,7 @@
4040
box-shadow: 8px 8px 40px 0 rgba(0, 0, 0, .07);
4141
padding: 17px 20px 16px;
4242
margin-bottom: 20px;
43-
43+
4444
@include media-breakpoint-up(lg) {
4545
display: grid;
4646
align-items: center;
@@ -173,11 +173,11 @@
173173
tbody tr {
174174

175175
@include media-breakpoint-up(lg) {
176-
grid-template-columns: 10% 40% 40% 10%;
176+
grid-template-columns: 15% 45% 40%;
177177
}
178178

179179
@include media-breakpoint-up(xl) {
180-
grid-template-columns: 10% 40% 42% 8%;
180+
grid-template-columns: 15% 45% 40%;
181181
}
182182
}
183183

@@ -245,7 +245,7 @@
245245
i.tx-failed {
246246
vertical-align: middle;
247247
}
248-
248+
249249
thead tr,
250250
tbody tr {
251251

@@ -264,15 +264,15 @@
264264

265265
.text-truncate {
266266
max-width: 8.75rem;
267-
267+
268268
@include media-breakpoint-up(lg) {
269269
max-width: 7rem;
270270
}
271-
271+
272272
@include media-breakpoint-up(xl) {
273273
max-width: 9rem;
274274
}
275-
275+
276276
@include media-breakpoint-up(2xl) {
277277
max-width: 11rem;
278278
}
@@ -299,15 +299,15 @@
299299

300300
.text-truncate {
301301
max-width: 8.75rem;
302-
302+
303303
@include media-breakpoint-up(lg) {
304304
max-width: 7rem;
305305
}
306-
306+
307307
@include media-breakpoint-up(xl) {
308308
max-width: 9rem;
309309
}
310-
310+
311311
@include media-breakpoint-up(2xl) {
312312
max-width: 11rem;
313313
}
@@ -391,7 +391,7 @@
391391

392392
thead tr,
393393
tbody tr {
394-
394+
395395
@include media-breakpoint-up(lg) {
396396
grid-template-columns: 10% 40% 40% 10%;
397397
}
@@ -413,16 +413,16 @@
413413
}
414414

415415
.tomo-table--follow {
416-
416+
417417
thead tr,
418418
tbody tr {
419-
419+
420420
@include media-breakpoint-up(lg) {
421421
grid-template-columns: 30% 30% 30% 10%;
422422
}
423423

424424
@include media-breakpoint-up(xl) {
425-
grid-template-columns: 31% 33% 30% 6%;
425+
grid-template-columns: 31% 33% 30% 6%;
426426
}
427427
}
428428

@@ -564,15 +564,15 @@
564564
tbody tr {
565565

566566
@include media-breakpoint-up(lg) {
567-
grid-template-columns: 25% 15% 22% 20% 8% 10%;
567+
grid-template-columns: 35% 20% 22% 8% 15%;
568568
}
569569

570570
@include media-breakpoint-up(xl) {
571-
grid-template-columns: 25% 15% 20% 20% 10% 10%;
571+
grid-template-columns: 35% 20% 20% 10% 15%;
572572
}
573573

574574
@include media-breakpoint-up(2xl) {
575-
grid-template-columns: 28% 12% 20% 20% 10% 10%;
575+
grid-template-columns: 38% 17% 20% 10% 15%;
576576
}
577577
}
578578

client/components/TableTx.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108

109109
<template
110110
slot="txFee"
111-
slot-scope="props">{{ formatUnit(toTomo(props.item.gasPrice * props.item.gasUsed)) }}</template>
111+
slot-scope="props">{{ formatUnit(toTomo(props.item.gasPrice * props.item.gasUsed, 8)) }}</template>
112112
</table-base>
113113

114114
<b-pagination-nav

client/layouts/default.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
class="tomo-footer__copyright">
180180
<p>TomoScan 2018 - Running on TomoChain
181181
<code class="text-muted copyright__code">
182-
tomo/v0.2.2-alpha/linux-amd64/go1.10.3
182+
tomo/v1.1.0-stable/linux-amd64/go1.10.5
183183
</code>
184184
</p>
185185
</b-col>

client/pages/contracts/index.vue

-7
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@
4040
<span>{{ props.item.compiler }}</span>
4141
</template>
4242

43-
<template
44-
slot="balance"
45-
slot-scope="props">
46-
<span>{{ formatUnit(toTomo(props.item.balance)) }}</span>
47-
</template>
48-
4943
<template
5044
slot="txCount"
5145
slot-scope="props">
@@ -85,7 +79,6 @@ export default {
8579
hash: { label: 'Address' },
8680
contractName: { label: 'ContractName' },
8781
compiler: { label: 'Compiler' },
88-
balance: { label: 'Balance' },
8982
txCount: { label: 'TxCount' },
9083
createdAt: { label: 'Date Verified' }
9184
},

client/pages/txs/_slug.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@
136136
</tr>
137137
<tr>
138138
<td>Gas Price</td>
139-
<td>{{ formatUnit(toTomo(tx.gasPrice)) }}</td>
139+
<td>{{ formatUnit(toTomo(tx.gasPrice, 8)) }}</td>
140140
</tr>
141141
<tr>
142142
<td>Actual Tx Cost/Fee</td>
143-
<td>{{ formatUnit(toTomo(tx.gasPrice * tx.gasUsed)) }}</td>
143+
<td>{{ formatUnit(toTomo(tx.gasPrice * tx.gasUsed, 8)) }}</td>
144144
</tr>
145145
<tr v-if="tx.tokenTxs && tx.tokenTxs.length">
146146
<td>Token Transfer</td>

client/plugins/mixin.js

+21-4
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,28 @@ const mixin = {
2121
return [].concat.apply([], query).join('&')
2222
},
2323

24-
formatNumber: (number) => {
24+
formatNumber: (number, limitComma = 5) => {
2525
let seps = number.toString().split('.')
2626
seps[0] = seps[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
27+
if (seps[1]) {
28+
seps[1] = seps[1].toString().substring(0, limitComma)
29+
}
2730

28-
return seps.join('.')
31+
let ret = seps.join('.')
32+
let count = limitComma
33+
let sCompare = '0.'
34+
let str = '0.'
35+
while (count > 0) {
36+
count--
37+
sCompare += '0'
38+
if (count >= 1) {
39+
str += '0'
40+
}
41+
}
42+
if (ret === sCompare) {
43+
ret = `< ${str}1`
44+
}
45+
return ret
2946
},
3047

3148
toLongNumberString: (n) => {
@@ -51,7 +68,7 @@ const mixin = {
5168
return str + str2
5269
},
5370

54-
toTomo: (wei) => {
71+
toTomo: (wei, limitComma = 5) => {
5572
if (isNaN(wei)) {
5673
return '0'
5774
}
@@ -68,7 +85,7 @@ const mixin = {
6885

6986
weiNumber = weiNumber.dividedBy(divided).toString()
7087

71-
return mixin.methods.formatNumber(weiNumber)
88+
return mixin.methods.formatNumber(weiNumber, limitComma)
7289
},
7390

7491
toEtherNumber: (wei) => web3.utils.fromWei(wei, 'ether'),

0 commit comments

Comments
 (0)