From d6fe05837ea5e38e00a0e091c0d9e56020456c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Tue, 27 Feb 2024 10:41:26 +0100 Subject: [PATCH] [#119] Make voting on governance actions possible --- .../src/components/organisms/BgCard.tsx | 2 +- .../DashboardGovernanceActionDetails.tsx | 2 +- .../organisms/DashboardGovernanceActions.tsx | 2 +- .../components/organisms/DashboardTopNav.tsx | 5 ++- .../organisms/DelegateTodRepStepOne.tsx | 42 ++++++++++--------- .../organisms/RegisterAsdRepStepTwo.tsx | 4 +- govtool/frontend/src/i18n/locales/en.ts | 1 + 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/govtool/frontend/src/components/organisms/BgCard.tsx b/govtool/frontend/src/components/organisms/BgCard.tsx index 98f537eee..94c7b9ee8 100644 --- a/govtool/frontend/src/components/organisms/BgCard.tsx +++ b/govtool/frontend/src/components/organisms/BgCard.tsx @@ -61,7 +61,7 @@ export const BgCard = ({ {actionButtonLabel} ); - }, [isLoadingActionButton, isMobile]); + }, [isLoadingActionButton, isMobile, actionButtonLabel]); return ( { ? formatDisplayDate(state.expiryDate) : formatDisplayDate(data.proposal.expiryDate) } - isDRep={voter?.isRegisteredAsDRep} + isDRep={voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter} noVotes={state ? state.noVotes : data.proposal.noVotes} type={ state diff --git a/govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx b/govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx index a8d769f06..c8b18afb6 100644 --- a/govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx +++ b/govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx @@ -121,7 +121,7 @@ export const DashboardGovernanceActions = () => { sortingActive={Boolean(chosenSorting)} sortOpen={sortOpen} /> - {voter?.isRegisteredAsDRep && ( + {(voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter) && ( - {voter?.isRegisteredAsDRep && } + {(voter?.isRegisteredAsDRep || + voter?.isRegisteredAsSoleVoter) && } diff --git a/govtool/frontend/src/components/organisms/DelegateTodRepStepOne.tsx b/govtool/frontend/src/components/organisms/DelegateTodRepStepOne.tsx index f46a454c1..3f38f8ba8 100644 --- a/govtool/frontend/src/components/organisms/DelegateTodRepStepOne.tsx +++ b/govtool/frontend/src/components/organisms/DelegateTodRepStepOne.tsx @@ -134,6 +134,7 @@ export const DelegateTodRepStepOne = ({ setStep }: DelegateProps) => { chosenOption, delegate, voter?.isRegisteredAsDRep, + voter?.isRegisteredAsSoleVoter, dRepID, isDelegationLoading, isMobile, @@ -177,9 +178,9 @@ export const DelegateTodRepStepOne = ({ setStep }: DelegateProps) => { @@ -211,24 +212,27 @@ export const DelegateTodRepStepOne = ({ setStep }: DelegateProps) => { - {voter?.isRegisteredAsDRep && currentDelegation !== dRepID && ( - - - - )} + {(voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter) && + currentDelegation !== dRepID && ( + + + + )} { const { t } = useTranslation(); const { isMobile } = useScreenDimension(); - const { control, errors } = useRegisterAsdRepFormContext(); + const { showSubmitButton, control, errors } = useRegisterAsdRepFormContext(); const onClickContinue = useCallback(() => setStep(3), []); @@ -26,7 +26,7 @@ export const RegisterAsdRepStepTwo = ({ setStep }: Props) => { return ( diff --git a/govtool/frontend/src/i18n/locales/en.ts b/govtool/frontend/src/i18n/locales/en.ts index e3ec7bdea..edf57f75d 100644 --- a/govtool/frontend/src/i18n/locales/en.ts +++ b/govtool/frontend/src/i18n/locales/en.ts @@ -431,6 +431,7 @@ export const en = { ok: "Ok", select: "Select", seeTransaction: "See transaction", + submit: "Submit", skip: "Skip", sortBy: "Sort by", thisLink: "this link",