1- import {
2- MultiElectionsProvider ,
3- MultiElectionsProviderProps ,
4- SubElectionState ,
5- useMultiElections ,
6- } from './MultiElectionContext'
1+ import { SubElectionState , useMultiElections } from './MultiElectionContext'
72import { ElectionProvider , useElection } from '@vocdoni/react-providers'
8- import { ComponentType , useEffect , useMemo , useState } from 'react'
3+ import { ComponentType , useEffect , useMemo } from 'react'
94import { PublishedElection } from '@vocdoni/sdk'
105import { ButtonProps } from '@chakra-ui/button'
116import {
@@ -14,6 +9,7 @@ import {
149 DefaultElectionFormId ,
1510 VoteButtonLogic ,
1611} from '@vocdoni/chakra-components'
12+ import { Flex } from '@chakra-ui/react'
1713
1814export type MultiElectionQuestionsFormProps = { ConnectButton ?: ComponentType } & ElectionQuestionsFormProps
1915
@@ -39,15 +35,14 @@ export const MultiElectionQuestionsForm = ({
3935
4036 return (
4137 < form onSubmit = { fmethods . handleSubmit ( voteAll , onInvalid ) } id = { formId ?? DefaultElectionFormId } >
42- { /*<ElectionQuestion {...props} />*/ }
4338 { renderWith . length > 0 && (
44- < >
39+ < Flex direction = { 'column' } gap = { 10 } >
4540 { renderWith . map ( ( { id } ) => (
4641 < ElectionProvider key = { id } ConnectButton = { ConnectButton } id = { id } fetchCensus >
4742 < SubElectionQuestions { ...props } />
4843 </ ElectionProvider >
4944 ) ) }
50- </ >
45+ </ Flex >
5146 ) }
5247 </ form >
5348 )
@@ -86,22 +81,6 @@ const SubElectionQuestions = (props: Omit<MultiElectionQuestionsFormProps, 'Conn
8681 return
8782 }
8883 addElection ( subElectionState )
89-
90- // }
91- // ;(async () => {
92- // if (
93- // election &&
94- // election instanceof PublishedElection
95- // // client?.wallet &&
96- // // typeof client.wallet.getAddress === 'function'
97- // ) {
98- // // Store the election if wallet contain address
99- // // const address = await client.wallet.getAddress()
100- // // if (walletAddress === address && elections[election.id]) return
101- // // setWalletAddress(address)
102- // addElection({ election, vote, isAbleToVote, voted })
103- // }
104- // })()
10584 } , [ subElectionState , elections , election ] )
10685
10786 return < ElectionQuestion { ...props } />
0 commit comments