Skip to content

Commit a8c14ba

Browse files
authored
Merge pull request #2871 from IntersectMBO/develop
GovTool - v2.0.10-patch3
2 parents 613885f + 64819a9 commit a8c14ba

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ changes.
1818

1919
- Fix displaying DRep with doNotList property as string
2020
- Handle exception when no index is provided to /proposal/get endpoint [Issue 1841](https://github.com/IntersectMBO/govtool/issues/1841)
21+
- Fix displaying vote pill on voted on cards
2122

2223
### Changed
2324

govtool/frontend/src/components/atoms/VotePill.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@ import { Box, Typography } from "@mui/material";
33

44
import { Vote } from "@models";
55

6-
const borderColorMap = {
6+
const borderColorMap: Record<string, string> = {
77
yes: "#C0E4BA",
88
no: "#EDACAC",
99
abstain: "#99ADDE",
10-
notVoted: "#EAE9F0",
10+
notvoted: "#EAE9F0",
1111
};
1212

13-
const bgColorMap = {
13+
const bgColorMap: Record<string, string> = {
1414
yes: "#F0F9EE",
1515
no: "#FBEBEB",
1616
abstain: "#E6EBF7",
17-
notVoted: "#F5F5F8",
17+
notvoted: "#F5F5F8",
1818
};
1919

20-
const voteLabelKey = {
20+
const voteLabelKey: Record<string, string> = {
2121
yes: "votes.yes",
2222
no: "votes.no",
2323
abstain: "votes.abstain",
24-
notVoted: "votes.notVoted",
24+
notvoted: "votes.notVoted",
2525
};
2626

27-
const ccVoteLabelKey = {
27+
const ccVoteLabelKey: Record<string, string> = {
2828
yes: "votes.constitutional",
2929
no: "votes.unconstitutional",
3030
abstain: "votes.abstain",
31-
notVoted: "",
31+
notvoted: "",
3232
};
3333

3434
type VoteExtended = Vote | "notVoted";
@@ -45,10 +45,11 @@ export const VotePill = ({
4545
isCC?: boolean;
4646
}) => {
4747
const { t } = useTranslation();
48+
const voteKey = vote.toLocaleLowerCase();
4849

49-
const bgColor = bgColorMap[vote];
50-
const borderColor = borderColorMap[vote];
51-
const labelKey = isCC ? ccVoteLabelKey[vote] : voteLabelKey[vote];
50+
const bgColor = bgColorMap[voteKey];
51+
const borderColor = borderColorMap[voteKey];
52+
const labelKey = isCC ? ccVoteLabelKey[voteKey] : voteLabelKey[voteKey];
5253

5354
return (
5455
<Box

0 commit comments

Comments
 (0)