Skip to content

Commit

Permalink
Merge pull request #2871 from IntersectMBO/develop
Browse files Browse the repository at this point in the history
GovTool - v2.0.10-patch3
  • Loading branch information
MSzalowski authored Jan 31, 2025
2 parents 613885f + 64819a9 commit a8c14ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 12 additions & 11 deletions govtool/frontend/src/components/atoms/VotePill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ import { Box, Typography } from "@mui/material";

import { Vote } from "@models";

const borderColorMap = {
const borderColorMap: Record<string, string> = {
yes: "#C0E4BA",
no: "#EDACAC",
abstain: "#99ADDE",
notVoted: "#EAE9F0",
notvoted: "#EAE9F0",
};

const bgColorMap = {
const bgColorMap: Record<string, string> = {
yes: "#F0F9EE",
no: "#FBEBEB",
abstain: "#E6EBF7",
notVoted: "#F5F5F8",
notvoted: "#F5F5F8",
};

const voteLabelKey = {
const voteLabelKey: Record<string, string> = {
yes: "votes.yes",
no: "votes.no",
abstain: "votes.abstain",
notVoted: "votes.notVoted",
notvoted: "votes.notVoted",
};

const ccVoteLabelKey = {
const ccVoteLabelKey: Record<string, string> = {
yes: "votes.constitutional",
no: "votes.unconstitutional",
abstain: "votes.abstain",
notVoted: "",
notvoted: "",
};

type VoteExtended = Vote | "notVoted";
Expand All @@ -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 (
<Box
Expand Down

0 comments on commit a8c14ba

Please sign in to comment.