-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jordan/1502 page proposal #1531
Changes from 9 commits
732f9cc
5f11091
2a6b2b9
aa642fb
06c4d1d
1a4b057
d4f8e47
8492b46
113db7e
13ae57f
909cdfe
680d366
dba9e91
26f26c5
5c4f6cb
22eced1
74443d1
34ab41a
8ab024e
09b1a58
99c5296
7963057
2a28a41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
<template lang="pug"> | ||
tm-page(data-title='Proposal') | ||
template(slot="menu-body"): tm-balance | ||
div(slot="menu"): tm-tool-bar | ||
router-link(to="/governance" exact): i.material-icons arrow_back | ||
|
||
tm-data-error(v-if="!proposal") | ||
|
||
template(v-else) | ||
.validator-profile__header.validator-profile__section.proposal | ||
.column.validator-profile__header__info | ||
.row.validator-profile__header__name | ||
.top.column | ||
div.validator-profile__status-and-title | ||
span.validator-profile__status(v-bind:class="statusColor" v-tooltip.top="status") | ||
.validator-profile__header__name__title {{ proposal.title }} | ||
.column.validator-profile__header__actions | ||
tm-btn(v-if="button === 'vote'" value="Vote" color="primary" @click.native="vote") | ||
tm-btn(v-if="button === 'deposit'" value="Deposit" color="primary" @click.native="deposit") | ||
tm-btn(v-if="!button" disabled value="Deposit / Vote" color="primary") | ||
|
||
.row.description | ||
p This {{ proposalType }} proposal ({{ `#` + proposal.proposal_id }}) was submitted at block {{ submitBlock }} and voting started at {{ voteBlock }}. | ||
|
||
.row.validator-profile__header__data.votes | ||
dl.colored_dl | ||
dt Deposit | ||
dd {{ proposal.total_deposit[0].amount + ` ` + proposal.total_deposit[0].denom }} | ||
.validator-profile__header__data__break | ||
dl.colored_dl | ||
dt Yes | ||
dd {{ proposal.tally_result.yes }} / {{ yesPercentage }} | ||
dl.colored_dl | ||
dt No | ||
dd {{ proposal.tally_result.no }} / {{ noPercentage }} | ||
dl.colored_dl | ||
dt No with Veto | ||
dd {{ proposal.tally_result.no_with_veto }} / {{ noWithVetoPercentage }} | ||
dl.colored_dl | ||
dt Abstain | ||
dd {{ proposal.tally_result.abstain }} / {{ abstainPercentage }} | ||
|
||
.validator-profile__details.validator-profile__section | ||
.column | ||
.row | ||
text-block(:content="proposal.description") | ||
</template> | ||
|
||
<script> | ||
import num from "scripts/num" | ||
import { TmBtn, TmFormStruct, TmPage, TmPart, TmToolBar } from "@tendermint/ui" | ||
import TmBalance from "common/TmBalance" | ||
import FieldVote from "common/TmFieldVote" | ||
import TextBlock from "common/TextBlock" | ||
export default { | ||
name: `page-proposal`, | ||
props: [`proposal`], | ||
components: { | ||
TmBalance, | ||
TmBtn, | ||
FieldVote, | ||
TmFormStruct, | ||
TmToolBar, | ||
TmPage, | ||
TmPart, | ||
TextBlock | ||
}, | ||
computed: { | ||
proposalType() { | ||
return this.proposal.proposal_type.toLowerCase() | ||
}, | ||
submitBlock() { | ||
return `#` + num.prettyInt(this.proposal.submit_block) | ||
}, | ||
voteBlock() { | ||
if (this.proposal.submit_block === this.proposal.voting_start_block) { | ||
return `the same block` | ||
} else { | ||
return `block #` + num.prettyInt(this.proposal.voting_start_block) | ||
} | ||
}, | ||
button() { | ||
if (this.proposal.proposal_status === `Passed`) return null | ||
|
||
if (this.proposal.proposal_status === `Rejected`) return null | ||
|
||
if (this.proposal.proposal_status === `Active`) return `vote` | ||
|
||
if (this.proposal.proposal_status === `Pending`) return `deposit` | ||
}, | ||
status() { | ||
if (this.proposal.proposal_status === `Passed`) | ||
return `This proposal has passed` | ||
|
||
if (this.proposal.proposal_status === `Rejected`) | ||
return `This proposal has been rejected and voting is closed` | ||
|
||
if (this.proposal.proposal_status === `Active`) | ||
return `Voting for this proposal is open` | ||
|
||
if (this.proposal.proposal_status === `Pending`) | ||
return `Deposits are open for this proposal` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deposits are always open as long as the proposal is open (i.e you can also deposit when the proposal is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why would a user deposit if a proposal has received enough to open voting? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also said that... But you can ask @sunnya97 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we'll see what sunny says, but i don't think we should block on this. |
||
}, | ||
statusColor() { | ||
if (this.proposal.proposal_status === `Passed`) return `green` | ||
if (this.proposal.proposal_status === `Rejected`) return `red` | ||
if (this.proposal.proposal_status === `Active`) return `blue` | ||
if (this.proposal.proposal_status === `Pending`) return `yellow` | ||
}, | ||
totalVotes() { | ||
return ( | ||
this.proposal.tally_result.yes + | ||
this.proposal.tally_result.no + | ||
this.proposal.tally_result.no_with_veto + | ||
this.proposal.tally_result.abstain | ||
) | ||
}, | ||
yesPercentage() { | ||
return num.percentInt(this.proposal.tally_result.yes / this.totalVotes) | ||
}, | ||
noPercentage() { | ||
return num.percentInt(this.proposal.tally_result.no / this.totalVotes) | ||
}, | ||
noWithVetoPercentage() { | ||
return num.percentInt( | ||
this.proposal.tally_result.no_with_veto / this.totalVotes | ||
) | ||
}, | ||
abstainPercentage() { | ||
return num.percentInt( | ||
this.proposal.tally_result.abstain / this.totalVotes | ||
) | ||
} | ||
}, | ||
data: () => ({ | ||
votePick: `abstain`, | ||
voteVisible: false | ||
}), | ||
methods: { | ||
vote(choice) { | ||
this.votePick = choice | ||
}, | ||
confirmVote() { | ||
this.$store.commit(`notify`, { | ||
title: `Voted '${this.votePick}'`, | ||
body: `Your vote has been submitted.` | ||
}) | ||
}, | ||
commentOnProposal(proposalId) { | ||
this.$store.commit(`notify`, { | ||
title: `View Discussion Thread`, | ||
body: `TODO: Discuss ${proposalId} proposal on the forum.` | ||
}) | ||
}, | ||
proposalIsSpam(proposalId) { | ||
fedekunze marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.$store.commit(`notify`, { | ||
title: `Mark Proposal As Spam`, | ||
body: `TODO: Mark ${proposalId} proposal as a spam attack.` | ||
}) | ||
}, | ||
toggleVoteVisible() { | ||
this.voteVisible = !this.voteVisible | ||
} | ||
} | ||
} | ||
</script> | ||
<style lang="stylus"> | ||
@require '~variables'; | ||
.proposal | ||
b | ||
color var(--bright) | ||
|
||
.validator-profile__status | ||
position relative | ||
left 0 | ||
margin-right 0.5rem | ||
|
||
.description | ||
max-width 500px | ||
|
||
.votes | ||
padding-top 2rem | ||
|
||
.proposal-id | ||
color var(--dim) | ||
font-size 14px | ||
margin 0 | ||
font-weight 400 | ||
padding-bottom 0.25rem | ||
|
||
.text-block | ||
padding 0 | ||
|
||
.row b | ||
font-weight 500 | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,12 @@ export default { | |
tooltip: `The title of the proposal`, | ||
class: `proposal_title` | ||
}, | ||
{ | ||
title: `Submitted Block`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorting by proposal id is the same There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true, but i added a column for submit block instead. do you think showing ID as its own column would be better? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can discuss it later |
||
value: `submit_block`, | ||
tooltip: `Block height when proposal was submitted`, | ||
class: `submit_block` | ||
}, | ||
{ | ||
title: `Yes`, | ||
value: `tally_result.yes`, | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,17 +25,16 @@ export default [ | |||||
path: `/governance/proposals/new`, | ||||||
component: governance(`ProposalsNewText`) | ||||||
}, | ||||||
// TODO: enable once PageProposal is finished | ||||||
// { | ||||||
// path: `governance/proposals/:proposal`, | ||||||
// name: `proposal`, | ||||||
// component: governance(`Proposal`) | ||||||
// }, | ||||||
|
||||||
{ | ||||||
path: `/governance/:proposalId`, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd change this to
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how come? |
||||||
name: `Proposal`, | ||||||
component: require(`./components/governance/PageProposal`).default, | ||||||
props: true | ||||||
}, | ||||||
// STAKE | ||||||
{ | ||||||
path: `/staking`, | ||||||
name: `staking`, | ||||||
name: `Staking`, | ||||||
component: staking(`Staking`), | ||||||
redirect: `/staking/my-delegations/`, | ||||||
children: [ | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this cover all the cases / is this true?