From 2308d5dbabe3ae66c447dc1cfd38bb329d6d7b39 Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Tue, 28 Apr 2026 13:32:09 +0300 Subject: [PATCH] fix sold out bonds representation on the left menu panel Signed-off-by: Uncle Fatso --- package.json | 2 +- src/components/Sidebar/NavContent.jsx | 7 ++++--- .../TreasuryDashboard/components/ProtocolDetails.jsx | 5 +++-- src/helpers/index.js | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index a7093be..e1e7574 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.7.24", + "version": "0.7.25", "type": "module", "scripts": { "dev": "vite", diff --git a/src/components/Sidebar/NavContent.jsx b/src/components/Sidebar/NavContent.jsx index fea5f9d..6a850fa 100644 --- a/src/components/Sidebar/NavContent.jsx +++ b/src/components/Sidebar/NavContent.jsx @@ -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={ - {ghostBonds.length > 0 && + {sortedGhostBonds.length > 0 && Bond Discounts } - {sortBondsByDiscount(ghostBonds).map((bond, index) => { + {sortedGhostBonds.map((bond, index) => { return ( { variant="body2" > {bond.displayName} - {bond.soldOut + {bond.isSoldOut ? : } diff --git a/src/containers/TreasuryDashboard/components/ProtocolDetails.jsx b/src/containers/TreasuryDashboard/components/ProtocolDetails.jsx index 5fd7521..d5cd414 100644 --- a/src/containers/TreasuryDashboard/components/ProtocolDetails.jsx +++ b/src/containers/TreasuryDashboard/components/ProtocolDetails.jsx @@ -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)); diff --git a/src/helpers/index.js b/src/helpers/index.js index df52466..781e888 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -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") => {