From 7d1794d16f2525d83c20696deb9bcfb0850e0a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=92scar=20Casajuana?= Date: Thu, 27 Jun 2024 14:10:33 +0200 Subject: [PATCH] Add logout button for al census types --- src/components/Process/Aside.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/Process/Aside.tsx b/src/components/Process/Aside.tsx index 3ab4dcf..d88c047 100644 --- a/src/components/Process/Aside.tsx +++ b/src/components/Process/Aside.tsx @@ -6,7 +6,7 @@ import { dotobject, ElectionStatus, formatUnits, PublishedElection } from '@vocd import { TFunction } from 'i18next' import { Trans, useTranslation } from 'react-i18next' import { Link as ReactRouterLink } from 'react-router-dom' -import { useAccount } from 'wagmi' +import { useAccount, useDisconnect } from 'wagmi' import { CensusMeta } from './Census/CensusType' const results = (result: number, decimals?: number) => @@ -14,6 +14,7 @@ const results = (result: number, decimals?: number) => const ProcessAside = () => { const { t } = useTranslation() + const { disconnect } = useDisconnect() const { election, connected, @@ -23,7 +24,7 @@ const ProcessAside = () => { loading: { voting }, } = useElection() const { isConnected } = useAccount() - const { env } = useClient() + const { env, clear } = useClient() if (!election || !(election instanceof PublishedElection)) return null @@ -157,7 +158,7 @@ const ProcessAside = () => { )} - {connected && ( + {(connected || isConnected) && ( { mb={{ base: 10, md: 0 }} > + {isConnected && ( + + )} )}