diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c094e85f..a181f9b9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,7 @@ As a minor extension, we also keep a semantic version for the `UNRELEASED` changes. ## [Unreleased] -- Add retire as Sole Voter screen [Issue 198](https://github.com/IntersectMBO/govtool/issues/198) -- Add Sole Voter card [Issue 141](https://github.com/IntersectMBO/govtool/issues/141) +- Add possibility to vote on behalf of myself - Sole Voter [Issue 119](https://github.com/IntersectMBO/govtool/issues/119) - Create DRep registration page about roles [Issue 205](https://github.com/IntersectMBO/govtool/issues/205) - Create Checkbox component. Improve Field and ControlledField [Issue 177](https://github.com/IntersectMBO/govtool/pull/177) - Vitest unit tests added for utils functions [Issue 81](https://github.com/IntersectMBO/govtool/issues/81) diff --git a/govtool/frontend/src/components/organisms/DashboardCards.tsx b/govtool/frontend/src/components/organisms/DashboardCards.tsx index b7ad772d0..34018f07a 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards.tsx @@ -456,7 +456,7 @@ export const DashboardCards = () => { title={soleVoterCardTitle} inProgress={!!soleVoterTransaction?.transactionHash} dataTestidFirstButton={ - user?.isRegisteredAsSoleVoter + voter?.isRegisteredAsSoleVoter ? "retire-as-sole-voter-button" : "register-as-sole-voter-button" } @@ -495,9 +495,7 @@ export const DashboardCards = () => { "https://docs.sanchogov.tools/faqs/what-does-it-mean-to-register-as-a-drep" ) } - secondButtonLabel={t("learnMore")} secondButtonVariant={"outlined"} - dataTestidSecondButton="learn-more-button" imageURL={IMAGES.soleVoterImage} /> {/* REGISTARTION AS SOLE VOTER CARD END*/} diff --git a/govtool/frontend/src/context/wallet.tsx b/govtool/frontend/src/context/wallet.tsx index 26e5244c4..1b29b1d5d 100644 --- a/govtool/frontend/src/context/wallet.tsx +++ b/govtool/frontend/src/context/wallet.tsx @@ -170,6 +170,7 @@ CardanoContext.displayName = "CardanoContext"; function CardanoProvider(props: Props) { const [isEnabled, setIsEnabled] = useState(false); + const [isEnableLoading, setIsEnableLoading] = useState(null); const [voter, setVoter] = useState(undefined); const [walletApi, setWalletApi] = useState( undefined @@ -1251,8 +1252,6 @@ function CardanoProvider(props: Props) { isDrepLoading, setIsDrepLoading, isEnableLoading, - soleVoter, - setSoleVoter, }), [ address, @@ -1287,8 +1286,6 @@ function CardanoProvider(props: Props) { isDrepLoading, setIsDrepLoading, isEnableLoading, - soleVoter, - setSoleVoter, ] ); diff --git a/govtool/frontend/src/hooks/queries/useGetDRepVotingPowerQuery.ts b/govtool/frontend/src/hooks/queries/useGetDRepVotingPowerQuery.ts index 836946aa9..4accd00fb 100644 --- a/govtool/frontend/src/hooks/queries/useGetDRepVotingPowerQuery.ts +++ b/govtool/frontend/src/hooks/queries/useGetDRepVotingPowerQuery.ts @@ -5,14 +5,21 @@ import { useCardano } from "@context"; import { getDRepVotingPower } from "@services"; export const useGetDRepVotingPowerQuery = () => { - const { dRepID, dRep } = useCardano(); + const { dRepID, voter } = useCardano(); const { data, isLoading } = useQuery({ - queryKey: [QUERY_KEYS.useGetDRepVotingPowerKey, dRepID, dRep?.isRegistered], + queryKey: [ + QUERY_KEYS.useGetDRepVotingPowerKey, + dRepID, + voter?.isRegisteredAsDRep, + voter?.isRegisteredAsSoleVoter, + ], queryFn: async () => { return await getDRepVotingPower({ dRepID }); }, - enabled: !!dRepID && !!dRep?.isRegistered, + enabled: + !!dRepID && + (!!voter?.isRegisteredAsDRep || !!voter?.isRegisteredAsSoleVoter), }); return { dRepVotingPower: data, isDRepVotingPowerLoading: isLoading };