Skip to content

Commit

Permalink
feat: MET-1963 resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Sotatek-TaiTruong committed Apr 1, 2024
2 parents ba906d3 + ba83ce0 commit 841b723
Show file tree
Hide file tree
Showing 7 changed files with 297 additions and 172 deletions.
366 changes: 218 additions & 148 deletions src/components/GovernanceVotes/index.tsx

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions src/components/GovernanceVotes/styles.ts
@@ -0,0 +1,16 @@
import { Typography, styled } from "@mui/material";

export const HashName = styled(Typography)(({ theme }) => ({
paddingBottom: "15px",
fontSize: "32px",
fontWeight: 600,
lineHeight: "28px",
textAlign: "center",
color: theme.isDark ? theme.palette.secondary.main : theme.palette.secondary.light,
[theme.breakpoints.down("lg")]: {
fontSize: "24px"
},
[theme.breakpoints.down("sm")]: {
fontSize: "16px"
}
}));
26 changes: 10 additions & 16 deletions src/components/commons/CardGovernanceVotes/index.tsx
Expand Up @@ -3,12 +3,12 @@ import { Box, Stack, Tooltip, Typography, useTheme } from "@mui/material";
import { useTranslation } from "react-i18next";
import { t } from "i18next";

import { VotesAbstainIcon, VotesNoIcon, VotesNoneIcon, VotesYesIcon, repeatVoteIcon } from "src/commons/resources";
import { VotesAbstainIcon, VotesNoIcon, VotesNoneIcon, VotesYesIcon, RepeatVotesIcon } from "src/commons/resources";
import { ChipContainer } from "src/pages/NativeScriptsAndSC/Card";
import { POOLS_ACTION_TYPE, STATUS_VOTE } from "src/commons/utils/constants";
import { GovernanceVote } from "src/components/GovernanceVotes";

import { CardGovernanceVote, StatusContainer } from "./styles";
import { CardGovernanceVote, StatusContainer, TitleCard } from "./styles";

