diff --git a/package.json b/package.json index 53f47ad..c9e6030 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@emotion/styled": "^11.10.6", "@rainbow-me/rainbowkit": "^2.1.2", "@tanstack/react-query": "^5.40.1", - "@vocdoni/chakra-components": "~0.9.7", + "@vocdoni/chakra-components": "~0.9.8", "@vocdoni/sdk": "~0.9.1", "date-fns": "^4.1.0", "ethers": "^5.7.2", diff --git a/src/components/Process/Aside.tsx b/src/components/Process/Aside.tsx index 76b7980..3a37243 100644 --- a/src/components/Process/Aside.tsx +++ b/src/components/Process/Aside.tsx @@ -199,7 +199,13 @@ const ProcessAside = () => { export const VoteButton = ({ ...props }: FlexProps) => { const { t } = useTranslation() - const { election, connected, isAbleToVote, isInCensus } = useElection() + const { + election, + connected, + isAbleToVote, + isInCensus, + loading: { voting }, + } = useElection() const { isConnected } = useAccount() if (!(election instanceof PublishedElection)) { @@ -272,6 +278,7 @@ export const VoteButton = ({ ...props }: FlexProps) => { opacity: '0.8', }, }} + isLoading={voting} /> {isWeighted && } diff --git a/src/components/Process/Chained.tsx b/src/components/Process/Chained.tsx index 72a6147..0e37ce6 100644 --- a/src/components/Process/Chained.tsx +++ b/src/components/Process/Chained.tsx @@ -2,7 +2,7 @@ import { Box, Progress } from '@chakra-ui/react' import { ConnectButton } from '@rainbow-me/rainbowkit' import { ElectionQuestions, ElectionResults, SpreadsheetAccess } from '@vocdoni/chakra-components' import { ElectionProvider, useElection } from '@vocdoni/react-providers' -import { ArchivedElection, InvalidElection, IVotePackage, PublishedElection, VocdoniSDKClient } from '@vocdoni/sdk' +import { InvalidElection, IVotePackage, PublishedElection, VocdoniSDKClient } from '@vocdoni/sdk' import { useEffect, useState } from 'react' import { Trans } from 'react-i18next' import { VoteButton } from './Aside' @@ -68,7 +68,7 @@ const ChainedProcessesInner = ({ connected }: ChainedProcessesInnerProps) => { } type ChainedProcessesProps = { - root?: PublishedElection | ArchivedElection | InvalidElection + root?: PublishedElection | InvalidElection } export const ChainedProcesses = ({ root }: ChainedProcessesProps) => { diff --git a/src/components/Process/ConfirmVoteModal.tsx b/src/components/Process/ConfirmVoteModal.tsx index 85583d9..828a596 100644 --- a/src/components/Process/ConfirmVoteModal.tsx +++ b/src/components/Process/ConfirmVoteModal.tsx @@ -79,6 +79,18 @@ export const ConfirmVoteModal = ({ election, answers }: { election: PublishedEle const ConfirmMultiquestion = ({ question, answers }: { question: IQuestion; answers: FieldValues }) => { const { t } = useTranslation() + + // Add abstain option to choices if needed + const choices = [...question.choices] + if (answers[0].includes('-1')) { + choices[-1] = { + title: { + default: t('cc.vote.abstain'), + }, + value: -1, + } + } + return ( question.choices[Number(a)].title.default) + .map((a: string) => choices[Number(a)].title.default) .map((a: string) => `- ${a}`) .join('
'), }} diff --git a/src/elements/Home/Berga.tsx b/src/elements/Home/Berga.tsx index b922cd8..4e1f856 100644 --- a/src/elements/Home/Berga.tsx +++ b/src/elements/Home/Berga.tsx @@ -51,11 +51,11 @@ const Berga = () => ( Seleccioneu una opció depenent de la teva edat
- + Accedeix a la votació Juvenil 12 - 15 anys - + Accedeix a la votació General +16 anys