Skip to content

Commit

Permalink
#135 Made voting mode a param
Browse files Browse the repository at this point in the history
  • Loading branch information
lxgr-linux committed Jan 17, 2023
1 parent 042b926 commit d36f17d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
11 changes: 5 additions & 6 deletions src/components/elements/CouncilComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
<div align="center">
<div class="InfoContainer">
<info-component
v-if="status === Status.VOTING"
class="ELement Info"
:current-card="currentCard"
:current-card="card"
/>
<div
v-if="status === Status.VOTING"
class="ELement"
>
<CardComponent
Expand All @@ -16,7 +14,6 @@
/>
</div>
<div
v-if="status === Status.NOVOTESLEFT"
class="ELement"
>
<img
Expand All @@ -35,6 +32,8 @@
<script>
import CardComponent from "@/components/elements/CardComponent";
import InfoComponent from "@/components/elements/VotingComponents/InfoComponent.vue";
import { Council } from "@/model/Council";
import { Card } from "@/model/Card";
export default {
name: "CouncilComponent",
Expand All @@ -49,8 +48,8 @@ export default {
},
data() {
return {
council: {},
card: {},
council: new Council(),
card: new Card(),
};
},
watch: {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/cardChain.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { GenericAuthorization } from "../store/generated/cosmos/cosmos-sdk/cosmo
import { Card, ChainCard } from "@/model/Card";
import { User } from "@/model/User";
import { Coin } from "@/model/Coin";
import { Council } from "@/model/Council";
//import {Any} from "../store/generated/cosmos/cosmos-sdk/cosmos.authz.v1beta1/module/types/google/protobuf/any.js"

export default {
Expand Down Expand Up @@ -325,7 +326,7 @@ export default {
this.vue.notifyFail('WTF', 'A council was looked up that does not exist in the blockchain.')
throw new Error('Council with ' + id + ' does not exist.')
} else {
return res.data
return Council.from(res.data)
}
})
handleGetCardList = R.curry((res, type) => {
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const routes = [
component: ImprintPage
},
{
path: '/vote',
path: '/vote/:mode?',
name: 'Vote',
component: VotingPage
},
Expand Down
17 changes: 15 additions & 2 deletions src/views/VotingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<button
class="ModeButton"
:style="`font-weight: ${ getThiccness(Mode.ENCOUNTER) }`"
@click="mode = Mode.ENCOUNTER"
@click="setMode(Mode.ENCOUNTER)"
>
<a>Encounters</a>
</button>
<button
class="ModeButton"
:style="`font-weight: ${ getThiccness(Mode.COUNCIL) }`"
@click="mode = Mode.COUNCIL"
@click="setMode(Mode.COUNCIL)"
>
<a>Council</a>
</button>
Expand Down Expand Up @@ -50,7 +50,20 @@ export default {
Mode: Mode,
}
},
mounted() {
let mode = this.$route.params.mode
console.log("yees", mode)
if (mode) {
this.mode = parseInt(String(mode))
} else {
this.setMode(this.mode)
}
},
methods: {
setMode(mode) {
this.mode = mode
this.$router.push({name: "Vote", params: {mode: this.mode}})
},
getThiccness(mode) {
if (mode === this.mode) {
return "bold"
Expand Down

0 comments on commit d36f17d

Please sign in to comment.