From 7cc24fd4b720c617febf4b4d74de64c754672223 Mon Sep 17 00:00:00 2001 From: Joanna Dyczka Date: Wed, 11 Sep 2024 10:58:48 +0200 Subject: [PATCH] [#1923] display value of Ada holder voting power --- .../src/components/atoms/StakeRadio.tsx | 21 ++++++++------- .../molecules/AutomatedVotingCard.tsx | 8 +++--- govtool/frontend/src/i18n/locales/en.ts | 26 +++++++++---------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/govtool/frontend/src/components/atoms/StakeRadio.tsx b/govtool/frontend/src/components/atoms/StakeRadio.tsx index c7360ca62..8c7e4c57f 100644 --- a/govtool/frontend/src/components/atoms/StakeRadio.tsx +++ b/govtool/frontend/src/components/atoms/StakeRadio.tsx @@ -2,8 +2,13 @@ import { Dispatch, FC, SetStateAction } from "react"; import { Box, IconButton, Typography } from "@mui/material"; import { ICONS } from "@consts"; -import { useScreenDimension } from "@hooks"; +import { + useGetAdaHolderVotingPowerQuery, + useScreenDimension, + useTranslation, +} from "@hooks"; import { theme } from "@/theme"; +import { correctAdaFormat } from "@/utils"; type StakeRadioProps = { isChecked?: boolean; @@ -18,9 +23,9 @@ export const StakeRadio: FC = ({ ...props }) => { palette: { boxShadow1 }, } = theme; const { isMobile } = useScreenDimension(); - // const { powerIsLoading, votingPower } = - // useGetAdaHolderVotingPowerQuery(stakeKey); - // const { t } = useTranslation(); + const { powerIsLoading, votingPower } = + useGetAdaHolderVotingPowerQuery(stakeKey); + const { t } = useTranslation(); return ( = ({ ...props }) => { /> - {/* TODO uncomment when voting power value s correct */} - {/* + - {t("votingPower")} - : + {t("votingPower")}: {powerIsLoading ? ( @@ -82,7 +85,7 @@ export const StakeRadio: FC = ({ ...props }) => { ₳ {correctAdaFormat(votingPower) ?? 0} )} - */} + ); diff --git a/govtool/frontend/src/components/molecules/AutomatedVotingCard.tsx b/govtool/frontend/src/components/molecules/AutomatedVotingCard.tsx index 855631938..729a02523 100644 --- a/govtool/frontend/src/components/molecules/AutomatedVotingCard.tsx +++ b/govtool/frontend/src/components/molecules/AutomatedVotingCard.tsx @@ -1,4 +1,4 @@ -import { Box } from "@mui/material"; +import { Box, Divider } from "@mui/material"; import { Button, Typography } from "@atoms"; import { primaryBlue } from "@consts"; @@ -20,6 +20,7 @@ export const AutomatedVotingCard = ({ onClickInfo, title, transactionId, + votingPower, }: AutomatedVotingCardProps) => { const { cExplorerBaseUrl } = useAppContext(); const { isMobile, screenWidth } = useScreenDimension(); @@ -83,8 +84,7 @@ export const AutomatedVotingCard = ({ {!inProgress && !isSelected && ( <> - {/* TODO uncomment when voting power value s correct */} - {/* */} + /> {{votingPower}} can be used to vote.", register: "Register", registerDescription: - "Register to Vote on Governance Actions using your own voting power of ₳{{votingPower}}.", + "Register to Vote on Governance Actions using your own Voting Power of ₳{{votingPower}}.", registerTitle: "Become a Direct Voter", reRegister: "Re-register", registration: "Direct Voter Registration", @@ -120,7 +120,7 @@ export const en = { retirementInProgress: "The retirement process is ongoing. This may take several minutes.", wasRegisteredDescription: - "You cannot vote on Governance Actions using your own voting power until you re-register.", + "You cannot vote on Governance Actions using your own Voting Power of ₳{{votingPower}} until you re-register.", youAreDirectVoterTitle: "You are a Direct Voter", }, delegation: { @@ -129,18 +129,18 @@ export const en = { noDelegationDescription: "Find a DRep to vote on your behalf.", noDelegationActionButton: "View DRep Directory", dRepDelegationTitle: - "Your Voting Power is delegated to:", + "Your Voting Power of ₳{{ada}}\nis Delegated to:", noConfidenceDelegationTitle: - "You have delegated your voting power to “No Confidence”", + "You have delegated your Voting Power ₳{{ada}}\nto “No Confidence”", abstainDelegationTitle: - "You have delegated your voting power to “Abstain”", + "You have delegated your Voting Power ₳{{ada}}\nto “Abstain”", abstainDescription: "You have selected to apply your Voting Power to Abstain on every vote.", noDescription: "You have selected to apply your Voting Power to No Confidence on every vote.", inProgress: { title: "Delegation", - dRep: "Your voting power is being delegated to:", + dRep: "Your Voting Power of ₳{{ada}} is being delegated to:", abstain: "You have selected to apply your Voting Power to Abstain on every vote.", no: "You have selected to apply your Voting Power to No Confidence on every vote.", @@ -254,9 +254,9 @@ export const en = { abstainCardDefaultTitle: "Abstain from Every Vote", automatedVotingOptions: "Automated Voting Options", editBtn: "Edit DRep data", - delegatedToAbstainTitle: "You have delegated your voting power to “Abstain”", + delegatedToAbstainTitle: "You have delegated ₳{{ada}} to “Abstain”", delegatedToNoConfidenceTitle: - "You have delegated your voting power to “No Confidence”", + "You have delegated ₳{{ada}} to “No Confidence”", delegatedToAbstainDescription: "You have selected to apply your Voting Power to Abstain on every vote.", delegatedToNoConfidenceDescription: @@ -266,10 +266,10 @@ export const en = { filterTitle: "DRep Status", goToDRepDirectory: "Go to DRep Directory", meAsDRep: "This DRep ID is connected to your wallet", - myDelegation: "You have delegated your voting power to:", + myDelegation: "You have delegated ₳ {{ada}} to:", myDelegationToYourself: - "You have delegated your voting power to yourself:", - myDRep: "You have delegated your voting power to this DRep.", + "You have delegated ₳ {{ada}} to yourself:", + myDRep: "You have delegated ₳{{ada}} to this DRep.", listTitle: "Find a DRep", noConfidenceDefaultDescription: "Select this to signal no confidence in the current constitutional committee by voting NO on every proposal and voting YES to no confidence proposals", @@ -742,7 +742,7 @@ export const en = { "Looks like you cannot retire, because currently you are not a Direct Voter.", }, registerDescription: - "A Direct Voter is someone that can vote on any Governance Action with their own Voting Power, which is equal to the balance of Ada in their connected wallet. <0>Learn More about Direct Voter.\n\nBecoming a Direct Voter will require a refundable deposit equal to your voting power.\n\nYour deposit will be refunded if you either retire or delegate your voting power to someone else (a DRep)", + "A Direct Voter is someone that can vote on any Governance Action with their own Voting Power, which is equal to the balance of Ada in their connected wallet. <0>Learn More about Direct Voter.\n\nBecoming a Direct Voter will require a refundable deposit of ₳{{deposit}}.\n\nYour deposit will be refunded if you either retire or delegate your voting power to someone else (a DRep)", registerHeading: "What this Means", retirementDescription: "By Retiring you are giving up your Voting Power. You will not be able to vote on any Governance Actions. Your deposit of {{deposit}} ada will be refunded.\n\nYou can at any time in the future re-register to become a Direct Voter, or you can delegate your Voting Power to someone else, or become a DRep.\n\nThese options are listed in our Guides here: <0>Voting options and Roles",