Skip to content

Commit

Permalink
Fix styles
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed Oct 10, 2024
1 parent b0ab79d commit cd4930e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/components/Process/Chained.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Process/MultiElectionConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions src/components/Process/MultiElectionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Check failure on line 7 in src/components/Process/MultiElectionContext.tsx

View workflow job for this annotation

GitHub Actions / build-stg

Module '"@vocdoni/chakra-components"' has no exported member 'getVoteBallot'.

export type MultiElectionFormContextState = {
fmethods: UseFormReturn<any>
Expand Down Expand Up @@ -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))
Expand Down
31 changes: 5 additions & 26 deletions src/components/Process/MultiElectionQuestions.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -14,6 +9,7 @@ import {
DefaultElectionFormId,

Check failure on line 9 in src/components/Process/MultiElectionQuestions.tsx

View workflow job for this annotation

GitHub Actions / build-stg

Module '"@vocdoni/chakra-components"' has no exported member 'DefaultElectionFormId'.
VoteButtonLogic,

Check failure on line 10 in src/components/Process/MultiElectionQuestions.tsx

View workflow job for this annotation

GitHub Actions / build-stg

'"@vocdoni/chakra-components"' has no exported member named 'VoteButtonLogic'. Did you mean 'VoteButton'?
} from '@vocdoni/chakra-components'
import { Flex } from '@chakra-ui/react'

export type MultiElectionQuestionsFormProps = { ConnectButton?: ComponentType } & ElectionQuestionsFormProps

Expand All @@ -39,15 +35,14 @@ export const MultiElectionQuestionsForm = ({

return (
<form onSubmit={fmethods.handleSubmit(voteAll, onInvalid)} id={formId ?? DefaultElectionFormId}>
{/*<ElectionQuestion {...props} />*/}
{renderWith.length > 0 && (
<>
<Flex direction={'column'} gap={10}>
{renderWith.map(({ id }) => (
<ElectionProvider key={id} ConnectButton={ConnectButton} id={id} fetchCensus>
<SubElectionQuestions {...props} />
</ElectionProvider>
))}
</>
</Flex>
)}
</form>
)
Expand Down Expand Up @@ -86,22 +81,6 @@ const SubElectionQuestions = (props: Omit<MultiElectionQuestionsFormProps, 'Conn
return
}
addElection(subElectionState)

// }
// ;(async () => {
// 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 <ElectionQuestion {...props} />
Expand Down
8 changes: 3 additions & 5 deletions src/theme/components/Questions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ const baseStyle = definePartsStyle({
},

wrapper: {
'& > form': {
display: 'flex',
flexDirection: 'column',
gap: 10,
},
display: 'flex',
flexDirection: 'column',
gap: 10,
},

question: {
Expand Down

0 comments on commit cd4930e

Please sign in to comment.