From 0df7814644a018fd236fa8cadd5b6b101383cdbf Mon Sep 17 00:00:00 2001 From: Joanna Dyczka Date: Tue, 24 Sep 2024 09:42:29 +0200 Subject: [PATCH] [#1875] add missing testIds for submitted votes --- CHANGELOG.md | 2 +- .../components/molecules/VotesSubmitted.tsx | 165 +++++++++--------- 2 files changed, 86 insertions(+), 81 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff7f94c7..fc59866f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ changes. ### Fixed -- +- Add missing testIds for submitted votes [Issue 1875](https://github.com/IntersectMBO/govtool/issues/1875) ### Changed diff --git a/govtool/frontend/src/components/molecules/VotesSubmitted.tsx b/govtool/frontend/src/components/molecules/VotesSubmitted.tsx index 8edd3121..e78d8de3 100644 --- a/govtool/frontend/src/components/molecules/VotesSubmitted.tsx +++ b/govtool/frontend/src/components/molecules/VotesSubmitted.tsx @@ -1,7 +1,7 @@ -import { Box, Typography } from "@mui/material"; +import { Box } from "@mui/material"; import { IMAGES } from "@consts"; -import { VotePill } from "@atoms"; +import { Typography, VotePill } from "@atoms"; import { useTranslation } from "@hooks"; import { correctAdaFormat } from "@utils"; import { SubmittedVotesData } from "@models"; @@ -10,27 +10,6 @@ type Props = { votes: SubmittedVotesData; }; -const Vote = ({ - vote, - value, -}: { - vote: "yes" | "no" | "abstain"; - value: string | number; -}) => ( - - - - {value} - - -); - export const VotesSubmitted = ({ votes: { dRepYesVotes, @@ -83,67 +62,93 @@ export const VotesSubmitted = ({ sx={{ display: "flex", flexDirection: "column", - gap: "12px", + gap: 4.5, }} > - - {t("govActions.dReps")} - - - + + - - - - {t("govActions.sPos")} - - - - - - - {t("govActions.ccCommittee")} - - - - - - ); }; + +type VotesGroupProps = { + type: "ccCommittee" | "dReps" | "sPos"; + yesVotes: number; + noVotes: number; + abstainVotes: number; +}; + +const VotesGroup = ({ + type, + yesVotes, + noVotes, + abstainVotes, +}: VotesGroupProps) => { + const { t } = useTranslation(); + return ( + + + {t(`govActions.${type}`)} + + + + + + ); +}; + +type VoteProps = { + type: "ccCommittee" | "dReps" | "sPos"; + vote: "yes" | "no" | "abstain"; + value: number; +}; +const Vote = ({ type, vote, value }: VoteProps) => ( + + + + {type === "dReps" ? `₳ ${correctAdaFormat(value)}` : value} + + +);