From 2456498881bdb91bd260982bb9f5afb7e58e9e64 Mon Sep 17 00:00:00 2001 From: crowetic Date: Wed, 11 Dec 2024 18:32:48 -0800 Subject: [PATCH] added poll voting functionality --- assets/js/MinterBoard.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/assets/js/MinterBoard.js b/assets/js/MinterBoard.js index 5cdb276..e775b02 100644 --- a/assets/js/MinterBoard.js +++ b/assets/js/MinterBoard.js @@ -318,9 +318,9 @@ const calculatePollResults = (pollData, minterGroupMembers) => { const voterAddress = getAddressFromPublicKey(vote.voterPublicKey); const isAdmin = minterGroupMembers.some(member => member.member === voterAddress && member.isAdmin); - if (vote.optionIndex === 1) { + if (vote.optionIndex === 0) { isAdmin ? adminYes++ : memberAddresses.includes(voterAddress) ? minterYes++ : null; - } else if (vote.optionIndex === 0) { + } else if (vote.optionIndex === 1) { isAdmin ? adminNo++ : memberAddresses.includes(voterAddress) ? minterNo++ : null; } }); @@ -417,6 +417,21 @@ const displayComments = async (cardIdentifier) => { } }; +const voteYesOnPoll = async (poll) => { + await qortalRequest({ + action: "VOTE_ON_POLL", + pollName: poll, + optionIndex: 0, + }); +} + +const voteNoOnPoll = async (poll) => { + await qortalRequest({ + action: "VOTE_ON_POLL", + pollName: poll, + optionIndex: 1, + }); +} const toggleComments = async (cardIdentifier) => { const commentsSection = document.getElementById(`comments-section-${cardIdentifier}`); @@ -476,9 +491,9 @@ async function createCardHTML(cardData, pollResults, cardIdentifier) {
Support Minter?
- + - +