fix sold out bonds representation on the left menu panel
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
cdf1f7cabf
commit
2308d5dbab
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.7.24",
|
||||
"version": "0.7.25",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -79,6 +79,7 @@ const NavContent = ({ chainId, addressChainId }) => {
|
||||
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
|
||||
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
||||
|
||||
const sortedGhostBonds = useMemo(() => sortBondsByDiscount(ghostBonds), [ghostBonds]);
|
||||
const bridgeNumbers = useMemo(() => {
|
||||
const connectedNetworks = Object.keys(GATEKEEPER_ADDRESSES).length;
|
||||
const number = 1 + connectedNetworks * 3;
|
||||
@ -144,10 +145,10 @@ const NavContent = ({ chainId, addressChainId }) => {
|
||||
to={`/${chainName}/bonds`}
|
||||
children={
|
||||
<AccordionDetails style={{ margin: "0 0 -20px", display: "flex", flexDirection: "column", gap: "10px" }}>
|
||||
{ghostBonds.length > 0 && <Box width="180px" mb="10px" ml="auto">
|
||||
{sortedGhostBonds.length > 0 && <Box width="180px" mb="10px" ml="auto">
|
||||
<Typography component="span" variant="body2">Bond Discounts</Typography>
|
||||
</Box>}
|
||||
{sortBondsByDiscount(ghostBonds).map((bond, index) => {
|
||||
{sortedGhostBonds.map((bond, index) => {
|
||||
return (
|
||||
<Link
|
||||
component={NavLink}
|
||||
@ -168,7 +169,7 @@ const NavContent = ({ chainId, addressChainId }) => {
|
||||
variant="body2"
|
||||
>
|
||||
{bond.displayName}
|
||||
{bond.soldOut
|
||||
{bond.isSoldOut
|
||||
? <Chip label="Sold Out" template="darkGray" />
|
||||
: <BondDiscount discount={bond.discount} />
|
||||
}
|
||||
|
||||
@ -74,8 +74,9 @@ const ProtocolDetails = ({ chainId, isMobileScreen, theme, }) => {
|
||||
const { epoch } = useEpoch(chainId);
|
||||
|
||||
const maxBondDiscountTest = useMemo(() => {
|
||||
if (liveBonds?.length === 0) return "Coming Up";
|
||||
const maxDiscountBond = liveBonds.reduce((prev, current) =>
|
||||
const sortedGhostBonds = liveBonds.filter((bond) => !bond.isSoldOut)
|
||||
if (sortedGhostBonds?.length === 0) return "Coming Up";
|
||||
const maxDiscountBond = sortedGhostBonds.reduce((prev, current) =>
|
||||
(prev.discount > current.discount) ? prev : current
|
||||
);
|
||||
const maxDiscount = maxDiscountBond.discount.mul(new DecimalBigNumber(100, 0));
|
||||
|
||||
@ -39,7 +39,7 @@ export const formatNumber = (number, precision = 0) => {
|
||||
};
|
||||
|
||||
export const sortBondsByDiscount = (bonds) => {
|
||||
return Array.from(bonds).filter((bond) => !bond.isSoldOut).sort((a, b) => (a.discount.gt(b.discount) ? -1 : 1));
|
||||
return Array.from(bonds).sort((a, b) => (a.discount.gt(b.discount) ? -1 : 1));
|
||||
};
|
||||
|
||||
export const timeConverter = (time, max = 7200, maxText = "long ago") => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user