fix sold out bonds representation on the left menu panel

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-04-28 13:32:09 +03:00
parent cdf1f7cabf
commit 2308d5dbab
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
4 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "ghost-dao-interface", "name": "ghost-dao-interface",
"private": true, "private": true,
"version": "0.7.24", "version": "0.7.25",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -79,6 +79,7 @@ const NavContent = ({ chainId, addressChainId }) => {
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO"); const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST"); const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
const sortedGhostBonds = useMemo(() => sortBondsByDiscount(ghostBonds), [ghostBonds]);
const bridgeNumbers = useMemo(() => { const bridgeNumbers = useMemo(() => {
const connectedNetworks = Object.keys(GATEKEEPER_ADDRESSES).length; const connectedNetworks = Object.keys(GATEKEEPER_ADDRESSES).length;
const number = 1 + connectedNetworks * 3; const number = 1 + connectedNetworks * 3;
@ -144,10 +145,10 @@ const NavContent = ({ chainId, addressChainId }) => {
to={`/${chainName}/bonds`} to={`/${chainName}/bonds`}
children={ children={
<AccordionDetails style={{ margin: "0 0 -20px", display: "flex", flexDirection: "column", gap: "10px" }}> <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> <Typography component="span" variant="body2">Bond Discounts</Typography>
</Box>} </Box>}
{sortBondsByDiscount(ghostBonds).map((bond, index) => { {sortedGhostBonds.map((bond, index) => {
return ( return (
<Link <Link
component={NavLink} component={NavLink}
@ -168,7 +169,7 @@ const NavContent = ({ chainId, addressChainId }) => {
variant="body2" variant="body2"
> >
{bond.displayName} {bond.displayName}
{bond.soldOut {bond.isSoldOut
? <Chip label="Sold Out" template="darkGray" /> ? <Chip label="Sold Out" template="darkGray" />
: <BondDiscount discount={bond.discount} /> : <BondDiscount discount={bond.discount} />
} }

View File

@ -74,8 +74,9 @@ const ProtocolDetails = ({ chainId, isMobileScreen, theme, }) => {
const { epoch } = useEpoch(chainId); const { epoch } = useEpoch(chainId);
const maxBondDiscountTest = useMemo(() => { const maxBondDiscountTest = useMemo(() => {
if (liveBonds?.length === 0) return "Coming Up"; const sortedGhostBonds = liveBonds.filter((bond) => !bond.isSoldOut)
const maxDiscountBond = liveBonds.reduce((prev, current) => if (sortedGhostBonds?.length === 0) return "Coming Up";
const maxDiscountBond = sortedGhostBonds.reduce((prev, current) =>
(prev.discount > current.discount) ? prev : current (prev.discount > current.discount) ? prev : current
); );
const maxDiscount = maxDiscountBond.discount.mul(new DecimalBigNumber(100, 0)); const maxDiscount = maxDiscountBond.discount.mul(new DecimalBigNumber(100, 0));

View File

@ -39,7 +39,7 @@ export const formatNumber = (number, precision = 0) => {
}; };
export const sortBondsByDiscount = (bonds) => { 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") => { export const timeConverter = (time, max = 7200, maxText = "long ago") => {