1
1
<template >
2
2
<v-col md =" 12" sm =" 12" xs =" 12" lg =" 6" xl =" 6" >
3
- <v-card class =" scroll" height =" 400" >
4
- <v-card-title
5
- ><v-chip small class =" mr-3" >{{ proposal.proposalId }}</v-chip
3
+ <v-card height =" 500" >
4
+ <v-card-header >
5
+ <v-chip small class =" mr-3" >{{ proposal.proposalId }}</v-chip >
6
+ </v-card-header >
7
+ <v-card-title class =" "
6
8
>{{ content.title }}
7
- <v-chip color =" primary " pill class =" ml-3" >{{
9
+ <v-chip color =" green " pill class =" ml-3" >{{
8
10
status
9
11
}}</v-chip ></v-card-title
10
12
>
11
13
<v-card-subtitle >{{ type }}</v-card-subtitle >
12
- <v-list-item three-line >
13
- <v-list-item-content >
14
- <v-list-item-title class =" text-h5" > Results </v-list-item-title >
15
- <v-list-item-subtitle >
16
- <strong >Yes</strong > -
17
- {{ proposal.finalTallyResult.yes }}
18
- </v-list-item-subtitle >
19
- <v-list-item-subtitle >
20
- <strong >No</strong > -
21
- {{ proposal.finalTallyResult.no }}
22
- </v-list-item-subtitle >
23
- <v-list-item-subtitle >
24
- <strong >No with veto</strong > -
25
- {{ proposal.finalTallyResult.noWithVeto }}
26
- </v-list-item-subtitle >
27
- <v-list-item-subtitle >
28
- <strong >Abstain</strong > -
29
- {{ proposal.finalTallyResult.abstain }}
30
- </v-list-item-subtitle >
31
- </v-list-item-content >
32
- </v-list-item >
33
- <v-card-text >{{ content.description }}</v-card-text >
14
+ <v-card-text >
15
+ <v-list-item-title class =" text-h5 my-5" > Results </v-list-item-title >
16
+ <v-row >
17
+ <v-col >
18
+ <v-chip >
19
+ <strong class =" mr-2" >Yes</strong
20
+ >{{ proposal.finalTallyResult.yes }}
21
+ </v-chip >
22
+ </v-col >
23
+ <v-col >
24
+ <v-chip >
25
+ <strong class =" mr-2" >No</strong >
26
+ {{ proposal.finalTallyResult.no }}
27
+ </v-chip >
28
+ </v-col >
29
+ </v-row >
30
+ <v-row >
31
+ <v-col >
32
+ <v-chip >
33
+ <strong class =" mr-2" >No with veto</strong >
34
+ {{ proposal.finalTallyResult.noWithVeto }}
35
+ </v-chip >
36
+ </v-col >
37
+ <v-col >
38
+ <v-chip >
39
+ <strong class =" mr-2" >Abstain</strong
40
+ >{{ proposal.finalTallyResult.abstain }}
41
+ </v-chip >
42
+ </v-col >
43
+ </v-row >
44
+ </v-card-text >
45
+
46
+ <v-card-text >{{ description }}</v-card-text >
47
+ <v-card-actions >
48
+ <v-btn variant =" contained-text" color =" primary"
49
+ >Vote
50
+ <v-dialog v-model =" dialog" activator =" parent" >
51
+ <v-card >
52
+ <v-card-text > Cast your vote </v-card-text >
53
+ <v-card-text >
54
+ <v-radio-group v-model =" vote" mandatory >
55
+ <v-radio label =" Yes" value =" yes" v-model =" vote" ></v-radio >
56
+ <v-radio label =" No" value =" no" v-model =" vote" ></v-radio >
57
+ <v-radio
58
+ label =" No With Veto"
59
+ value =" noWithVeto"
60
+ v-model =" vote"
61
+ ></v-radio >
62
+ <v-radio
63
+ label =" Abstain"
64
+ value =" abstain"
65
+ v-model =" vote"
66
+ ></v-radio >
67
+ </v-radio-group >
68
+ </v-card-text >
69
+
70
+ <v-card-actions >
71
+ <v-btn
72
+ @click =" castVote()"
73
+ variant =" contained-text"
74
+ color =" primary"
75
+ size =" large"
76
+ >
77
+ Vote
78
+ </v-btn >
79
+ <v-btn @click =" closeDialog()" > Close Dialog </v-btn >
80
+ </v-card-actions >
81
+ </v-card >
82
+ </v-dialog ></v-btn
83
+ >
84
+ <v-btn >See More</v-btn >
85
+ </v-card-actions >
34
86
</v-card >
35
87
</v-col >
36
88
</template >
37
89
38
90
<script >
91
+ import { mapGetters } from " vuex" ;
39
92
import Coin from " @/components/Coin.vue" ;
40
93
import { Proposal , TextProposal } from " cosmjs-types/cosmos/gov/v1beta1/gov" ;
41
94
import { Registry } from " @cosmjs/proto-signing" ;
95
+ import { ClientUpdateProposal } from " cosmjs-types/ibc/core/client/v1/client" ;
42
96
import { ParameterChangeProposal } from " cosmjs-types/cosmos/params/v1beta1/params" ;
43
97
import { SoftwareUpgradeProposal } from " cosmjs-types/cosmos/upgrade/v1beta1/upgrade" ;
44
98
import { CommunityPoolSpendProposal } from " cosmjs-types/cosmos/distribution/v1beta1/distribution" ;
@@ -83,16 +137,51 @@ const proposalType = (type) => {
83
137
case " /cosmos.gov.v1beta1.SoftwareUpgradeProposal" :
84
138
return " Software Upgrade" ;
85
139
break ;
140
+ case " /ibc.core.client.v1.ClientUpdateProposal" :
141
+ return " IBC Client Update" ;
142
+ break ;
86
143
default :
87
144
break ;
88
145
}
89
146
};
147
+
148
+ const excerpt = (string ) => {
149
+ if (string .length > 350 ) {
150
+ return string .substring (0 , 350 ) + " ..." ;
151
+ } else {
152
+ return string;
153
+ }
154
+ };
90
155
export default {
91
156
name: " Proposal" ,
92
157
components: { Coin },
158
+ data () {
159
+ return {
160
+ dialog: false ,
161
+ vote: " " ,
162
+ };
163
+ },
93
164
props: {
94
165
proposal: Object ,
95
166
},
167
+ methods: {
168
+ closeDialog () {
169
+ this .dialog = false ;
170
+ this .vote = " " ;
171
+ },
172
+ castVote () {
173
+ this .$store .dispatch (" castVote" , {
174
+ proposalId: this .proposal .proposalId ,
175
+ option: this .vote ,
176
+ voter: this .$store .state .wallet .address ,
177
+ });
178
+ },
179
+ },
180
+ methods: {
181
+ ... mapGetters ({
182
+ signingClient: " getSigningClient" ,
183
+ }),
184
+ },
96
185
computed: {
97
186
status () {
98
187
return proposalStatus (this .$props .proposal .status );
@@ -112,8 +201,15 @@ export default {
112
201
" /cosmos.distribution.v1beta1.CommunityPoolSpendProposal" ,
113
202
CommunityPoolSpendProposal
114
203
);
204
+ registry .register (
205
+ " /ibc.core.client.v1.ClientUpdateProposal" ,
206
+ ClientUpdateProposal
207
+ );
115
208
return registry;
116
209
},
210
+ description () {
211
+ return excerpt (this .content .description );
212
+ },
117
213
content () {
118
214
return this .registry .decode (this .$props .proposal .content );
119
215
},
@@ -126,6 +222,7 @@ export default {
126
222
127
223
<style scoped>
128
224
.scroll {
225
+ max-height : 100px ;
129
226
overflow-y : scroll ;
130
227
}
131
228
</style >
0 commit comments