Skip to content

Commit d36f17d

Browse files
committed
#135 Made voting mode a param
1 parent 042b926 commit d36f17d

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

src/components/elements/CouncilComponent.vue

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
<div align="center">
33
<div class="InfoContainer">
44
<info-component
5-
v-if="status === Status.VOTING"
65
class="ELement Info"
7-
:current-card="currentCard"
6+
:current-card="card"
87
/>
98
<div
10-
v-if="status === Status.VOTING"
119
class="ELement"
1210
>
1311
<CardComponent
@@ -16,7 +14,6 @@
1614
/>
1715
</div>
1816
<div
19-
v-if="status === Status.NOVOTESLEFT"
2017
class="ELement"
2118
>
2219
<img
@@ -35,6 +32,8 @@
3532
<script>
3633
import CardComponent from "@/components/elements/CardComponent";
3734
import InfoComponent from "@/components/elements/VotingComponents/InfoComponent.vue";
35+
import { Council } from "@/model/Council";
36+
import { Card } from "@/model/Card";
3837
3938
export default {
4039
name: "CouncilComponent",
@@ -49,8 +48,8 @@ export default {
4948
},
5049
data() {
5150
return {
52-
council: {},
53-
card: {},
51+
council: new Council(),
52+
card: new Card(),
5453
};
5554
},
5655
watch: {

src/plugins/cardChain.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { GenericAuthorization } from "../store/generated/cosmos/cosmos-sdk/cosmo
99
import { Card, ChainCard } from "@/model/Card";
1010
import { User } from "@/model/User";
1111
import { Coin } from "@/model/Coin";
12+
import { Council } from "@/model/Council";
1213
//import {Any} from "../store/generated/cosmos/cosmos-sdk/cosmos.authz.v1beta1/module/types/google/protobuf/any.js"
1314

1415
export default {
@@ -325,7 +326,7 @@ export default {
325326
this.vue.notifyFail('WTF', 'A council was looked up that does not exist in the blockchain.')
326327
throw new Error('Council with ' + id + ' does not exist.')
327328
} else {
328-
return res.data
329+
return Council.from(res.data)
329330
}
330331
})
331332
handleGetCardList = R.curry((res, type) => {

src/router/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const routes = [
7979
component: ImprintPage
8080
},
8181
{
82-
path: '/vote',
82+
path: '/vote/:mode?',
8383
name: 'Vote',
8484
component: VotingPage
8585
},

src/views/VotingPage.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
<button
1212
class="ModeButton"
1313
:style="`font-weight: ${ getThiccness(Mode.ENCOUNTER) }`"
14-
@click="mode = Mode.ENCOUNTER"
14+
@click="setMode(Mode.ENCOUNTER)"
1515
>
1616
<a>Encounters</a>
1717
</button>
1818
<button
1919
class="ModeButton"
2020
:style="`font-weight: ${ getThiccness(Mode.COUNCIL) }`"
21-
@click="mode = Mode.COUNCIL"
21+
@click="setMode(Mode.COUNCIL)"
2222
>
2323
<a>Council</a>
2424
</button>
@@ -50,7 +50,20 @@ export default {
5050
Mode: Mode,
5151
}
5252
},
53+
mounted() {
54+
let mode = this.$route.params.mode
55+
console.log("yees", mode)
56+
if (mode) {
57+
this.mode = parseInt(String(mode))
58+
} else {
59+
this.setMode(this.mode)
60+
}
61+
},
5362
methods: {
63+
setMode(mode) {
64+
this.mode = mode
65+
this.$router.push({name: "Vote", params: {mode: this.mode}})
66+
},
5467
getThiccness(mode) {
5568
if (mode === this.mode) {
5669
return "bold"

0 commit comments

Comments
 (0)