diff --git a/src/components/Process/Chained.tsx b/src/components/Process/Chained.tsx index c648346..5432ebe 100644 --- a/src/components/Process/Chained.tsx +++ b/src/components/Process/Chained.tsx @@ -9,7 +9,7 @@ import { VoteButton } from '~components/Process/Aside' import BlindCSPConnect from '~components/Process/BlindCSPConnect' import { ChainedProvider, useChainedProcesses } from './ChainedContext' import { ConfirmVoteModal } from './ConfirmVoteModal' -import { MultiElectionQuestionsForm, MultiElectionVoteButton } from '~components/Process/MultiElectionQuestions' +import { MultiElectionQuestionsForm } from '~components/Process/MultiElectionQuestions' import { MultiElectionsProvider } from '~components/Process/MultiElectionContext' type ChainedProcessesInnerProps = { diff --git a/src/components/Process/MultiElectionConfirmation.tsx b/src/components/Process/MultiElectionConfirmation.tsx index cc67480..3e2f790 100644 --- a/src/components/Process/MultiElectionConfirmation.tsx +++ b/src/components/Process/MultiElectionConfirmation.tsx @@ -3,7 +3,7 @@ import { Box, Text } from '@chakra-ui/layout' import { ModalBody, ModalCloseButton, ModalFooter, ModalHeader } from '@chakra-ui/modal' import { chakra, omitThemingProps, useMultiStyleConfig } from '@chakra-ui/system' import { useClient } from '@vocdoni/react-providers' -import { ElectionResultsTypeNames, PublishedElection } from '@vocdoni/sdk' +import { ElectionResultsTypeNames } from '@vocdoni/sdk' import { FieldValues } from 'react-hook-form' import { useConfirm } from '@vocdoni/chakra-components' import { ElectionStateStorage } from '~components/Process/MultiElectionContext' diff --git a/src/components/Process/MultiElectionContext.tsx b/src/components/Process/MultiElectionContext.tsx index de638ac..11f57b7 100644 --- a/src/components/Process/MultiElectionContext.tsx +++ b/src/components/Process/MultiElectionContext.tsx @@ -4,7 +4,7 @@ import { PublishedElection, VocdoniSDKClient } from '@vocdoni/sdk' import { Wallet } from '@ethersproject/wallet' import { useElection, ElectionState } from '@vocdoni/react-providers' import { MultiElectionConfirmation } from './MultiElectionConfirmation' -import { useConfirm, getVotePackage } from '@vocdoni/chakra-components' +import { useConfirm, getVoteBallot } from '@vocdoni/chakra-components' export type MultiElectionFormContextState = { fmethods: UseFormReturn @@ -80,7 +80,7 @@ const useMultiElectionsProvider = ({ const votingList = Object.entries(electionsStates).map(([key, { election, vote }]) => { if (!(election instanceof PublishedElection) || !values[election.id]) return Promise.resolve() - const votePackage = getVotePackage(election, values[election.id]) + const votePackage = getVoteBallot(election, values[election.id]) return vote(votePackage) }) return Promise.all(votingList).finally(() => setVoting(false)) diff --git a/src/components/Process/MultiElectionQuestions.tsx b/src/components/Process/MultiElectionQuestions.tsx index 0424e7d..d398438 100644 --- a/src/components/Process/MultiElectionQuestions.tsx +++ b/src/components/Process/MultiElectionQuestions.tsx @@ -1,11 +1,6 @@ -import { - MultiElectionsProvider, - MultiElectionsProviderProps, - SubElectionState, - useMultiElections, -} from './MultiElectionContext' +import { SubElectionState, useMultiElections } from './MultiElectionContext' import { ElectionProvider, useElection } from '@vocdoni/react-providers' -import { ComponentType, useEffect, useMemo, useState } from 'react' +import { ComponentType, useEffect, useMemo } from 'react' import { PublishedElection } from '@vocdoni/sdk' import { ButtonProps } from '@chakra-ui/button' import { @@ -14,6 +9,7 @@ import { DefaultElectionFormId, VoteButtonLogic, } from '@vocdoni/chakra-components' +import { Flex } from '@chakra-ui/react' export type MultiElectionQuestionsFormProps = { ConnectButton?: ComponentType } & ElectionQuestionsFormProps @@ -35,19 +31,18 @@ export const MultiElectionQuestionsForm = ({ ConnectButton, ...props }: MultiElectionQuestionsFormProps) => { - const { voteAll, fmethods, renderWith, elections, addElection } = useMultiElections() + const { voteAll, fmethods, renderWith } = useMultiElections() return (
- {/**/} {renderWith.length > 0 && ( - <> + {renderWith.map(({ id }) => ( ))} - + )} ) @@ -86,22 +81,6 @@ const SubElectionQuestions = (props: Omit { - // if ( - // election && - // election instanceof PublishedElection - // // client?.wallet && - // // typeof client.wallet.getAddress === 'function' - // ) { - // // Store the election if wallet contain address - // // const address = await client.wallet.getAddress() - // // if (walletAddress === address && elections[election.id]) return - // // setWalletAddress(address) - // addElection({ election, vote, isAbleToVote, voted }) - // } - // })() }, [subElectionState, elections, election]) return diff --git a/src/theme/components/Questions.ts b/src/theme/components/Questions.ts index b66e077..e120355 100644 --- a/src/theme/components/Questions.ts +++ b/src/theme/components/Questions.ts @@ -62,11 +62,9 @@ const baseStyle = definePartsStyle({ }, wrapper: { - '& > form': { - display: 'flex', - flexDirection: 'column', - gap: 10, - }, + display: 'flex', + flexDirection: 'column', + gap: 10, }, question: {