Skip to content

Commit

Permalink
fix: MET-1960 update pool list
Browse files Browse the repository at this point in the history
  • Loading branch information
Sotatek-TaiTruong committed Mar 22, 2024
1 parent 551c7e2 commit 5e1a5fd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 57 deletions.
58 changes: 11 additions & 47 deletions src/components/DelegationPool/DelegationList/index.tsx
@@ -1,5 +1,4 @@
import { Box, useTheme } from "@mui/material";
import { get } from "lodash";
import { useTranslation } from "react-i18next";
import { useEffect, useRef, useState } from "react";
import { useHistory } from "react-router-dom";
Expand All @@ -23,7 +22,6 @@ import {
SearchContainer,
ShowRetiredPools,
StyledInput,
StyledLinearProgress,
SubmitButton,
TopSearchContainer
} from "./styles";
Expand Down Expand Up @@ -63,14 +61,14 @@ const DelegationLists: React.FC = () => {
}
}, [fetchData.initialized, history]);

const columns: Column<Delegators & { adaFake: number; feeFake: number }>[] = [
const columns: Column<Delegators>[] = [
{
title: t("glossary.pool"),
key: "poolName",
minWidth: "200px",
maxWidth: "200px",
render: (r) => (
<CustomTooltip title={r.poolName || r.poolId}>
<CustomTooltip title={r.tickerName || ""}>
<PoolName to={{ pathname: details.delegation(r.poolId), state: { fromPath } }}>
<Box component={"span"} textOverflow={"ellipsis"} whiteSpace={"nowrap"} overflow={"hidden"}>
{r.poolName || `${getShortHash(r.poolId)}`}
Expand All @@ -79,15 +77,6 @@ const DelegationLists: React.FC = () => {
</CustomTooltip>
)
},
{
title: t("common.ticker") + " ",
key: "tickerName",
minWidth: "120px",
render: (r) => <Box component={"span"}>{r.tickerName}</Box>,
sort: ({ columnKey, sortValue }) => {
sortValue ? setSort(`${columnKey},${sortValue}`) : setSort("");
}
},
{
title: (
<Box component={"span"}>
Expand Down Expand Up @@ -116,19 +105,12 @@ const DelegationLists: React.FC = () => {
},
{
title: t("glossary.saturation"),
minWidth: "200px",
minWidth: "120px",
key: "saturation",
render: (r) =>
r.saturation != null ? (
<Box display="flex" alignItems="center" justifyContent={"end"}>
<Box component={"span"} mr={1}>
{formatPercent(r.saturation / 100) || `0%`}
</Box>
<StyledLinearProgress
variant="determinate"
saturation={r.saturation}
value={r.saturation > 100 ? 100 : get(r, "saturation", 0)}
/>
<Box component={"span"} mr={1}>
{formatPercent(r.saturation / 100) || `0%`}
</Box>
) : (
t("common.N/A")
Expand All @@ -137,15 +119,6 @@ const DelegationLists: React.FC = () => {
sortValue ? setSort(`${columnKey},${sortValue}`) : setSort("");
}
},
{
title: t("glossary.numberOfDelegators"),
minWidth: "200px",
key: "numberDelegators",
render: (r) => <Box component={"span"}>{r.numberDelegators || 0}</Box>,
sort: ({ columnKey, sortValue }) => {
sortValue ? setSort(`${columnKey},${sortValue}`) : setSort("");
}
},
{
title: t("glossary.blocksInEpoch"),
key: "epochBlock",
Expand All @@ -165,28 +138,19 @@ const DelegationLists: React.FC = () => {
}
},
{
title: (
<Box component={"span"} sx={{ textWrap: "nowrap" }}>
{t("glossary.fixedCost")} (<ADAicon />)
</Box>
),
key: "pu.fixedCost",
title: t("votingPower") + " ",
key: "votingPower",
minWidth: "120px",
render: (r) => (
<Box component="span">
{formatADAFull(r.feeAmount)}&nbsp;
<ADAicon />
</Box>
),
render: (r) => `${formatPercent(r.votingPower)}`,
sort: ({ columnKey, sortValue }) => {
sortValue ? setSort(`${columnKey},${sortValue}`) : setSort("");
}
},
{
title: t("margin") + " ",
key: "margin",
title: t("governanceParticipationRate") + " ",
key: "governanceParticipationRate",
minWidth: "120px",
render: (r) => `${formatPercent(r.feePercent)}`,
render: (r) => `${formatPercent(r.governanceParticipationRate)}`,
sort: ({ columnKey, sortValue }) => {
sortValue ? setSort(`${columnKey},${sortValue}`) : setSort("");
}
Expand Down
4 changes: 3 additions & 1 deletion src/locales/en/translation.json
Expand Up @@ -307,6 +307,8 @@
"saturation": "Saturation",
"fixedCost": "Fixed Cost",
"margin": "Margin",
"votingPower": "Voting Power",
"governanceParticipationRate": "Governance Participation Rate",
"declaredPledge": "Declared Pledge",
"epochBlocks": "Epoch Blocks",
"lifetimeBlocks": "Lifetime Blocks",
Expand Down Expand Up @@ -1013,5 +1015,5 @@
"bolnisi.verifyErrorTooltip": "A connection to the verification service could not be established.",
"bolnisi.verifyErrorTooltipTryAgain": "Please, refresh the page to try again.",
"bolnisi.verifyError": "Verification Unavailable",
"account.myProfile":"My Profile"
"account.myProfile": "My Profile"
}
19 changes: 10 additions & 9 deletions src/types/delegationPools.d.ts
Expand Up @@ -12,20 +12,21 @@ interface OverViewDelegation {
}

interface Delegators {
id: number;
poolId: string;
poolName: string;
tickerName: string;
poolSize: number;
reward: number;
feePercent: number;
feeAmount: number;
pledge: number;
saturation: number;
stakeLimit;
numberDelegators?: number;
lifetimeBlock?: number;
lifetimeRos?: number;
epochBlock?: number;
tickerName?: string;
stakeLimit: number;
reserves: number;
epochBlock: number;
lifetimeBlock: number;
votingPower: number;
governanceParticipationRate: number;
retired: boolean;
kparam: number;
}

interface DelegationOverview {
Expand Down

0 comments on commit 5e1a5fd

Please sign in to comment.