Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GovTool - v2.0.10-patch3 #2871

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading