diff --git a/CHANGELOG.md b/CHANGELOG.md index 848e5b4fc..d53bdc86e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ changes. - Fix displaying DRep with doNotList property as string - Handle exception when no index is provided to /proposal/get endpoint [Issue 1841](https://github.com/IntersectMBO/govtool/issues/1841) +- Fix displaying vote pill on voted on cards ### Changed diff --git a/govtool/frontend/src/components/atoms/VotePill.tsx b/govtool/frontend/src/components/atoms/VotePill.tsx index 8833024d1..44159ca9b 100644 --- a/govtool/frontend/src/components/atoms/VotePill.tsx +++ b/govtool/frontend/src/components/atoms/VotePill.tsx @@ -3,32 +3,32 @@ import { Box, Typography } from "@mui/material"; import { Vote } from "@models"; -const borderColorMap = { +const borderColorMap: Record = { yes: "#C0E4BA", no: "#EDACAC", abstain: "#99ADDE", - notVoted: "#EAE9F0", + notvoted: "#EAE9F0", }; -const bgColorMap = { +const bgColorMap: Record = { yes: "#F0F9EE", no: "#FBEBEB", abstain: "#E6EBF7", - notVoted: "#F5F5F8", + notvoted: "#F5F5F8", }; -const voteLabelKey = { +const voteLabelKey: Record = { yes: "votes.yes", no: "votes.no", abstain: "votes.abstain", - notVoted: "votes.notVoted", + notvoted: "votes.notVoted", }; -const ccVoteLabelKey = { +const ccVoteLabelKey: Record = { yes: "votes.constitutional", no: "votes.unconstitutional", abstain: "votes.abstain", - notVoted: "", + notvoted: "", }; type VoteExtended = Vote | "notVoted"; @@ -45,10 +45,11 @@ export const VotePill = ({ isCC?: boolean; }) => { const { t } = useTranslation(); + const voteKey = vote.toLocaleLowerCase(); - const bgColor = bgColorMap[vote]; - const borderColor = borderColorMap[vote]; - const labelKey = isCC ? ccVoteLabelKey[vote] : voteLabelKey[vote]; + const bgColor = bgColorMap[voteKey]; + const borderColor = borderColorMap[voteKey]; + const labelKey = isCC ? ccVoteLabelKey[voteKey] : voteLabelKey[voteKey]; return (