From 8c267f7da2549ffa472aa9f4c8aa35d61879e54f Mon Sep 17 00:00:00 2001 From: DaniiRix Date: Thu, 9 Oct 2025 00:10:16 +0530 Subject: [PATCH 1/3] fix: null value access --- src/props/getLendingProps.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/props/getLendingProps.ts b/src/props/getLendingProps.ts index 3918d454..b9331cff 100644 --- a/src/props/getLendingProps.ts +++ b/src/props/getLendingProps.ts @@ -17,7 +17,7 @@ export async function getLSDPageData(pools) { let lsdApy = pools .filter((p) => lsdProtocolsSlug.includes(p.project) && p.chain === 'Ethereum' && p.symbol.includes('ETH')) - .concat(pools.find((i) => i.project === 'crypto.com-staked-eth')) + .concat(pools.find((i) => i.project === 'crypto.com-staked-eth') || []) .map((p) => ({ ...p, name: p.project @@ -73,7 +73,8 @@ async function getLendBorrowData(pools: Array = []) { const apyBaseBorrow = x.apyBaseBorrow !== null ? -x.apyBaseBorrow : null; const apyRewardBorrow = x.apyRewardBorrow; - const apyBorrow = apyBaseBorrow === null && apyRewardBorrow === null ? null : apyBaseBorrow + apyRewardBorrow; + const apyBorrow = + apyBaseBorrow === null && apyRewardBorrow === null ? null : (apyBaseBorrow || 0) + (apyRewardBorrow || 0); const isBorrowable = x.borrowable || x.totalBorrowUsd > 0; const lsdApy = lsdData.find((i) => p?.symbol?.toLowerCase().includes(i.symbol?.toLowerCase()) && !p.symbol?.includes('-')) @@ -83,12 +84,12 @@ async function getLendBorrowData(pools: Array = []) { const compoundData = compoundPools.find( (a) => a.underlyingTokens[0].toLowerCase() === x.underlyingTokens[0].toLowerCase() ); - totalAvailableUsd = compoundData?.totalSupplyUsd - compoundData?.totalBorrowUsd; + totalAvailableUsd = compoundData ? compoundData.totalSupplyUsd - compoundData.totalBorrowUsd : null; } else if (p.project === 'morpho-aave') { const aaveData = aavev2Pools.find( (a) => a.underlyingTokens[0].toLowerCase() === x.underlyingTokens[0].toLowerCase() ); - totalAvailableUsd = aaveData?.totalSupplyUsd - aaveData?.totalBorrowUsd; + totalAvailableUsd = aaveData ? aaveData.totalSupplyUsd - aaveData.totalBorrowUsd : null; } else if (x.totalSupplyUsd === null && x.totalBorrowUsd === null) { totalAvailableUsd = null; } else if (cdpPools.includes(x.pool)) { @@ -117,11 +118,11 @@ async function getLendBorrowData(pools: Array = []) { borrowFactor: x.borrowFactor, totalAvailableUsd, apyBorrow, - rewardTokens: (p.apyReward ?? 0) > 0 || x.apyRewardBorrow > 0 ? x.rewardTokens : p.rewardTokens + rewardTokens: (p.apyReward ?? 0) > 0 || (x.apyRewardBorrow || 0) > 0 ? x.rewardTokens : p.rewardTokens }; }) .filter(Boolean) - .sort((a, b) => b!.totalSupplyUsd - a!.totalSupplyUsd) as Array; + .sort((a, b) => (b?.totalSupplyUsd || 0) - (a?.totalSupplyUsd || 0)) as Array; return { yields: pools, From ca46d94187b105cca0ec81b7ed3642b280ebe595 Mon Sep 17 00:00:00 2001 From: DaniiRix Date: Thu, 9 Oct 2025 00:10:56 +0530 Subject: [PATCH 2/3] style: fix token select menu visibility --- src/components/Lending/TokenInput.tsx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/Lending/TokenInput.tsx b/src/components/Lending/TokenInput.tsx index 03307eca..afd69af0 100644 --- a/src/components/Lending/TokenInput.tsx +++ b/src/components/Lending/TokenInput.tsx @@ -37,6 +37,9 @@ const customSelectStyles = { }), option: (provided, state) => ({ ...provided, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', backgroundColor: state.isSelected ? '#4A5568' : state.isFocused ? '#3f444e' : '#222429', color: 'white', '&:active': { @@ -85,8 +88,13 @@ export function LendingInput({ }) { const router = useRouter(); const { includeRewardApy } = router.query; + + // const handlePercentChange = (percent) => { + // onAmountChange(Number(amount * percent).toFixed(2)); + // }; + return ( - + {isBorrow ? 'You Borrow' : 'Collateral'} {!isBorrow ? ( @@ -107,7 +115,7 @@ export function LendingInput({ ) : null} - + ) : null} - {isBorrow ? ( + {/* {isBorrow ? ( - - - - ) : null} + ) : null} */} ); From 2ebf2c705b8cf316a68e158b6a3f99dd586c552b Mon Sep 17 00:00:00 2001 From: DaniiRix Date: Thu, 9 Oct 2025 00:11:23 +0530 Subject: [PATCH 3/3] style: minor ui fixes --- src/components/Lending/index.tsx | 34 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/components/Lending/index.tsx b/src/components/Lending/index.tsx index 3af6c63d..d1ef725e 100644 --- a/src/components/Lending/index.tsx +++ b/src/components/Lending/index.tsx @@ -53,7 +53,9 @@ const YieldsRow = ({ data, index, style, amountsProvided }) => { style={{ position: 'absolute' }} alt={row.project} /> - {name} + + {name} + { const customTokens = [ { - label: 'Stables', - value: 'STABLES', - logoURI: 'https://icons.llamao.fi/icons/pegged/usd_native?h=48&w=48' - }, - { - label: 'ETH', - value: 'ETH', - logoURI: 'https://icons.llamao.fi/icons/pegged/ethereum?h=48&w=48' + label: 'All USD Stablecoins', + value: 'STABLES' } ]; const useGetPrices = (tokens) => { @@ -427,9 +423,11 @@ const Lending = ({ data: { yields: initialData, ...props }, isLoading }) => { }} amount={amountToLend || ''} onAmountChange={setAmountToLend} - tokenPlaceholder="Token to Lend" + tokenPlaceholder="Select token" /> { router.push( { @@ -462,7 +460,7 @@ const Lending = ({ data: { yields: initialData, ...props }, isLoading }) => { }} amount={amountToBorrow || ''} onAmountChange={setAmountToBorrow} - tokenPlaceholder="Token to Borrow" + tokenPlaceholder="Select token" isBorrow /> @@ -516,7 +514,19 @@ const Lending = ({ data: { yields: initialData, ...props }, isLoading }) => { {filteredPoolPairs.length === 0 ? ( - + <> + {!selectedLendToken || !selectedBorrowToken ? ( + + ) : ( + + )} + ) : (