Skip to content

Commit f69d253

Browse files
authored
Merge pull request #3085 from IntersectMBO/feat/3082-voting-power-on-the-direct-voter-card-and-drep-details-page-adjustments
feat(#3072): remove own voting power from cards and drep details
2 parents 62b9f36 + d1cc0de commit f69d253

File tree

7 files changed

+797
-359
lines changed

7 files changed

+797
-359
lines changed

govtool/frontend/package-lock.json

Lines changed: 787 additions & 291 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

govtool/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"blakejs": "^1.2.1",
4242
"buffer": "^6.0.3",
4343
"date-fns": "^2.30.0",
44-
"esbuild": "^0.24.0",
44+
"esbuild": "^0.25.0",
4545
"i18next": "^23.7.19",
4646
"jsonld": "^8.3.2",
4747
"katex": "^0.16.21",

govtool/frontend/src/components/organisms/DRepDetailsCardHeader.tsx

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
import { useNavigate } from "react-router-dom";
2-
import { Trans } from "react-i18next";
3-
import { Box, Chip } from "@mui/material";
2+
import { Box } from "@mui/material";
43

54
import { Button } from "@atoms";
65
import { ICONS, PATHS } from "@consts";
7-
import { useCardano } from "@context";
8-
import {
9-
useGetAdaHolderVotingPowerQuery,
10-
useScreenDimension,
11-
useTranslation,
12-
} from "@hooks";
6+
import { useScreenDimension, useTranslation } from "@hooks";
137
import { DataMissingHeader } from "@molecules";
14-
import { correctVoteAdaFormat } from "@utils";
158
import { DRepData } from "@/models";
169

1710
type DRepDetailsProps = {
@@ -25,12 +18,9 @@ export const DRepDetailsCardHeader = ({
2518
isMe,
2619
isMyDrep,
2720
}: DRepDetailsProps) => {
28-
const { stakeKey } = useCardano();
2921
const { t } = useTranslation();
3022
const navigate = useNavigate();
3123
const { screenWidth } = useScreenDimension();
32-
const { votingPower: myVotingPower } =
33-
useGetAdaHolderVotingPowerQuery(stakeKey);
3424

3525
const { givenName, metadataStatus, image } = dRepData;
3626

@@ -48,45 +38,14 @@ export const DRepDetailsCardHeader = ({
4838
alignSelf: "stretch",
4939
display: "flex",
5040
alignItems: "center",
51-
justifyContent: "space-between",
41+
justifyContent: "flex-end",
5242
mb: "18px",
5343
...(screenWidth <= 1020 && {
5444
flexDirection: "column",
5545
gap: 3,
5646
}),
5747
}}
5848
>
59-
<Chip
60-
color="primary"
61-
label={
62-
<Trans
63-
i18nKey={
64-
isMe
65-
? isMyDrep
66-
? "dRepDirectory.myDelegationToYourself"
67-
: "dRepDirectory.meAsDRep"
68-
: "dRepDirectory.myDRep"
69-
}
70-
values={{
71-
ada: correctVoteAdaFormat(myVotingPower),
72-
}}
73-
/>
74-
}
75-
sx={{
76-
boxShadow: (theme) => theme.shadows[2],
77-
color: (theme) => theme.palette.text.primary,
78-
px: 3,
79-
py: 0.5,
80-
...(isMyDrep &&
81-
!isMe && {
82-
width: "100%",
83-
}),
84-
...(screenWidth <= 1020 && {
85-
width: "100%",
86-
}),
87-
}}
88-
/>
89-
9049
{isMe && (
9150
<Box
9251
sx={{

govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,7 @@ export const DRepDashboardCard = ({
138138
return {
139139
buttons: wasRegisteredOrNotRegisteredButtons,
140140
description: voter?.givenName ? (
141-
<Trans
142-
i18nKey="dashboard.cards.drep.notRegisteredWasRegisteredDescriptionWithGivenName"
143-
values={{ givenName: voter?.givenName ?? "DRep" }}
144-
/>
141+
<Trans i18nKey="dashboard.cards.drep.notRegisteredWasRegisteredDescriptionWithGivenName" />
145142
) : (
146143
<Trans i18nKey="dashboard.cards.drep.notRegisteredWasRegisteredDescription" />
147144
),

govtool/frontend/src/components/organisms/DashboardCards/DirectVoterDashboardCard.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ export const DirectVoterDashboardCard = ({
9898
},
9999
],
100100
description: (
101-
<Trans
102-
i18nKey="dashboard.cards.directVoter.wasRegisteredDescription"
103-
values={{ votingPower: ada }}
104-
/>
101+
<Trans i18nKey="dashboard.cards.directVoter.wasRegisteredDescription" />
105102
),
106103
transactionId: voter?.soleVoterRetireTxHash,
107104
title: t("dashboard.cards.directVoter.wasDirectVoterTitle"),
@@ -120,10 +117,7 @@ export const DirectVoterDashboardCard = ({
120117
learnMoreButton,
121118
],
122119
description: (
123-
<Trans
124-
i18nKey="dashboard.cards.directVoter.registerDescription"
125-
values={{ votingPower: ada }}
126-
/>
120+
<Trans i18nKey="dashboard.cards.directVoter.registerDescription" />
127121
),
128122
title: t("dashboard.cards.directVoter.registerTitle"),
129123
};

govtool/frontend/src/i18n/locales/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"directVoter": {
9191
"isRegisteredDescription": "Your Voting Power of ₳<strong>{{votingPower}}</strong> can be used to vote.",
9292
"register": "Register",
93-
"registerDescription": "Register to Vote on Governance Actions using your own Voting Power of ₳<strong>{{votingPower}}</strong>.",
93+
"registerDescription": "Register to Vote on Governance Actions.",
9494
"registerTitle": "Become a Direct Voter",
9595
"reRegister": "Re-register",
9696
"registration": "Direct Voter Registration",
@@ -99,7 +99,7 @@
9999
"wasDirectVoterTitle": "You Have Retired as a Direct Voter",
100100
"retirement": "Direct Voter Retirement",
101101
"retirementInProgress": "The retirement process is ongoing. This may take several minutes.",
102-
"wasRegisteredDescription": "You cannot vote on Governance Actions using your own Voting Power of ₳<strong>{{votingPower}}</strong> until you re-register.",
102+
"wasRegisteredDescription": "You cannot vote on Governance Actions until you re-register.",
103103
"youAreDirectVoterTitle": "You are a Direct Voter"
104104
},
105105
"delegation": {

govtool/frontend/src/pages/RegisterAsDirectVoter.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,12 @@ import {
1313
useWalletErrorModal,
1414
} from "@hooks";
1515
import { CenteredBoxBottomButtons, CenteredBoxPageWrapper } from "@molecules";
16-
import {
17-
PROTOCOL_PARAMS_KEY,
18-
checkIsWalletConnected,
19-
correctVoteAdaFormat,
20-
getItemFromLocalStorage,
21-
openInNewTab,
22-
} from "@utils";
16+
import { checkIsWalletConnected, openInNewTab } from "@utils";
2317
import { WrongRouteInfo } from "@organisms";
2418
import { CertificatesBuilder } from "@emurgo/cardano-serialization-lib-asmjs";
2519

2620
export const RegisterAsDirectVoter = () => {
2721
const { cExplorerBaseUrl } = useAppContext();
28-
const epochParams = getItemFromLocalStorage(PROTOCOL_PARAMS_KEY);
2922
const navigate = useNavigate();
3023
const [isLoading, setIsLoading] = useState(false);
3124
const { t } = useTranslation();
@@ -144,7 +137,6 @@ export const RegisterAsDirectVoter = () => {
144137
>
145138
<Trans
146139
i18nKey="directVoter.registerDescription"
147-
values={{ deposit: correctVoteAdaFormat(epochParams?.drep_deposit) }}
148140
components={[
149141
<Link
150142
onClick={() =>

0 commit comments

Comments
 (0)