Skip to content

Commit

Permalink
Fix show connect button for blind csp
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed Jun 27, 2024
1 parent 7d56e46 commit e2c5bfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/components/Process/Aside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { TFunction } from 'i18next'
import { Trans, useTranslation } from 'react-i18next'
import { Link as ReactRouterLink } from 'react-router-dom'
import { useAccount } from 'wagmi'
import BlindCSPConnect from './BlindCSPConnect'
import { CensusMeta } from './Census/CensusType'

const results = (result: number, decimals?: number) =>
Expand Down Expand Up @@ -217,7 +216,6 @@ export const VoteButton = ({ ...props }: FlexProps) => {
px={{ base: 3, lg2: 0 }}
{...props}
>
{isBlindCsp && !connected && <BlindCSPConnect />}
{census?.type !== 'spreadsheet' && !isBlindCsp && !connected && (
<ConnectButton.Custom>
{({ account, chain, openConnectModal, authenticationStatus, mounted }) => {
Expand Down
4 changes: 4 additions & 0 deletions src/components/Process/Chained.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Trans } from 'react-i18next'
import { VoteButton } from './Aside'
import { ChainedProvider, useChainedProcesses } from './ChainedContext'
import { ConfirmVoteModal } from './ConfirmVoteModal'
import BlindCSPConnect from '~components/Process/BlindCSPConnect'

type ChainedProcessesInnerProps = {
connected: boolean
Expand Down Expand Up @@ -113,12 +114,15 @@ const ChainedProcessesWrapper = () => {
return <Progress w='full' size='xs' isIndeterminate />
}

const isBlindCsp = election.get('census.type') === 'csp' && election?.meta.csp?.service === 'vocdoni-blind-csp'

return (
<>
<ElectionProvider key={current} election={processes[current]} ConnectButton={ConnectButton} fetchCensus>
<ChainedProcessesInner connected={connected} />
</ElectionProvider>
{!connected && election.get('census.type') === 'spreadsheet' && <SpreadsheetAccess />}
{isBlindCsp && !connected && <BlindCSPConnect />}
</>
)
}
Expand Down

0 comments on commit e2c5bfa

Please sign in to comment.