interface ICardGovernanceVotes {
data: GovernanceVote;
Expand Down Expand Up @@ -36,23 +36,17 @@ const CardGovernanceVotes: React.FC<ICardGovernanceVotes> = ({ data }) => {
<Box display="flex" justifyContent="space-between" width="100%">
<Box maxWidth="400px" flex={1}>
<Tooltip title={txHash} placement="top" arrow>
<Typography
sx={{ wordBreak: "break-word" }}
fontWeight={600}
fontSize="24px"
lineHeight="28px"
color={theme.isDark ? theme.palette.secondary.main : theme.palette.secondary.main}
>
<TitleCard>
{actionTypeListDrep.find((action) => action.value === type)?.text} #{index}
</Typography>
</TitleCard>
</Tooltip>
</Box>
<>
<VoteStatus status={vote} isRepeatVote={isRepeatVote} />
</>
</Box>
<Stack paddingTop="24px" spacing={"14px"}>
<Box display="flex" alignItems="center">
<Box display="flex" alignItems="center" flexWrap={"wrap"}>
<Typography
fontWeight={600}
fontSize="16px"
Expand All @@ -66,7 +60,7 @@ const CardGovernanceVotes: React.FC<ICardGovernanceVotes> = ({ data }) => {
{actionTypeListDrep.find((action) => action.value === type)?.text}
</Typography>
</Box>
<Box display="flex" alignItems="center">
<Box display="flex" alignItems="center" flexWrap="wrap">
<Typography
fontWeight={600}
fontSize="16px"
Expand All @@ -78,7 +72,7 @@ const CardGovernanceVotes: React.FC<ICardGovernanceVotes> = ({ data }) => {
</Typography>
<GovernanceStatus status={status} />
</Box>
<Box display="flex" alignItems="center">
<Box display="flex" alignItems="center" flexWrap="wrap">
<Typography
fontWeight={600}
fontSize="16px"
Expand Down Expand Up @@ -106,7 +100,7 @@ export const VoteStatus: React.FC<{ status: string; isRepeatVote?: boolean }> =
switch (key) {
case STATUS_VOTE.YES:
if (isRepeatVote) {
return [repeatVoteIcon, "success"];
return [RepeatVotesIcon, "success"];
} else {
return [VotesYesIcon, "success"];
}
Expand Down Expand Up @@ -143,7 +137,7 @@ export const GovernanceStatus: React.FC<{ status: string | null }> = ({ status }
switch (key) {
case STATUS_VOTE.RATIFIED:
return "success";
case STATUS_VOTE.OPEN:
case STATUS_VOTE.OPEN_BALLOT:
return "warning";
case STATUS_VOTE.ENACTED:
return "info";
Expand All @@ -166,7 +160,7 @@ export const GovernanceStatus: React.FC<{ status: string | null }> = ({ status }
lineHeight="23px"
color={theme.palette.secondary.light}
>
{status === STATUS_VOTE.OPEN ? "Open Ballot" : !status ? t("common.N/A") : status}
{status === STATUS_VOTE.OPEN_BALLOT ? t("pool.open") : !status ? t("common.N/A") : status}
</Typography>
}
variant={typeStatus as "success" | "warning" | "info" | "error"}
Expand Down
16 changes: 15 additions & 1 deletion src/components/commons/CardGovernanceVotes/styles.ts
@@ -1,4 +1,4 @@
import { Box, styled } from "@mui/material";
import { Box, Typography, styled } from "@mui/material";

import Card from "../Card";

Expand All @@ -20,3 +20,17 @@ export const StatusContainer = styled(Box)`
border-radius: 20px;
}
`;

export const TitleCard = styled(Typography)(({ theme }) => ({
paddingRight: "3px",
wordBreak: "break-word",
fontWeight: 600,
lineHeight: "28px",
color: theme.isDark ? theme.palette.secondary.main : theme.palette.secondary.light,
[theme.breakpoints.down("lg")]: {
fontSize: "24px"
},
[theme.breakpoints.down("sm")]: {
fontSize: "16px"
}
}));
28 changes: 22 additions & 6 deletions src/components/commons/CopyButton/index.tsx
@@ -1,12 +1,12 @@
import { IconButton, IconButtonProps, TooltipProps, styled, useTheme } from "@mui/material";
import React, { useEffect, useState } from "react";
import { IconButton, IconButtonProps, styled, TooltipProps, useTheme } from "@mui/material";
import { useCopyToClipboard } from "react-use";
import { BiCheckCircle } from "react-icons/bi";
import { useCopyToClipboard } from "react-use";

import { CopyIconSquare } from "src/commons/resources";

import CustomTooltip from "../CustomTooltip";
import CustomIcon from "../CustomIcon";
import CustomTooltip from "../CustomTooltip";

const Button = styled(IconButton)`
color: ${(props) => props.theme.palette.text.primary};
Expand All @@ -22,14 +22,25 @@ interface CopyButtonProps extends IconButtonProps {
className?: string;
children?: React.ReactNode;
customIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
height?: number;
fill?: string;
onClick?: (e: React.MouseEvent) => void;
}

const CopyButton: React.FC<CopyButtonProps> = ({ text = "", onClick, children, placement, customIcon, ...props }) => {
const CopyButton: React.FC<CopyButtonProps> = ({
text = "",
height,
onClick,
fill,
children,
placement,
customIcon,
...props
}) => {
const [, copyToClipboard] = useCopyToClipboard();
const [copied, setCopied] = useState<boolean>();
const [open, setOpen] = useState<boolean>(false);
const theme = useTheme();
const [open, setOpen] = useState(false);

useEffect(() => {
if (copied) {
Expand All @@ -48,6 +59,7 @@ const CopyButton: React.FC<CopyButtonProps> = ({ text = "", onClick, children, p
onClick?.(e);
}
};

return (
<CustomTooltip
open={open}
Expand All @@ -65,7 +77,11 @@ const CopyButton: React.FC<CopyButtonProps> = ({ text = "", onClick, children, p
style={{ verticalAlign: "text-bottom", scale: "2", height: 16 }}
/>
) : (
<CustomIcon fill={theme.palette.secondary.light} icon={customIcon || CopyIconSquare} height={16} />
<CustomIcon
fill={fill ? fill : theme.palette.secondary.light}
icon={customIcon || CopyIconSquare}
height={height ? height : 16}
/>
))}
</Button>
</CustomTooltip>
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Expand Up @@ -1029,6 +1029,7 @@
"pool.harkFork": "Hard-fork initiation",
"pool.Infor": "Infor",
"pool.tabPool": "The vote cast on the blockchain by Pool Name.",
"pool.tabPoolDrep": "The vote cast on the blockchain by Drep.",
"pool.overall": "Votes cast on the blockchain by Delegated Representatives (DReps), Stake Pool Operators (SPOs), and members of the Constitutional Committee.",
"pool.actionMetadata": "Governance Action Metadata",
"pool.anchor": "Anchor",
Expand Down
16 changes: 15 additions & 1 deletion src/pages/NativeScriptsAndSC/styles.ts
Expand Up @@ -211,6 +211,13 @@ export const StyledTabAssociated = styled(Box)(() => ({
overflowY: "scroll"
}));

export const FilterWrapper = styled(Box)`
background: ${({ theme }) => theme.palette.secondary[0]};
position: relative;
display: inline-flex;
border-radius: 5px;
`;

export const FilterContainer = styled(Box)(({ theme }) => ({
width: 300,
backgroundColor: theme.palette.secondary[0],
Expand All @@ -221,11 +228,18 @@ export const FilterContainer = styled(Box)(({ theme }) => ({
borderRadius: theme.spacing(1),
boxShadow: "2px 2px 10px 0px #43465633",
[theme.breakpoints.down("sm")]: {
width: "calc(100% - 30px)"
width: 230,
left: "21"
},

"& .MuiAccordion-root::before": {
position: "unset !important"
},

":hover": {
backgroundColor: theme.palette.secondary[0]
},

":after": {
content: "''",
display: "block",
Expand Down

0 comments on commit 841b723

Please sign in to comment.