Skip to content
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

Implementing Candidates Vote count #36

Merged
merged 4 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/chainActions/nominfAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default ({
telegram,
twitter,
oig_prefix,
pubkey,
pubkey
}) => ({
account: OIG_ACCOUNT,
name: 'nominf',
Expand Down
2 changes: 1 addition & 1 deletion src/components/HeadingArticles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ onMounted(() => {
>
View all Articles
<span aria-hidden="true"> &rarr;</span>
</a>
</a>
</div>
</div>
</template>
3 changes: 1 addition & 2 deletions src/components/HeadingComp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const resources = [
class="z-8 flex items-center justify-between py-10 sm:py-12 md:justify-start md:space-x-10"
>
<div>
<router-link :to="{ name: 'home' }" class="flex items-center" tag="a">
<router-link :to="{ name: 'home' }" class="flex items-center">
<img
class="h-8 w-auto sm:h-10"
src="@/assets/images/oig-logo.png"
Expand Down Expand Up @@ -345,7 +345,6 @@ const resources = [
:to="{ name: 'home' }"
:onClick="close"
class="flex items-center"
tag="a"
>
<img
class="h-10 w-10 flex-1"
Expand Down
8 changes: 4 additions & 4 deletions src/components/MediumFeedSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { useStore } from 'vuex';
import { onMounted, computed } from 'vue';
import ButtonText from '@/components/button/ButtonText.vue';
import ButtonPrimary from '@/components/button/ButtonPrimary.vue';
import LoadingSpinner from './LoadingSpinner.vue';

const store = useStore();
Expand Down Expand Up @@ -38,7 +37,9 @@ const mediumLink = 'https://waxoig.medium.com/';
:key="article.guid"
class="relative flex group"
>
<div class="bg-white drop-shadow-sm hover:drop-shadow-md px-5 py-6 rounded-md relative z-20">
<div
class="bg-white drop-shadow-sm hover:drop-shadow-md px-5 py-6 rounded-md relative z-20"
>
<div class="relative w-full hidden z-20">
<img
:src="article.thumbnail"
Expand Down Expand Up @@ -79,15 +80,14 @@ const mediumLink = 'https://waxoig.medium.com/';
</div>
</div>
<div class="mx-auto max-w-xl mt-10 text-center">

<a
:href="mediumLink"
target="_blank"
class="inline-block rounded-md whitespace-nowrap bg-primary px-3.5 py-2.5 text-sm text-white shadow-sm hover:bg-primary-700 hover:text-white focus-visible:outline-none outline-none"
>
View all Articles
<span class="ml-1" aria-hidden="true"> &rarr;</span>
</a>
</a>
</div>
</div>
</template>
2 changes: 1 addition & 1 deletion src/components/OIGSkills.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<h2
class="mt-2 text-2xl font-bold tracking-tight text-primary sm:text-4xl"
>
Job skills
Job skills
</h2>
<div
class="mt-8 grid max-w-xl grid-cols-1 gap-8 gap-y-12 text-base leading-7 lg:max-w-none lg:grid-cols-2"
Expand Down
4 changes: 3 additions & 1 deletion src/components/election/BallotCandidates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ onMounted(() => {
});
</script>
<template>
<div class="border border-gray-200 drop-shadow-sm bg-white rounded-md mt-8 md:mt-12">
<div
class="border border-gray-200 drop-shadow-sm bg-white rounded-md mt-8 md:mt-12"
>
<div class="border-b border-gray-200 px-4 py-5 sm:px-6">
<div
class="-ml-4 -mt-4 flex flex-wrap items-center justify-between sm:flex-nowrap"
Expand Down
27 changes: 19 additions & 8 deletions src/components/election/CandidateCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import ConfirmationModal from '../modal/ConfirmationModal.vue';
import { useSession } from '../../composables/useSession';
import { XCircleIcon } from '@heroicons/vue/20/solid';

import { DocumentMagnifyingGlassIcon, StarIcon } from '@heroicons/vue/24/outline';
import {
DocumentMagnifyingGlassIcon,
StarIcon
} from '@heroicons/vue/24/outline';

const props = defineProps({
candidate: Object
Expand All @@ -16,9 +19,7 @@ const store = useStore();

const session = useSession();

const isVotingOpen = computed(
() => store.getters['ballot/isVotingOpen']
);
const isVotingOpen = computed(() => store.getters['ballot/isVotingOpen']);

const router = useRouter();
const route = useRoute();
Expand Down Expand Up @@ -62,7 +63,13 @@ function confirmVoting() {
vote();
}

const vote = () => store.dispatch('ballot/vote', props.candidate);
const vote = () =>
store.dispatch('ballot/vote', {
candidate: props.candidate,
success: () => {
isVotingConfirmationModalOpen.value = false;
}
});
</script>

<template>
Expand All @@ -79,15 +86,19 @@ const vote = () => store.dispatch('ballot/vote', props.candidate);
<p class="text-sm text-gray-500">
{{ props.candidate.owner }}
</p>
<!-- <dl v-if="isVotingOpen" class="mt-1 flex flex-grow flex-col justify-between">
<dl
v-if="isVotingOpen"
class="mt-1 flex flex-grow flex-col justify-between"
>
<dt class="sr-only">Role</dt>
<dd class="mt-3">
<span
class="inline-flex items-center rounded-full bg-green-50 px-4 py-2 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20"
>123123 VOTE</span
>
{{ props?.candidate?.votes }}
</span>
</dd>
</dl> -->
</dl>
</div>
<div>
<div class="-mt-px flex divide-x border-t border-t-gray-200">
Expand Down
15 changes: 11 additions & 4 deletions src/components/election/CandidateDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ const session = useSession();

const router = useRouter();

const dialogOpen = ref(true);

const isVotingConfirmationModalOpen = ref(false);

const closeModal = () => router.push('/election');

function openVotingConfirmationModal() {
isVotingConfirmationModalOpen.value = true;
}
Expand All @@ -44,10 +48,13 @@ function confirmVoting() {
vote();
}

const vote = () => store.dispatch('ballot/vote', candidate.value);

const dialogOpen = ref(true);
const closeModal = () => router.push('/election');
const vote = () =>
store.dispatch('ballot/vote', {
candidate: candidate.value,
success: () => {
isVotingConfirmationModalOpen.value = false;
}
});
</script>

<template>
Expand Down
4 changes: 3 additions & 1 deletion src/components/evaluation/EvaluationResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ onMounted(() => {
Latest Reviews
</h2>
<p class="mt-4 text-sm">
All Guild Reviews since January 2023 are listed below. That's when the processing of guilds scores has moved on-chain. For previous review please visit the respective guild archives on notion.
All Guild Reviews since January 2023 are listed below. That's when the
processing of guilds scores has moved on-chain. For previous review
please visit the respective guild archives on notion.
</p>
</div>
<div class="mt-4 sm:ml-16 sm:mt-0 sm:flex-none">
Expand Down
2 changes: 1 addition & 1 deletion src/components/guild/GuildActionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {
ChatBubbleLeftRightIcon,
DocumentTextIcon,
ShieldCheckIcon,
TrophyIcon,
TrophyIcon
} from '@heroicons/vue/24/outline';

const actions = [
Expand Down
2 changes: 1 addition & 1 deletion src/components/oig/OIGPillars.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const pillars = [
:key="index"
class="prose px-8 py-6 md:py-4"
>
<h2 class="mb-3">{{ index+1 }}</h2>
<h2 class="mb-3">{{ index + 1 }}</h2>
<p>{{ pillar }}</p>
</div>
</div>
Expand Down
8 changes: 5 additions & 3 deletions src/composables/useTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ export default async (actions, success = () => {}, error = () => {}) => {

try {
await transact(actions);
// success();

success();

notify({
title: 'Success',
text: 'The action was successful',
type: 'success'
});
} catch (err) {
// error(err);
error(err);

notify({
title: 'Error',
text: err,
type: 'error'
});
console.log('error caught in transact', err);
}
};
14 changes: 14 additions & 0 deletions src/composables/useVotingBallots.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import useTableRows from '@/composables/useTableRows';
import { DECIDE_ACCOUNT } from '@/constants';

export default async (ballot) => {
return await useTableRows({
code: DECIDE_ACCOUNT,
scope: DECIDE_ACCOUNT,
table: 'ballots',
limit: 1,
lower_bound: ballot,
upper_bound: ballot,
json: true
});
};
Loading