diff --git a/components/portfolio/Breakdown.tsx b/components/portfolio/Breakdown.tsx index 9e382decd..d4a0b6352 100644 --- a/components/portfolio/Breakdown.tsx +++ b/components/portfolio/Breakdown.tsx @@ -68,7 +68,7 @@ export const PortfolioBreakdown = (props: PortfolioBreakdownProps) => { title="Liquidity" value={poolZtgTotal?.mul(ZTG) ?? new Decimal(0)} usdZtgPrice={props.usdZtgPrice} - changePercentage={props.subsidy.changePercentage} + changePercentage={0} /> )} diff --git a/components/portfolio/MarketPositions.tsx b/components/portfolio/MarketPositions.tsx index b7ef68e80..8415a638c 100644 --- a/components/portfolio/MarketPositions.tsx +++ b/components/portfolio/MarketPositions.tsx @@ -170,103 +170,104 @@ export const MarketPositions = ({ ); }; - // if (positions.some(displayBalance)) { - return ( -
- - displayBalance(pos)) - .map( - ({ - assetId, - price, - userBalance, - outcome, - changePercentage, - market, - avgCost, - rpnl, - upnl, - }) => { - const baseAssetUsdPrice = lookUpAssetPrice( - market.baseAsset, - foreignAssetPrices, - usdZtgPrice, - ); - return { - outcome: outcome, - userBalance: userBalance.div(ZTG).toNumber(), - price: { - value: price.toNumber(), - usdValue: price.mul(baseAssetUsdPrice ?? 0).toNumber(), - }, - cost: { - value: avgCost, - usdValue: new Decimal(avgCost) - .mul(baseAssetUsdPrice ?? 0) - .toNumber(), - }, - upnl: { - value: upnl, - usdValue: new Decimal(upnl) - .mul(baseAssetUsdPrice ?? 0) - .toNumber(), - }, - rpnl: { - value: rpnl, - usdValue: new Decimal(rpnl) - .mul(baseAssetUsdPrice ?? 0) - .toNumber(), - }, - value: { - value: userBalance.mul(price).div(ZTG).toNumber(), - usdValue: userBalance - .mul(price) - .mul(baseAssetUsdPrice ?? 0) - .div(ZTG) - .toNumber(), - }, - change: isNaN(changePercentage) - ? 0 - : changePercentage.toFixed(1), - actions: ( -
- {IOPoolShareAssetId.is(assetId) ? ( - - ) : marketStage?.type === "Trading" && - IOMarketOutcomeAssetId.is(assetId) ? ( - - ) : marketStage?.type === "Resolved" ? ( - - ) : IOMarketOutcomeAssetId.is(assetId) && - marketStage?.type === "Reported" ? ( - - ) : IOMarketOutcomeAssetId.is(assetId) && - (marketStage?.type === "OpenReportingPeriod" || - (marketStage?.type === "OracleReportingPeriod" && - isOracle)) ? ( - - ) : ( - "" - )} -
- ), - }; - }, - )} - /> - - ); + if (positions.some(displayBalance)) { + return ( +
+ +
displayBalance(pos)) + .map( + ({ + assetId, + price, + userBalance, + outcome, + changePercentage, + market, + avgCost, + rpnl, + upnl, + }) => { + const baseAssetUsdPrice = lookUpAssetPrice( + market.baseAsset, + foreignAssetPrices, + usdZtgPrice, + ); + return { + outcome: outcome, + userBalance: userBalance.div(ZTG).toNumber(), + price: { + value: price.toNumber(), + usdValue: price.mul(baseAssetUsdPrice ?? 0).toNumber(), + }, + cost: { + value: avgCost, + usdValue: new Decimal(avgCost) + .mul(baseAssetUsdPrice ?? 0) + .toNumber(), + }, + upnl: { + value: upnl, + usdValue: new Decimal(upnl) + .mul(baseAssetUsdPrice ?? 0) + .toNumber(), + }, + rpnl: { + value: rpnl, + usdValue: new Decimal(rpnl) + .mul(baseAssetUsdPrice ?? 0) + .toNumber(), + }, + value: { + value: userBalance.mul(price).div(ZTG).toNumber(), + usdValue: userBalance + .mul(price) + .mul(baseAssetUsdPrice ?? 0) + .div(ZTG) + .toNumber(), + }, + change: isNaN(changePercentage) + ? 0 + : changePercentage.toFixed(1), + actions: ( +
+ {IOPoolShareAssetId.is(assetId) ? ( + + ) : marketStage?.type === "Trading" && + IOMarketOutcomeAssetId.is(assetId) ? ( + + ) : marketStage?.type === "Resolved" ? ( + + ) : IOMarketOutcomeAssetId.is(assetId) && + marketStage?.type === "Reported" ? ( + + ) : IOMarketOutcomeAssetId.is(assetId) && + (marketStage?.type === "OpenReportingPeriod" || + (marketStage?.type === "OracleReportingPeriod" && + isOracle)) ? ( + + ) : ( + "" + )} +
+ ), + }; + }, + )} + /> + + ); + } return <>; }; diff --git a/pages/portfolio/[address].tsx b/pages/portfolio/[address].tsx index c34a4ce6e..0756b8ee3 100644 --- a/pages/portfolio/[address].tsx +++ b/pages/portfolio/[address].tsx @@ -138,9 +138,9 @@ const Portfolio: NextPageWithLayout = () => { (marketPositions) => { const market = marketPositions[0].market; - // marketPositions = marketPositions.filter((position) => - // position.userBalance.gt(0), - // ); + marketPositions = marketPositions.filter((position) => + position.userBalance.gt(0), + ); if ( market.status === "Resolved" && @@ -161,7 +161,9 @@ const Portfolio: NextPageWithLayout = () => { className="mb-8" market={market} usdZtgPrice={ztgPrice} - positions={marketPositions} + positions={marketPositions.filter((position) => + position.userBalance.gt(0), + )} /> ); },