Skip to content

Commit

Permalink
fix the winner displaying
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeden committed Nov 30, 2023
1 parent 23b2bdd commit c618cac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/election/CandidateCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const vote = () =>
class="rounded-lg text-center shadow bg-gray-50"
:class="{
'!bg-secondary-50': isVotingOpen,
'!bg-green-50 shadow-lg': isVotingClosed
'!bg-white shadow-lg': isVotingClosed
}"
>
<div class="flex flex-1 flex-col p-8">
Expand All @@ -94,7 +94,7 @@ const vote = () =>
{{ props.candidate.owner }}
</p>
<dl
v-if="isVotingOpen"
v-if="isVotingOpen || isVotingClosed"
class="mt-1 flex flex-grow flex-col justify-between"
>
<dt class="sr-only">Role</dt>
Expand Down
9 changes: 8 additions & 1 deletion src/components/hero/ElectionHero.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { computed } from 'vue';
import { computed, onMounted } from 'vue';
import { useStore } from 'vuex';
import CandidateCard from '@/components/election/CandidateCard.vue';
Expand All @@ -15,6 +15,8 @@ const candidatesSorted = computed(
() => store.getters['ballot/candidatesSorted']
);
const ballot = computed(() => store.state.ballot.ballots);
const content = {
isNominationOpen: {
headline: 'Nominate Now!',
Expand All @@ -30,6 +32,11 @@ const content = {
subline: 'The election has concluded. A new IG has been elected - Exciting times ahead!'
}
};
onMounted(() => {
if (!ballot.value.length) store.dispatch('ballot/fetchBallots');
});
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/ballot.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const actions = {

commit('pushCandidates', rows);

if (getters.isVotingOpen) {
if (getters.isVotingOpen || getters.isVotingClosed) {
dispatch('fetchVotingBallots');
}
} catch (err) {
Expand Down

0 comments on commit c618cac

Please sign in to comment.