Skip to content

Commit 9a2c9e4

Browse files
committed
Update the design of the list of the nodes component
1 parent b737f07 commit 9a2c9e4

File tree

1 file changed

+60
-33
lines changed

1 file changed

+60
-33
lines changed

src/pages/Index.vue

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,19 @@
121121
<!-- List of nodes -->
122122
<div class="row q-pb-md q-col-gutter-xl">
123123
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
124-
<div class="row text-vgrey justify-between">
125-
<div class="col">
126-
<div class="text-italic">
127-
List of nodes on the network.
128-
<q-btn flat round size="sm" color="vgreen" icon="fas fa-question" class="">
129-
<q-tooltip content-class="bg-vgreen text-vdark" content-style="font-size: 16px" :offset="[10, 10]">List of the nodes is automatically updated every 5 minutes</q-tooltip>
130-
</q-btn>
131-
132-
</div>
133-
<div class="text-italic text-caption">*You are required to vote for 21 nodes per day to activate the distribution of VTX.</div>
124+
<q-banner inline-actions rounded class="bg-vdark text-vgrey q-mb-sm">
125+
<div class="text-italic">
126+
List of nodes on the network.
127+
<q-btn flat round size="sm" color="vgreen" icon="fas fa-question" class="">
128+
<q-tooltip content-class="bg-vgreen text-vdark" content-style="font-size: 16px" :offset="[10, 10]">List of the nodes is automatically updated every 5 minutes</q-tooltip>
129+
</q-btn>
134130
</div>
135-
<q-btn size="md" outline color="vgreen" icon="fas fa-sync-alt" class="q-mb-sm" v-on:click=refresh />
136-
</div>
131+
<div class="text-italic text-caption">*You are required to vote for 21 nodes per day to activate the distribution of VTX.</div>
132+
<template v-slot:action>
133+
<q-btn size="md" outline color="vgreen" label="Rules" class="q-mx-xs" v-on:click="rulesDialog=true" />
134+
<q-btn size="md" outline color="vgreen" icon="fas fa-sync-alt" class="q-mx-xs" v-on:click=refresh />
135+
</template>
136+
</q-banner>
137137
<q-scroll-area style="height: 300pt;">
138138
<q-list bordered separator class="bg-vdark inset-shadow text-vgrey" v-if="nodes.length > 0">
139139
<q-item v-for="node in nodes" :key="node.id">
@@ -330,6 +330,32 @@
330330
</q-card-actions>
331331
</q-card>
332332
</q-dialog>
333+
<!-- Voting rules dialog -->
334+
<q-dialog v-model="rulesDialog">
335+
<q-card style="min-width: 700px; max-width: 60vw;" class="bg-vgrey">
336+
<q-card-section>
337+
<div class="text-h6">Voting rules</div>
338+
</q-card-section>
339+
<q-card-section style="max-height: 60vh" class="scroll">
340+
<div class="text-subtitle1">1. Voting.</div>
341+
<ul>
342+
<li>You can't vote for the node without account name.</li>
343+
<li>You can't vote for the yourself (node with your account name).</li>
344+
<li>You can't vote for the node which is not registered in the contracts.</li>
345+
</ul>
346+
<div class="text-subtitle1">2. Reward.</div>
347+
<ul>
348+
<li>For being rewared your node should be running.</li>
349+
<li>Your node assigned account name should be added and registered in the contracts.</li>
350+
<li>The uptime of your node should be at least 24 hours.</li>
351+
<li>You have to vote for at least 2 other nodes to get the reward.</li>
352+
</ul>
353+
</q-card-section>
354+
<q-card-actions align="right">
355+
<q-btn flat label="Got it" v-close-popup />
356+
</q-card-actions>
357+
</q-card>
358+
</q-dialog>
333359
</q-page>
334360
</q-page-container>
335361
</q-layout>
@@ -406,6 +432,7 @@ export default {
406432
resultMessage: '',
407433
helpDialog: false,
408434
votedDialog: false,
435+
rulesDialog: false,
409436
isPwd: true,
410437
isPrvt: true,
411438
privateState: 'none',
@@ -733,21 +760,12 @@ export default {
733760
this.errorDialog = true
734761
}
735762
},
736-
async getAccountName (id, key, eos) {
737-
try {
738-
let accounts = await eos.getAccounts(key)
739-
let name = accounts.account_names[0]
740-
if (name) {
741-
let balance = await eos.getBalance(name)
742-
this.nodes[id].account = name
743-
this.nodes[id].balance = balance[0] ? balance[0] : '0 VTX'
744-
} else {
745-
this.nodes[id].account = 'No account found'
746-
this.nodes[id].balance = '-'
747-
}
748-
} catch (error) {
749-
this.errorMessage = error
750-
this.errorDialog = true
763+
async getListOfNodes () {
764+
await this.getNodes()
765+
const eos = new EosWrapper()
766+
for (var id in this.nodes) {
767+
// this.getAccountByKey(id, this.nodes[id].key)
768+
this.getAccountName(id, this.nodes[id].key, eos)
751769
}
752770
},
753771
async getNodes () {
@@ -767,12 +785,21 @@ export default {
767785
})
768786
})
769787
},
770-
async getListOfNodes () {
771-
await this.getNodes()
772-
const eos = new EosWrapper()
773-
for (var id in this.nodes) {
774-
// this.getAccountByKey(id, this.nodes[id].key)
775-
this.getAccountName(id, this.nodes[id].key, eos)
788+
async getAccountName (id, key, eos) {
789+
try {
790+
let accounts = await eos.getAccounts(key)
791+
let name = accounts.account_names[0]
792+
if (name) {
793+
let balance = await eos.getBalance(name)
794+
this.nodes[id].account = name
795+
this.nodes[id].balance = balance[0] ? balance[0] : '0 VTX'
796+
} else {
797+
this.nodes[id].account = 'No account found'
798+
this.nodes[id].balance = ''
799+
}
800+
} catch (error) {
801+
this.errorMessage = error
802+
this.errorDialog = true
776803
}
777804
},
778805
addToVote (node) {

0 commit comments

Comments
 (0)